cirospaciari / socketify.py

Bringing Http/Https and WebSockets High Performance servers for PyPy3 and Python3
https://www.socketify.dev
MIT License
1.44k stars 56 forks source link

Segfault on high-load HTTP pipelining test #114

Closed remittor closed 1 year ago

remittor commented 1 year ago

Describe the bug Segfault

To Reproduce Server: simple "Hello World!" test. Client: python3 pl_test.py File pl_test.py: https://gist.github.com/remittor/f2c89f50ff259e6e704fe246ee6c3dd5

Server output:

> python3 si_test.py -g si -v 8
2023-03-14 09:30:26,851 [DEBUG] Using selector: EpollSelector
Listening on port http://localhost:5000 now

Segmentation fault

Client output:

Run test 2 ...
totalsent = 13654894, totalrecv = 266240
LastResp: b'/1.1 200 OK\r\nContent-Type: text/plain\r\nDate: Tue, 14 Mar 2023 10:22:26 GMT\r\nServer: uWebSockets_20\r\nTransfer-Encoding: chunked\r\n\r\nc\r\nhello world!\r\n0\r\n\r\nHTTP/1.1 200 OK\r\nContent-Type: text/plain\r\nDate: Tue, 14 Mar 2023 10:22:26 GMT\r\nServer: uWebSockets_20\r\n'
Traceback (most recent call last):
  File "/home/user/wsgi/pl_test.py", line 69, in <module>
    rc = sock.send(payload_huge[totalsent:])
ConnectionResetError: [Errno 104] Connection reset by peer

Desktop (please complete the following information):

cirospaciari commented 1 year ago

Thanks for reporting I will take a look!

cirospaciari commented 1 year ago

Seems to be a bug with chunked encoding I will publish an 0.0.19 soon with uWS updates https://github.com/uNetworking/uWebSockets/commit/8410f7ee6b5ac6acc9fd28c2abdcd728648c18de

cirospaciari commented 1 year ago

fixed in https://github.com/cirospaciari/uWebSockets/commit/216c8b9ea20ec8719175b136cf86cb51b316382d Will be present in new binaries before 0.0.19