-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
fix: Fix deadlock in new streaming CSV / NDJSON sinks #21598
Conversation
@@ -122,11 +122,14 @@ impl SinkNode for CsvSinkNode { | |||
writer.write_batch(&df)?; | |||
|
|||
allocation_size = allocation_size.max(buffer.len()); | |||
|
|||
// Must drop before linearizer insert or will deadlock. | |||
drop(consume_token); // Keep the consume_token until here to increase the |
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.
If the consume token is sent into the linearizer, we can end up in a deadlock state for a scan->sink
query - given 2 workers from the source node (1 and 2):
- Worker 1 inserts the consume token into the linearizer buffer
- The linearizer is waiting for an insertion from worker 2
- Worker 2 is waiting for the channel of the next source phase
- Worker 1 is waiting for the consume token to be dropped while holding a ref to the current source phase, preventing it from ending
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #21598 +/- ##
=======================================
Coverage 79.75% 79.75%
=======================================
Files 1604 1604
Lines 231519 231527 +8
Branches 2639 2639
=======================================
+ Hits 184640 184663 +23
+ Misses 46270 46255 -15
Partials 609 609 ☔ View full report in Codecov by Sentry. |
This is really not a fix for the problem, and the deadlock still occurs. Just less often and more related to phase transitions. I fixed it properly in #21600. |
No description provided.