Skip to content

Commit 63c7a7b

Browse files
committed
ref(node): Tighten the broken-pipe guard comments
1 parent 58c44fe commit 63c7a7b

3 files changed

Lines changed: 7 additions & 8 deletions

File tree

‎dev-packages/node-integration-tests/suites/public-api/OnUncaughtException/broken-stdio-pipe-test-script.js‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const Sentry = require('@sentry/node');
22

3-
// The DSN has to be unreachable rather than invalid, so that `client.close()` is
4-
// still pending while the broken pipe keeps producing errors.
3+
// Unreachable rather than invalid, so `client.close()` is still pending while the
4+
// broken pipe keeps erroring.
55
Sentry.init({
66
traceLifecycle: 'static',
77
dsn: 'https://public@127.0.0.1:1/1337',

‎dev-packages/node-integration-tests/suites/public-api/OnUncaughtException/test.ts‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ describe('OnUncaughtException integration', () => {
5050
test('should exit rather than recurse when stderr is a broken pipe', async () => {
5151
const testScriptPath = path.resolve(__dirname, 'broken-stdio-pipe-test-script.js');
5252

53-
// The heap cap is what makes a regression fail in ~1s. At the default heap size the
54-
// runaway recursion takes about a minute to exhaust it and just looks like a hang.
53+
// The heap cap makes a regression fail in ~1s; at the default size it takes a minute
54+
// and just looks like a hang.
5555
const child = childProcess.spawn(process.execPath, ['--max-old-space-size=64', testScriptPath], {
5656
stdio: ['ignore', 'pipe', 'pipe'],
5757
});
@@ -63,7 +63,7 @@ describe('OnUncaughtException integration', () => {
6363
child.on('exit', (code, signal) => resolve({ code, signal }));
6464
});
6565

66-
// Unbounded recursion shows up as SIGABRT from the V8 out-of-memory abort.
66+
// Unbounded recursion shows up as SIGABRT from the V8 OOM abort.
6767
expect(exited).toEqual({ code: 1, signal: null });
6868
});
6969

‎packages/node/src/utils/errorhandling.ts‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,8 @@ let isShuttingDown = false;
1010
* @hidden
1111
*/
1212
export function logAndExitProcess(error: unknown): void {
13-
// The console write below raises EPIPE when stderr is a broken pipe, which comes back as
14-
// another uncaught exception and lands here again. Return rather than exit, so the shutdown
15-
// already in flight keeps the `client.close()` flush that sends the fatal event.
13+
// A broken stderr makes the console write below raise EPIPE, re-entering here. Return
14+
// rather than exit, so the in-flight `client.close()` still flushes the fatal event.
1615
if (isShuttingDown) {
1716
return;
1817
}

0 commit comments

Comments
 (0)