You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Closing the kafka.Writer while attempting to write a message can cause the process to hang indefinitely. This issue is resolved by closing the writer again.
This issue happened in an application that creates writers with different transports, which are closed after a configurable period of inactivity. The transports are not reused, causing the related goroutines (*connPool).discover and (*conn).run to also hang indefinitely.
This is almost a non-issue in real scenarios unless the inactivity period is set to a very low duration. I can also work around it by closing the writer again if the previous close doesn't complete in time. However, I thought you might want to know about it regardless.
Thanks!
The text was updated successfully, but these errors were encountered:
Describe the bug
Closing the kafka.Writer while attempting to write a message can cause the process to hang indefinitely. This issue is resolved by closing the writer again.
Kafka Version
To Reproduce
Expected Behavior
Expecting
kafka.Writer.Close()
not to hang.Observed Behavior
Hangs here: w.group.Wait()
*batchQueue.cond.Wait() waits for a broadcast signal, preventing the decrementing of the waitgroup counter. The signal would typically come from closing the writer here, but at that point, the
w.writers
map is still empty.Sequence of function calls leading to it:
Closing the writer again resolves the issue.
Additional Context
This issue happened in an application that creates writers with different transports, which are closed after a configurable period of inactivity. The transports are not reused, causing the related goroutines
(*connPool).discover
and(*conn).run
to also hang indefinitely.This is almost a non-issue in real scenarios unless the inactivity period is set to a very low duration. I can also work around it by closing the writer again if the previous close doesn't complete in time. However, I thought you might want to know about it regardless.
Thanks!
The text was updated successfully, but these errors were encountered: