Issue2618
Created on 2017-08-25.02:59:17 by behackett, last changed 2021-08-24.16:16:26 by r_walter.
File name |
Uploaded |
Description |
Edit |
Remove |
sendallrepro.py
|
behackett,
2017-08-25.02:59:17
|
|
|
|
msg11546 (view) |
Author: Bernie Hackett (behackett) |
Date: 2017-08-25.02:59:17 |
|
This is a regression from Jython 2.7.0. socket.sendall is just an alias for socket.send. In 2.7.0 this doesn't appear to cause any problems as sendall seems to consistently send all the bytes given to it. This is no longer the case in 2.7.1. The regression seems to be caused by the changes for http://bugs.jython.org/issue2508.
This is a serious regression that will break any library using socket.sendall. socket.sendall in CPython only returns None or raises if there is an error. It blocks until all data is sent.
Repro script attached.
|
msg12144 (view) |
Author: Kay Kasemir (kasemir) |
Date: 2018-10-19.17:13:50 |
|
urllib2.py is affected by this regression.
Data sent with an HTTP 'POST' request is truncated because send == sendall only sends partial data.
|
msg13160 (view) |
Author: Roland Walter (r_walter) |
Date: 2021-08-24.16:16:26 |
|
Try this to replace sendall in _socket.py. This worked for me and https://bugs.jython.org/issue2894
# Fix for 64k not working https://github.com/gbach/jython/commit/759c042bbf3d38a761430d3a671e2cdf4a1bf61f
def sendall(self, data, flags=0):
chunk_size = 8192
length = len(data)
data_view = memoryview(data)
idx = 0
while idx < length:
bytes_sent = self.send(data_view[idx:idx + chunk_size], flags=flags)
idx += bytes_sent
|
|
Date |
User |
Action |
Args |
2021-08-24 16:16:26 | r_walter | set | nosy:
+ r_walter messages:
+ msg13160 |
2020-03-02 08:13:43 | jeff.allen | set | milestone: Jython 2.7.3 |
2018-10-19 17:13:51 | kasemir | set | messages:
+ msg12144 |
2018-10-19 17:09:24 | kasemir | set | nosy:
+ kasemir |
2017-08-25 16:37:33 | amak | set | nosy:
+ amak |
2017-08-25 02:59:39 | behackett | set | type: behaviour |
2017-08-25 02:59:18 | behackett | create | |
|