Issue1773955

classification
Title: TCP urgent data causes select() to lie
Type: Severity: normal
Components: Core Versions:
Milestone:
process
Status: closed Resolution: invalid
Dependencies: Superseder:
Assigned To: Nosy List: cgroves, paulj_edgewater
Priority: normal Keywords:

Created on 2007-08-14.15:44:04 by paulj_edgewater, last changed 2007-08-20.06:37:54 by cgroves.

Files
File name Uploaded Description Edit Remove
test.py paulj_edgewater, 2007-08-14.15:44:04 Illustrates urgent data problem with select()
Messages
msg1838 (view) Author: paulj (paulj_edgewater) Date: 2007-08-14.15:44:04
I have a script that uses telnetlib to connect to a Linux host, login, run a program and then eventually send control-C to exit the remote program. I wrote this in CPython but when I tried it using Jython I noticed that the telnet connection blocked (in method read_very_eager) shortly after the control-C was issued.

Closer inspection indicated that after the control-C the select() method always reported that data was ready even when the telnet connection had apparently read all the data.

Using Wireshark I determined that the Linux machine responds to the control-C in part by sending an 0xFF byte and an 0xF2 byte. I noticed that the 0xF2 byte was received by the Jython script just before blocking and that the 0xFF byte was not received.

I noticed that the 0xFF byte was sent with the URG flag set.

Sun's Java documentation says that the default behavior is to silently discard urgent data unless setOOBInline(true) is called in which case urgent data is merged into the regular data stream.

I tried setting the OOB inline flag and I got the 0xFF byte in the regular data stream and the problem did not occur.

Perhaps there is a bug in the Java socket implementation in which unreceived urgent data counts as ready data even though it cannot be received?

I'm attaching a script that illustrates the problem.

I did my testing with 2.2RC3
msg1839 (view) Author: paulj (paulj_edgewater) Date: 2007-08-14.23:19:01

The problem is caused by a Java bug in the windows implementation:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213702
msg1840 (view) Author: paulj (paulj_edgewater) Date: 2007-08-15.16:16:23

The problem is caused by a Java bug in the windows implementation:

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6213702
msg1841 (view) Author: Charlie Groves (cgroves) Date: 2007-08-20.06:37:54
So this is a bug in java on Windows?  Not much we can do about that....
History
Date User Action Args
2007-08-14 15:44:04paulj_edgewatercreate