Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2014-09-27
01:33 • Ticket [65533ec089] bug in socket.test socket_$af-2.11 {detecting new data} ... artifact: 48641548da user: anonymous
2014-06-23
13:58 • Ticket [65533ec089]: 4 changes artifact: 2bac346f47 user: jan.nijtmans
2014-06-07
02:38 • New ticket [65533ec089]. artifact: 815074603a user: anonymous

bug in socket.test socket_$af-2.11 {detecting new data}

Open65533ec089b4d315a773d638d816673e311b3f03Created 12 years agoUpdated 12 years ago
Descriptionplain2014-06-07 02:38:16
I noticed that the test socket_$af-2.11 in socket.test sometimes fails. The failure seems to be due to a race condition in the test itself.
The bug was introduced in commit 63da2a6cf068dfcd2906ebc7278bb7618f8a0eb3
(https://github.com/tcltk/tcl/commit/63da2a6cf068dfcd2906ebc7278bb7618f8a0eb3).

In this test, some text is written to a TCP socket, then this text is read, then another read attempt is made (which should return nothing), then more text is written, which is then read. To be sure that the written text is actually available for the read attempt, line 574 and 581 of socket.test ("after 500") before this commit caused Tcl to wait for 500 milliseconds. After the commit, this line was replaced by

after idle {set x 1}
vwait x

to make a pass through the event loop. However, this does not guarantee that the text written to the socket can actually be read. Hence, sometimes the first read returns nothing, and the test fails.
Until somebody comes up with a better way to speed up this test, I think we should revert to 500 millisecond delay to avoid having test failures.
jan.nijtmanswiki2014-06-23 13:58:29

The commit mentioned in the description is the GIT uuid for this commit. The corresponding fossil uuid is: [ebe9d97179b2fda01a0fc1709df8fc6e8eb2fb90]. Therefore assigning to Reinhard Max.

anonymousplain2014-09-27 01:33:30
I ran some more tests.
With the test script as is, the test fails sometimes.
After replacing "after idle {set x 1}" by "after $latency {set x 1}", I did not get any test failure (I ran the test 50,000 times).
Log in (anonymous is fine) to add a comment.