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

Event Loop neither Terminates nor reconnects when connection breaks #1556

Open
blafasel42 opened this issue May 1, 2022 · 1 comment
Open
Labels

Comments

@blafasel42
Copy link

blafasel42 commented May 1, 2022

Hi,
I am starting using Autobahn-Python.
maybe this is a noob-problem. I did the following (based on the example code):

  1. started a router
  2. started a callee process offering some rpcs
  3. started a caller, called the rpcs

all works fine.

problem:
if the connection to the router goes down, the callee side shows a warning "WAMP transport was lost before closing"
Then it does not terminate and also does not attempt to reconnect

I tried with both: asyncio and twisted implementations because someone said that twisted would reconnect. But also there: Error is detected and logged, but event-loop does not terminate and als no re-connect. This questions my whole concept (one weekend of work).

What does help terminating the loop is:

    async def onDisconnect(self):
        loop = asyncio.get_running_loop()
        loop.stop()

is this the way to go?

There still is a problem when initial connection to WAMP Router works but registration does not (because router is currently coming up for example). In that case, the callee system hangs forever. Is there a solution for that?

@blafasel42 blafasel42 changed the title Event Loop Does not Terminate not reconnect when connection breaks Event Loop neither Terminates nor reconnects when connection breaks May 1, 2022
@oberstet
Copy link
Contributor

oberstet commented May 2, 2022

yes, the ApplicationRunner for Twisted has auto_reconnect, eg
https://github.com/crossbario/autobahn-python/blob/master/examples/twisted/wamp/basic/client_using_apprunner.py

for a robust client, using above, auto-reconnect is managed by the ApplicationRunner. you can also handle that for yourself when using eg the WebSocket-WAMP classes directly.

one more note: you will most likely want to activate client-side initiated websocket ping/pong ("heartbeating") - in addition to also have router-side initiated hearbeating. you need both for fast detection of lost TCP connections in a WAN (such as the Internet)

@oberstet oberstet added the wamp label May 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants