-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Bun.stdin.stream() loses chunks in async iteration #8695
Comments
I'm sorry if it's inconvenient I'm reporting a number of bugs. I'm trying to replace Unlike the other bugs, there doesn't seem to be a simple workaround for this one... |
The problem is that ready() is sometimes called even when there is no Promise or handler to hand the data to. It's not quite clear to me when that happens. When it does, though, we read data into a buffer and then ignore it. Don't do that.
I've been unable to reproduce this issue after applying this (all code in Once My guess it that it's because So I think applying this patch would make the code more robust and avoid the problem for now; however, is |
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
This reverts commit 7eb51e7.
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Under certain circumstances, we would read data from FIFOs without a sensible place to put it, leading to dropped chunks in async iteration over Bun.stdin.stream(). Fixes oven-sh#8695.
This test seems to fail reliably with the current bun release. Uses stderr rather than stdout because bun-debug currently outputs debug information to stdout and I didn't want to filter it. The test simply counts to 20, taking 100 ms for each write, while the reader consumes chunks and takes one second to asynchronously process each one. Due to the timing-sensitive nature of the tested code, it does take 3 seconds to run, which I think is acceptable. Output with current bun release: 490 | let text = ""; 491 | for await (const chunk of producer.stderr) { 492 | text += [...chunk].map(x => String.fromCharCode(x)).join(""); 493 | await new Promise(r => setTimeout(r, 1000)); 494 | } 495 | expect(text).toBe("0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n"); ^ error: expect(received).toBe(expected) Expected: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n10\n11\n12\n13\n14\n15\n16\n17\n18\n19\n20\n" Received: "0\n1\n2\n3\n4\n5\n6\n7\n8\n9\n11\n12\n13\n14\n15\n16\n17\n18\n19\n" at .../bun/test/js/bun/io/bun-write.test.js:495:3 (fail) timed output should work [3022.97ms]
Reprodicible here #11553. What is the output of |
What version of Bun is running?
1.0.26+c75e768a6
What platform is your computer?
Linux 6.1.31-gentoo-dist x86_64 13th Gen Intel(R) Core(TM) i7-1370P
What steps can reproduce the bug?
In
bash
, runwhere
bunbug5.js
contains this code:What is the expected behavior?
output that looks like this:
(that's what I get if I use
sleep 1
rather thansleep .1
)What do you see instead?
This output:
This indicates that the third 4096-byte line, which starts with " 2.000", has been lost. The same applies to the sixth 4096-byte line, starting with " 5.000". The
strace
andlog
outputs indicate that the line has been read bybun
:The ioctl-read pair looks odd (we ask whether there's any data to read, there isn't, so we try to read 64KB anyway), and it happens precisely at the points when data is lost.
Additional information
The first part of the pipeline generates lines of precisely 4096 characters; the second part reads those and echoes them back at a rate of one per 100 ms; the third part simply saves the log; the fourth part runs the script and saves its strace.
The script reads a chunk (which happens to be a line), and calculates whether the number of bytes read so far corresponds to 4096 times the number the line begins with. That should always be the case after the first iteration. It then delays for 100 ms, which is how long it will take (approximately) for the next line to arrive.
The call to
Bun.gc(true)
isn't strictly necessary.The text was updated successfully, but these errors were encountered: