Skip to content
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 server closing stream exception #26234

Open
TobyEalden opened this issue Oct 14, 2024 · 1 comment
Open

http2 server closing stream exception #26234

TobyEalden opened this issue Oct 14, 2024 · 1 comment
Labels
bug Something isn't working correctly node compat

Comments

@TobyEalden
Copy link
Contributor

Version: deno 2.0.0 (stable, release, aarch64-apple-darwin)

As part of investigation into #24845, I wrote a test that exposed another (seemingly unrelated) issue.

If an http2 server closes the stream while a client is connected an exception is thrown:

error: Uncaught (in promise) Http: error reading a body from connection: stream closed because of a broken pipe
    at async Object.pull (ext:deno_web/06_streams.js:938:27)

To reproduce the issue see https://github.com/TobyEalden/deno-http2-stream-test

I can't see a way to easily catch or avoid this error other than using a setTImout as shown here, and in any case the same code running under nodejs works as expected.

@leomongeg
Copy link

leomongeg commented Oct 19, 2024

Hi, I don't know if this is related but I'm facing a similar issue with this error output, maybe can help in the tracing of the error:

Execution Command:
GRPC_VERBOSITY=debug GRPC_TRACE=all deno run -A dist/src/main.cjs

Deno Version:
deno 2.0.1 (stable, release, aarch64-apple-darwin)
v8 12.9.202.13-rusty
typescript 5.6.2

Output:

D 2024-10-19T18:32:06.865Z | v1.12.2 90944 | server | (1) Server constructed
D 2024-10-19T18:32:06.868Z | v1.12.2 90944 | server | (1) bindAsync port=0.0.0.0:3000
D 2024-10-19T18:32:06.868Z | v1.12.2 90944 | dns_resolver | Resolver constructed for target dns:0.0.0.0:3000
D 2024-10-19T18:32:06.868Z | v1.12.2 90944 | dns_resolver | Returning IP address for target dns:0.0.0.0:3000
D 2024-10-19T18:32:06.870Z | v1.12.2 90944 | server | (1) Attempting to bind 0.0.0.0:3000
D 2024-10-19T18:32:06.871Z | v1.12.2 90944 | server | (1) Successfully bound 0.0.0.0:3000
[Nest] 90944  - 10/19/2024, 12:32:06 PM     LOG [NestMicroservice] Nest microservice successfully started +84ms
>>> Error in Http2Server Error [ERR_HTTP2_SOCKET_UNBOUND]: The socket has been disconnected from the Http2Session
    at Object.get (node:http2:92:19)
    at Http2Server.<anonymous> (file:///Users/leonardo/Development/projects/deno-poc-nestjs/node_modules/.deno/@[email protected]/node_modules/@grpc/grpc-js/build/src/server.js:1154:148)
    at Http2Server.emit (ext:deno_node/_events.mjs:393:28)
    at Http2Server.<anonymous> (node:http2:1214:14)
    at Http2Server.emit (ext:deno_node/_events.mjs:393:28)
    at TCP._onconnection (node:net:1127:8)
    at TCP.#accept (ext:deno_node/internal_binding/tcp_wrap.ts:356:12)
    at eventLoopTick (ext:core/01_core.js:175:7) {
  code: "ERR_HTTP2_SOCKET_UNBOUND",
  name: "Error"
}

Regards

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctly node compat
Projects
None yet
Development

No branches or pull requests

3 participants