nats.py icon indicating copy to clipboard operation
nats.py copied to clipboard

ping/pong is not working

Open ovnicraft opened this issue 1 year ago • 1 comments

Observed behavior

After connection stablished, if connection goes stale ping/pong is not being executed.

after my debug i found:

_process_connect_init() is defining ping_interval_task and it process error for stale connections but task it self is never being called. (at least I could not find it.)

EXTRA: this issue could be related.

Expected behavior

stale connection being processed allowing developer catch it. logs here

Server and client version

nats 2.10 (alpine image).

Host environment

macos m1

Steps to reproduce

  1. start nats server
  2. connect to server
  3. wait 10s
  4. stop server
  5. you can wait on client and is not ping/poing ing.

ovnicraft avatar Dec 26 '23 17:12 ovnicraft

Thanks for raising the issue, the ping interval is working which you can confirm reducing the ping interval to be lower for example:

    nc = await nats.connect("nats://127.0.0.1:4222",
                            error_cb=_error_cb,
                            ping_interval=2,

I did confirm that the error callback is not reporting the type of disconnection so will fix that.

wallyqs avatar Dec 26 '23 19:12 wallyqs