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

TypeError in InstrumentedAsyncServer for missing argument 'reason' #1425

Closed
AlexLardschneider opened this issue Dec 23, 2024 · 1 comment
Closed

Comments

@AlexLardschneider
Copy link

Describe the bug
When enabling instrumentation / admin mode, on client disconnect, I can see the following stack trace coming from python-socketio after ugprading to version 5.12.0.

disconnect async handler error
Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/engineio/async_server.py", line 509, in run_async_handler
    return await self.handlers[event](*args)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: InstrumentedAsyncServer._handle_eio_disconnect() takes 2 positional arguments but 3 were given

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.11/site-packages/engineio/async_server.py", line 515, in run_async_handler
    return await self.handlers[event](args[0])
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/socketio/async_admin.py", line 297, in _handle_eio_disconnect
    return await self.sio._handle_eio_disconnect(eio_sid)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: AsyncServer._handle_eio_disconnect() missing 1 required positional argument: 'reason'

I believe that this is related to the changes introduced in #1422, since earlier versions do not have this issue.

Also, disabling instrumentation does seem to resolve this issue.

To Reproduce
Upgrade python-socketio to version 5.12.0, and enable instrumentation:

SOCKETIO.instrument(auth={
    'username': "admin",
    'password': "admin",
})

Expected behavior
The reason parameter should be passed to AsyncServer even if instrumentation is enabled and InstrumentedAsyncServer is used.

Logs
See stack trace above.

Additional context
Used together with AioHTTP web server.

@miguelgrinberg
Copy link
Owner

Duplicate of #1423

@miguelgrinberg miguelgrinberg marked this as a duplicate of #1423 Dec 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants