Issue2102

classification
Title: socket.recv() blocks send()
Type: behaviour Severity: major
Components: Core Versions: Jython 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: calmh, santa4nt, zyasoft
Priority: Keywords:

Created on 2013-10-30.20:05:29 by calmh, last changed 2014-05-10.05:25:01 by zyasoft.

Files
File name Uploaded Description Edit Remove
echo-test.py calmh, 2013-10-30.20:09:09
Messages
msg8166 (view) Author: Jakob Borg (calmh) Date: 2013-10-30.20:09:09
See echo-test.py. It connects to the local echo server (assuming it exists; it's supposed to simply echo all data) and starts two threads. One writes ~100 hellos per second, the other reads them as fast as possible and prints. When run with python this has the expected behavior:

jb@udev:~$ python echo-test.py 
hello
hello
hello
hello
hello
hello
...etc

With jython:

jb@udev:~$ jython echo-test.py 
hello
read timeout
hello
read timeout
hello
read timeout
...etc

The behavior seems to be that recv() blocks sendall(). When recv() times out, one sendall() completes and the next read reads the line, followed by another timeout.

Jython 2.5.1+ (Release_2_5_1, Oct 31 2011, 11:44:27) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
msg8167 (view) Author: Jakob Borg (calmh) Date: 2013-10-30.20:11:56
send() / sendall() show same behavior
msg8168 (view) Author: Jakob Borg (calmh) Date: 2013-10-30.20:41:46
Note: this is on Linux (Ubuntu 12.04 amd64). On Mac OS X (10.9), the Jython behavior matches CPython.
msg8170 (view) Author: Jakob Borg (calmh) Date: 2013-10-31.08:14:38
Also on Jython 2.5.4rc1 (2.5:723492dbab02, Feb 8 2013, 10:13:55) 
[OpenJDK 64-Bit Server VM (Sun Microsystems Inc.)] on java1.6.0_27
msg8323 (view) Author: Jim Baker (zyasoft) Date: 2014-05-04.19:59:43
Should be fixed in jython-socket-reboot branch, which will be merged into Jython trunk as part of beta 3

socket-reboot uses Netty 4 as its foundation; the underlying handlers do not having blocking between send/recv
msg8361 (view) Author: Jim Baker (zyasoft) Date: 2014-05-10.05:25:01
Now fixed in 2.7 trunk
History
Date User Action Args
2014-05-10 05:25:01zyasoftsetstatus: open -> closed
messages: + msg8361
versions: + Jython 2.7, - Jython 2.5
2014-05-04 19:59:43zyasoftsetresolution: fixed
messages: + msg8323
nosy: + zyasoft
2013-11-01 21:38:08santa4ntsetnosy: + santa4nt
2013-10-31 08:14:39calmhsetmessages: + msg8170
2013-10-30 20:41:46calmhsetmessages: + msg8168
2013-10-30 20:11:56calmhsetmessages: + msg8167
title: socket.recv() blocks sendall() -> socket.recv() blocks send()
2013-10-30 20:10:53calmhsettitle: socket.recv() blocks send() -> socket.recv() blocks sendall()
2013-10-30 20:09:10calmhsetfiles: + echo-test.py
messages: + msg8166
2013-10-30 20:05:29calmhcreate