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

Async client ignores ctrl-c after connect fails #197

Closed
JoriDubrovin opened this issue Sep 14, 2020 · 1 comment
Closed

Async client ignores ctrl-c after connect fails #197

JoriDubrovin opened this issue Sep 14, 2020 · 1 comment
Assignees
Labels

Comments

@JoriDubrovin
Copy link

My code tries to connect with socketio.AsyncClient, and if that fails, sleeps a few seconds before trying again. With python-engineio 3.13.2, if the user presses ctrl-c during the sleep, the program does not stop but just prints ^C.

Like #196, this seems to be related to the call to add_signal_handler.

This is my script.py:

import asyncio
import socketio

async def try_connect():
    sio = socketio.AsyncClient()
    try:
        await sio.connect(url='file:///')
    except Exception as e:
        print(e)
    await asyncio.sleep(4)

asyncio.get_event_loop().run_until_complete(try_connect())

To reproduce with Python 3.7.3 on Debian buster:

> python3 -m venv no-ctrl-c
> source no-ctrl-c/bin/activate
> pip install python-engineio==3.13.2 python-socketio==4.6.0 aiohttp==3.6.2
> python script.py
Connection refused by the server
^C^C^C^C^C

If I replace python-engineio==3.13.2 with the previous version 3.13.1, then ctrl-c stops the program with a KeyboardInterrupt, as expected.

@miguelgrinberg miguelgrinberg self-assigned this Sep 14, 2020
@miguelgrinberg
Copy link
Owner

Thanks. I have it in my list to review the signal handling changes so I'll have an update on this soon.

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