Description
Describe the bug
When attempting to emit any data (tuple/list/dict/just one value/etc) containing math.nan
or math.inf
from Python, instead of being translated to their Javascript equivalents NaN
and Infinity
, the thread simply crashes without any error, and the client attempts to reconnect and opens a new socket. This happens repeatedly until you stop trying to send those values.
To Reproduce
- Start Socket.IO with
socketio.AsyncServer(async_mode='tornado')
- Start Tornado
- Connect client
- Send any event with any of the above in it
Expected behavior
math.nan
should become NaN and math.inf
should become Infinity
, and the thread shouldn't crash.
Server Logs
emitting event "ver" to vsc2o8XnBIjCQ-ffAAAB [/]
Connected to 127.0.0.1
emitting event "test" to all [/]
SENT
emitting event "ver" to B27r1WYIu-RJmJZ7AAAD [/]
Connected to 127.0.0.1
emitting event "test" to all [/]
SENT
emitting event "ver" to yXFrxHwK0uEOarWYAAAF [/]
Connected to 127.0.0.1
emitting event "test" to all [/]
It just disconnects with no errors logged on client or server. Event 'ver' is sent on connect (contains a version string), this sends to the client just fine. Event 'test' just sends math.inf
a few seconds after connection as a test. The connection drops as soon as 'test' is sent, and it never reaches the client. Connection does NOT close if I send any other number, eg. 1.5
.
Additional context
Using python-socketio v5.12.1, tornado v6.4.2, and socket.io client v4.8.1