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

When homeserver restarts, bot disconnects completely #12

Open
ser opened this issue Jun 4, 2018 · 3 comments
Open

When homeserver restarts, bot disconnects completely #12

ser opened this issue Jun 4, 2018 · 3 comments
Assignees
Labels

Comments

@ser
Copy link

ser commented Jun 4, 2018

When homeserver restarts, bot disconnects with exception

requests.exceptions.ConnectionError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

and does not try to reconnect again, which is extremely annoying as requires restart of the bot

@lordievader
Copy link
Contributor

This also happens when the bot looses connection with the homeserver. It leaves the bot in some kind of a zombie state. I have my bot in a systemd service and it doesn't get restarted since systemd thinks it is still running fine.

@shawnanastasio shawnanastasio self-assigned this Jan 22, 2019
@shawnanastasio
Copy link
Owner

I can't see anywhere where I'm ignoring exceptions, so the issue must be in matrix-python-sdk. I'll do some more digging to see if there's a way to get the error to propagate properly.

@lordievader
Copy link
Contributor

I must say with the latest version, were you get a reference to the thread the bot is in, the main program does notice the thread dying in the event of a connection abort.

Perhaps lines 75 through 80 of "example_bot.py" should be replaced with:

    # Start polling
    while True:
        thread = bot.start_polling()
        thread.join()
        logging.warning(
            'thread died, waiting five seconds before connecting again...')
        time.sleep(5)

This piece of code assumes the thread died because of a connection error. However, this might not always be the case. I've implemented it this way because I don't know how to pull the actual exception from the thread reference.

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

3 participants