-
Notifications
You must be signed in to change notification settings - Fork 658
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
Allow consumer methods to run while closing #1073
Allow consumer methods to run while closing #1073
Conversation
@@ -545,6 +553,9 @@ func (c *Consumer) Close() (err error) { | |||
c.Poll(100) | |||
} | |||
|
|||
// After this point, no more consumer methods may be called. | |||
atomic.StoreUint32(&c.isClosed, 1) |
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.
Should this be just before returning? rd_kafka_destroy
can stuck due to various reasons.
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.
We're destroying an important queue below, which is necessary for most public API to run (it's the queue on which we're getting all the events from, from librdkafka side).
So most functions called after this point will panic due to segfault
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.
I was just talking about atomic.StoreUint32(&c.isClosed, 1)
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.
Yep, storing that will allow a small window of usage after the queue destruction - methods like Poll() can be called until that store is called.
8740152
into
dev_go_flush_ignore_queue_buffering_time
It's merged but only in the other branch. I did it on top of that because of test file organization related changes. |
Is this by chance related to #1016 ? |
I'm guessing it would not be. I saw the stack traces in those functions, we've already made it to the librdkafka functions and are waiting for those to return, the internal state of the Go consumer wouldn't come into the picture |
See #1062
#901 (comment)
With #901, such flows were no longer working after the final Close().
This was because the consumer would be counted as closed and commit would return an error.
it's based on the dev_go_flush_ignore_queue_buffering_time since I'm using the same file