bug: Fix issue #249 (Infinite waiting during CsvReader.Read)#250
Merged
devinrsmith merged 3 commits intodeephaven:mainfrom Jul 11, 2025
Merged
bug: Fix issue #249 (Infinite waiting during CsvReader.Read)#250devinrsmith merged 3 commits intodeephaven:mainfrom
devinrsmith merged 3 commits intodeephaven:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
TL;DR classic deadlock between writer and reader because code is trying to be clever.
Deep Background:
an early phase of processing looks like this:
That is, there is one queue for each column.
Furthermore each queue is actually composed of three subqueues:
There is also flow control logic which blocks the writer if it gets too far ahead of the reader. This flow control logic is where the bug happened.
Steps to reproduce:
fdataandfctrlare false. Now you have unflushed data in yourlargeByteArrayWriterand an unflushed control item in yourcontrolWriterbyteWriterbut not thecontrolWriter. This will causefdatato be true butfctrlto be false.byteWriterhas been flushed (because it filled), andcontrolWriterhas been flushed (because of theelse if (fdata)) but no one has flushedlargeByteArrayWriter.byteWriterandcontrolWriterbut no one will flushlargeByteArrayWritercontrolWriterleads to the reader reading the control word telling it to expect a large string. But because the writer never flusheslargeByteArrayWriter, the reader hangs forever waiting for a large string that will never come.[Edited: added these line to explain the deadlock]
The fix is when any of the queues flush, flush them all.