-
Notifications
You must be signed in to change notification settings - Fork 3.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make bloom gateway tasks cancelable (and other fixes) #11717
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks brilliant 💎
|
||
// The sender needs to close the channel once it's done sending to it. | ||
// Otherwise the forwarder in the gorouting never exits. | ||
func (ch ChanPipe[T]) forward(ctx context.Context) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❤️
} | ||
|
||
// Snd returns the channel for sending to the pipe. | ||
func (ch ChanPipe[T]) Snd() chan<- T { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: I'd rather use Send
and Receive
During testing I found another issue with this PR:
Not quite sure yet what the |
c8e4275
to
cc92906
Compare
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
Signed-off-by: Christian Haudum <christian.haudum@gmail.com>
ea7295b
to
5ec5fcc
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
skimmed, lgtm
Going to open a few smaller PRs with individual fixes. |
Superseded by #11792 |
Why we need it:
A bloom gateway request calling
FilterChunkRefs
that timed out caused a deadlock of the workers, because when the request context is cancelled, the request returned, but the task continued to process until the block querier tried to write to the results channel. That writing was blocked, because the request that was supposed to read from the results channel to gather the result was gone.How is is solved:
The PR introduces two changes:
Task
, which allows to check the cancellation of a request also in the task.Task
are replaced by a "pipe channel", which consists of a sender channel and a receiver channel. The pipe reads from the sender channel until it is closed, and forwards the received item to the receiver channel, but only if the internal context of the pipe isn't closed.Further smaller changes/fixes:
index out of bounds
panic in the code that removes filtered out chunk refs from th original request.DequeueMany
call on the task queue returns successive tasks based on their enqueue order.