dont drop user fd until node reads a synthetic EOF#93
Merged
Conversation
masad-frost
reviewed
Sep 26, 2025
masad-frost
reviewed
Sep 26, 2025
masad-frost
reviewed
Sep 26, 2025
masad-frost
reviewed
Sep 26, 2025
masad-frost
reviewed
Sep 26, 2025
masad-frost
approved these changes
Sep 26, 2025
masad-frost
reviewed
Sep 26, 2025
lhchavez
approved these changes
Sep 27, 2025
Contributor
lhchavez
left a comment
There was a problem hiding this comment.
why is the Linux kernel this bad?
|
HELL YEAH |
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
turns out #51 reduced the race rate but did not eliminate it completely. we still see the data race bug very rarely and it is exacerbated on high-numbers of repeats in the tests and/or high nodejs event loop utilization
my old theory was:
controller_inq == 0 && controller_outq == 0 && user_inq == 0 && user_outq == 0, in theory we should never call the js side exit code until theres truly nothing left in the pipe (i.e. the readstream on the nodejs side has it in its own buffer)HOWEVER, with some logging i saw a few cases where in fact
controller_inq == 0 && controller_outq == 0 && user_inq == 0 && user_outq == 0, the program had exited, yet the nodejs side still missed some datawhat i think is actually happening is that
drop(user_fd);which sets TTY_OTHER_CLOSED synchronously and we get an error event queued on the streamhow we fix it:
\x1B]7878\x1B\\, 7878 is RUST on the phonepad :)) to the user fd (a cursory search shows no results, it seems very unlikely for this sequence to appear randomly)node-pty had the same problem and did the :grug: brain thing and added a wait 250ms so im calling it slightly more ok