PyWebIO icon indicating copy to clipboard operation
PyWebIO copied to clipboard

OverflowError: Python int too large to convert to C ssize_t

Open themixray opened this issue 3 years ago • 4 comments

ERROR:tornado.application:Uncaught exception GET /?app=index&session=NEW (164.0.0.1)
HTTPServerRequest(protocol='http', host='localhost:53945', method='GET', uri='/?app=index&session=NEW', version='HTTP/1.1', remote_ip='164.0.0.1')
Traceback (most recent call last):
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\web.py", line 1704, in _execute
    result = await result
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\pywebio\platform\tornado.py", line 108, in get
    await super().get()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 278, in get
    await self.ws_connection.accept_connection(self)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 879, in accept_connection
    await self._accept_connection(handler)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 962, in _accept_connection
    await self._receive_frame_loop()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 1116, in _receive_frame_loop
    await self._receive_frame()
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 1205, in _receive_frame
    handled_future = self._handle_message(opcode, data)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 1217, in _handle_message
    data = self._decompressor.decompress(data)
  File "C:\Users\User\AppData\Local\Programs\Python\Python37-32\lib\site-packages\tornado\websocket.py", line 799, in decompress
    data + b"\x00\x00\xff\xff", self._max_message_size
OverflowError: Python int too large to convert to C ssize_t

Environment Information

  • OS: Windows 10
  • Browser: Firefox
  • Python Version: Python 3.7.9
  • PyWebIO Version: 1.4.0

themixray avatar Oct 31 '21 17:10 themixray

Did you set max_payload_size to more than 4GB? It seems you are using 32 bit python, and the value of max_payload_size is larger than the ssize_t type storage range.

So, try to decrease the max_payload_size .

wang0618 avatar Nov 01 '21 05:11 wang0618

I got the same problem , and i didn't set max_payload_size(it was running on script mode)

muxueqz avatar Dec 07 '21 09:12 muxueqz

I got the same problem , and i didn't set max_payload_size(it was running on script mode)

@muxueqz Try to edit the line 465 of pywebio/platform/tornado.py file from your pywebio installtion dir, change the '4G' to a smaller size (like '1G') and see if the problem is resolved.

The pywebio installtion dir can be obtained with this code:

import pywebio
print(pywebio.__file__)

wang0618 avatar Dec 07 '21 10:12 wang0618

You're right, I set to '200M' then it's fix

muxueqz avatar Dec 08 '21 01:12 muxueqz