Skip to content

fix: prevent deadlock in Prometheus chunked streaming#700

Merged
flarco merged 1 commit intoslingdata-io:v1.5.5from
danhngo-lx:main
Jan 25, 2026
Merged

fix: prevent deadlock in Prometheus chunked streaming#700
flarco merged 1 commit intoslingdata-io:v1.5.5from
danhngo-lx:main

Conversation

@danhngo-lx
Copy link

When streaming data from Prometheus with large time ranges (> 1 hour), the StreamRowsChunked function would stall after ~100 rows. This was caused by the bwRows channel (buffer size 100) filling up because processBwRows goroutine was never started.

The issue occurred because StreamRowsChunked creates a datastream with NewDatastreamContext() and pushes rows directly, bypassing Start() which normally starts the processBwRows goroutine.

Changes:

  • Add StartBwProcessor() public method to Datastream to start the bytes-written processor independently
  • Call StartBwProcessor() in StreamRowsChunked before pushing rows

This ensures the bwRows channel is drained, preventing the producer from blocking when the buffer fills up.

Related: #668

When streaming data from Prometheus with large time ranges (> 1 hour),
the StreamRowsChunked function would stall after ~100 rows. This was
caused by the bwRows channel (buffer size 100) filling up because
processBwRows goroutine was never started.

The issue occurred because StreamRowsChunked creates a datastream with
NewDatastreamContext() and pushes rows directly, bypassing Start()
which normally starts the processBwRows goroutine.

Changes:
- Add StartBwProcessor() public method to Datastream to start the
  bytes-written processor independently
- Call StartBwProcessor() in StreamRowsChunked before pushing rows

This ensures the bwRows channel is drained, preventing the producer
from blocking when the buffer fills up.
@flarco flarco changed the base branch from main to v1.5.5 January 25, 2026 23:01
@flarco flarco merged commit a0ae55c into slingdata-io:v1.5.5 Jan 25, 2026
@flarco
Copy link
Collaborator

flarco commented Jan 25, 2026

Thanks @danhngo-lx

@flarco flarco mentioned this pull request Jan 26, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants