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

Keepalive bugfixes and unify timers strategies between client and server #2760

Merged

Commits on May 28, 2024

  1. Serverside keepalive error detection and cleanups

    - Bugfix: Ensure that if session.ping returns false we correctly identify fail the keepalive and connection
    - Bugfix: Ensure that if the interval between keepalives being sent occurs faster than the prior keepalive's timeout that we do not overwrite the reference to the prior timeout. Prior implementation could have in theory prevented a valid keepalive timeout from clearing itself. This rewrite keeps every timeout as a local (vs a shared state per session). Even if the timeout outlives the lifetime of a session, we still guard against errors by checking that the parent interval is not false-y. I reckon this could result in a short-term memory leak per session which is bounded for a maximum of keepaliveTimeoutMs. On the other hand even with that potential for a short reference hold, this implementation proposed here is more correct I think. One alternative we could do is keep a list of pending timeouts.. which is complex for a rare situation that will self resolve anyhow when keepaliveTimeoutMs is reached.
    - Bug Fix: keepalive intervals were being cleared with an incorrect clearTimeout before. Not sure if this was causing intervals leaks in some nodejs impls or not. (v20.13.1 seems to accept this mismatch without issue)
    - Rename variables for clarity, to prevent future bugs like swapping clearInterval vs clearTimeout.
    - Implementation is repeated in two places, per warning from grpc#2756 (comment)
    - This commit supercedes the prior PR on a master branch which was out of date. grpc#2756
    davidfiala committed May 28, 2024
    Configuration menu
    Copy the full SHA
    ad598ec View commit details
    Browse the repository at this point in the history
  2. remove comment

    davidfiala committed May 28, 2024
    Configuration menu
    Copy the full SHA
    334f0dc View commit details
    Browse the repository at this point in the history

Commits on May 29, 2024

  1. Configuration menu
    Copy the full SHA
    d799a7a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    577b4b4 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    7883164 View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    19cdc12 View commit details
    Browse the repository at this point in the history
  5. resolve hoisting

    davidfiala committed May 29, 2024
    Configuration menu
    Copy the full SHA
    bed5e85 View commit details
    Browse the repository at this point in the history
  6. hoist in second location

    davidfiala committed May 29, 2024
    Configuration menu
    Copy the full SHA
    d325b5f View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    a77d94f View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    c2da436 View commit details
    Browse the repository at this point in the history

Commits on Jun 6, 2024

  1. per discussion, avoid tracking keepalive disabled state and instead d…

    …epend on whether the session is destroyed
    davidfiala committed Jun 6, 2024
    Configuration menu
    Copy the full SHA
    3c5ab22 View commit details
    Browse the repository at this point in the history

Commits on Jun 7, 2024

  1. ensure that client keepalive timers are always cleared when they trig…

    …ger. this is a necessary change to fit with having removed keepaliveDisabled boolean. manually inspected test logs for both server.ts and transport.ts to verify both types of keepalives are operating correctly.
    davidfiala committed Jun 7, 2024
    Configuration menu
    Copy the full SHA
    98cd87f View commit details
    Browse the repository at this point in the history