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

Ping-related error: "session has been destroyed" #1143

Closed
mpataki opened this issue Jul 11, 2024 · 6 comments
Closed

Ping-related error: "session has been destroyed" #1143

mpataki opened this issue Jul 11, 2024 · 6 comments
Labels
bug Something isn't working

Comments

@mpataki
Copy link

mpataki commented Jul 11, 2024

Describe the bug

The following error can be thrown when using pings on a grpc transport when the connection is closed:

Unhandled Error: The session has been destroyed
    at new NodeError (node:internal/errors:406:5)
    at ClientHttp2Session.ping (node:internal/http2/core:1377:13)
    at commonPing (/Users/mat/code/syncdna/standalone-app/node_modules/@connectrpc/connect-node/dist/esm/http2-session-manager.js:429:14)
    at Timeout.onPingInterval [as _onTimeout] (/Users/mat/code/syncdna/standalone-app/node_modules/@connectrpc/connect-node/dist/esm/http2-sessi
on-manager.js:422:9)
    at listOnTimeout (node:internal/timers:573:17)
    at processTimers (node:internal/timers:514:7)

To Reproduce

Setup a grpc transport and use it for long lived streaming.

  myTransport = createGrpcTransport({
    baseUrl: myGrpcBaseUrl,
    httpVersion: '2',
    pingIdleConnection: true,
    pingIntervalMs: 5000,
    pingTimeoutMs: 5000,
  });

Environment:

  • @connectrpc/connect version: 1.4.0
  • @connectrpc/connect-node version: 1.4.0
  • Node.js version: 20.12.2

Additional context

Speculation:
If a stream cancellation happens, it looks like some race condition can result in the ping task executing against a closed http/2 session, causing the error. Just before the error I often see messages like:

> [MY-RPC-METHOD] [canceled] http/2 stream closed with error code CANCEL (0x8)
@mpataki mpataki added the bug Something isn't working label Jul 11, 2024
@srikrsna-buf
Copy link
Member

Looks like one way to avoid this is to just check for the destroyed flag.

@mpataki
Copy link
Author

mpataki commented Jul 22, 2024

@srikrsna-buf I presume your comment is a note on how to fix this issue internally to the connect-es library. Yeah?

@mpataki
Copy link
Author

mpataki commented Aug 30, 2024

@srikrsna-buf following up here

@srikrsna-buf
Copy link
Member

Hey! I can't seem to reproduce this error. How often are you seeing this? Can you share a runnable code that can reproduce the error?

@mpataki
Copy link
Author

mpataki commented Sep 17, 2024

Thanks for looking at this again.
At present I don't have the time, unfortunately just too much going on in my world right now. But I'll get back to this in time and get sometime to you.

@timostamm
Copy link
Member

Closing, but please feel free to re-open with a reproducible example.

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

No branches or pull requests

3 participants