-
Notifications
You must be signed in to change notification settings - Fork 30.1k
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
http2: cannot handle session destroy error emitted by Http2Session.onGoawayData #20999
Comments
I would suggest looking through your code and figuring out why the proper events aren't being bound to the session. It's likely there's an error in your flow somewhere. On the Node.js end, the way it works is pretty bulletproof but we can't really make any guarantees given the level of patching and accessing internals (Http2Server, etc.) you've done. Here's the relevant line that would handle all emitted errors: node/lib/internal/http2/core.js Line 2570 in 5624a6f
|
I will try to write clean tests - but this is problematic because this error is extremely rare. |
@webcarrot Definitely understand but given the error handler I linked above, which is attached right after the Http2Session is created in Happy to investigate further given new information that would indicate this is an issue in core code. |
I will wrap connection stream for http2 session directly by |
Its not related anyhow - _session is somehow invalid in gdb backlog ("attack" server using firefox ctrl+f5 - fast open and close connections):
|
That might be related to #21016, not sure. It's missing some bits in there that make it hard to figure out what's going on. |
close - no such errors in logs after change (or node update). |
Sorry for my english.
From time to time session emit error that is not handle by server/listener "error", "streamError" or "sessionError" handlers:
events.js:167 throw er; // Unhandled 'error' event ^ Error [ERR_HTTP2_SESSION_ERROR]: Session closed with error code 1 at Http2Session.onGoawayData (internal/http2/core.js:477:21) at SocketProxy.ondata (internal/wrap_js_stream.js:62:22) at SocketProxy.emit (events.js:182:13) at addChunk (_stream_readable.js:279:12) at readableAddChunk (_stream_readable.js:264:11) at SocketProxy.Readable.push (_stream_readable.js:219:10) at SocketProxy._read (/xxx/node_modules/@webcarrot/server/lib/SocketProxy.js:81:21) at SocketProxy.tryRead (/xxx/node_modules/@webcarrot/server/lib/SocketProxy.js:99:12) at SocketProxy.addChunk (/xxx/node_modules/@webcarrot/server/lib/SocketProxy.js:92:10) at Socket.handleData (/xxx/node_modules/@webcarrot/server/lib/SocketProxy.js:26:61) at Socket.emit (events.js:182:13) at addChunk (_stream_readable.js:279:12) at readableAddChunk (_stream_readable.js:264:11) at Socket.Readable.push (_stream_readable.js:219:10) at Pipe.onread (net.js:636:20) Emitted 'error' event at: at emitErrorNT (internal/streams/destroy.js:82:8) at emitErrorAndCloseNT (internal/streams/destroy.js:50:3) at process._tickCallback (internal/process/next_tick.js:63:19)
Looks like session emit unhandled error on destroy.
This error should be handle by server
sessionError
to prevent app crash/restart.More info:
@webcarrot/server/lib/SocketProxy
(same name inwrap_js_stream
👎 ) is duplex stream that wrap connection stream ( #17132 ):https://gist.github.com/webcarrot/353c2f275ab234f5dc68f9c7b32d40ea
Server class looks like (extends plain Http2Server):
https://gist.github.com/webcarrot/e61e78e4562bf843248bacedfe3663e8
PROXY protocol server wrapper (extends extended server class):
https://gist.github.com/webcarrot/9a6c0a3d4bc6f4665465ac57dd3be373
Simple usage (not real but probably work via haproxy or similar):
The text was updated successfully, but these errors were encountered: