-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
poll for TIOCINQ and TIOCOUTQ instead of POLLIN, bump repeats (#51)
we noticed a few cases where if a program exited really quickly but dumped a lot of output (e.g. `env` in the replit shell) we could sometimes miss output we used to poll the controller side fd for POLLIN but that actually isn't _fully_ correct. the tty pipes look something like: ``` controlling program <> controller fd <> user fd <> user program |---user space------||--------kernel space------||-user space-| ``` we can sometimes enter cases where the controller side _thinks_ it has no more data to give to the controlling program (nodejs when using @replit/ruspty) but the kernel has decided to block on passing some user fd data to the controller fd (on linux for example, the pipe in the user fd -> controller fd direction has about 4kb of capacity) for example, if node isnt processing data events quickly enough, the controller-side queue can fill up and the user fd write will block until it has space again, we could rarely enter a race if nodejs decides to read an entire 4kb block completely emptying the controller fd queue and then the POLLIN logic could return with no more data left (even though the user side still has a pending write!) this would drop data :( a few changes: - rust-side - poll TIOCINQ and TIOCOUTQ on controller and user instead of just POLLIN on controller - wrapper level - trigger 'end' event on the read stream on EIO instead of just calling the cb (that way, other things with handles to the socket can also handle end appropriately) - exit condition is now - fd closed && fd fully read && program actually exited - test level - bump repeats from 50 -> 500 - rewrite it to a more standard async format so errors during the test actually are associated with that test - added a test for fast output (>4kb output and fast exit)
- Loading branch information
Showing
8 changed files
with
404 additions
and
437 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@replit/ruspty-darwin-arm64", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"os": [ | ||
"darwin" | ||
], | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@replit/ruspty-darwin-x64", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"os": [ | ||
"darwin" | ||
], | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@replit/ruspty-linux-x64-gnu", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"os": [ | ||
"linux" | ||
], | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "@replit/ruspty", | ||
"version": "3.3.0", | ||
"version": "3.4.0", | ||
"main": "dist/wrapper.js", | ||
"types": "dist/wrapper.d.ts", | ||
"author": "Szymon Kaliski <[email protected]>", | ||
|
@@ -36,7 +36,7 @@ | |
}, | ||
"scripts": { | ||
"artifacts": "napi artifacts", | ||
"build": "napi build --platform --release && npm run build:wrapper", | ||
"build": "napi build --platform --release && npm run build:wrapper && npm run format", | ||
"build:wrapper": "tsup", | ||
"prepublishOnly": "napi prepublish -t npm", | ||
"test": "vitest run", | ||
|
This file contains 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
Oops, something went wrong.