Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2011-08-19
22:22 • Ticket [1774689fff] async-4.3 sometimes fails status still Closed with 4 oth... artifact: ad3daa0c48 user: ferrieux
21:36 • Ticket [1774689fff]: 4 changes artifact: 29fba542a3 user: dgp
21:24 • Closed ticket [1774689fff]. artifact: 3ca5b78a93 user: ferrieux
21:24 • Ticket [1774689fff]: 4 changes artifact: eddac10732 user: ferrieux
21:09 • Open ticket [1774689fff]. artifact: bbd417e6e5 user: ferrieux
06:04 • Closed ticket [1774689fff]. artifact: 6840ed53d2 user: ferrieux
2009-10-18
14:44 • Ticket [1774689fff]: 4 changes artifact: d3a9acb95a user: mistachkin
14:11 • Ticket [1774689fff]: 4 changes artifact: 4127634ad3 user: mistachkin
12:25 • Ticket [1774689fff]: 4 changes artifact: 4696e57055 user: mistachkin
2009-10-03
00:58 • Ticket [1774689fff]: 4 changes artifact: 744bd8ac07 user: mistachkin
2008-12-22
18:38 • Ticket [1774689fff]: 1 change artifact: f99145ed7d user: dkf
2008-08-08
23:41 • Ticket [1774689fff]: 5 changes artifact: f01c02c164 user: dgp
23:38 • Ticket [1774689fff]: 4 changes artifact: 8942ae1de6 user: dgp
23:33 • Ticket [1774689fff]: 5 changes artifact: d1b9a32619 user: dgp
2008-03-01
00:43 • Ticket [1774689fff]: 4 changes artifact: 40c01e6825 user: dgp
2007-08-22
04:21 • Ticket [1774689fff]: 5 changes artifact: 1e85947b90 user: dgp
04:17 • Ticket [1774689fff]: 2 changes artifact: 3e56cb6bbc user: dkf
2007-08-15
13:27 • New ticket [1774689fff]. artifact: 6e4b9876f2 user: dgp

async-4.3 sometimes fails

Closed / Fixed1774689fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 15 years ago
Descriptionplain2007-08-15 13:27:28
Need thread-enabled Tcl to demo this.
On FC 6 with the Tcl HEAD, about every
other run:

$ make test TESTFLAGS="-file async.test"
...
async.test


==== async-4.3 async interrupting loop-less bytecode sequence FAILED
==== Contents of test case:

    hang3 $hm

---- Result was:
Async event not delivered
---- Result should have been (exact matching):
test pattern
==== async-4.3 FAILED
dkf Ticket [1774689fff]: 2 changes [History diff]2007-08-22 04:17:49
dgpplain2007-08-22 04:21:05
Logged In: YES 
user_id=80530
Originator: YES


Async Events has no maintainer ?!
dgpplain2008-03-01 00:43:46
Logged In: YES 
user_id=80530
Originator: YES


Just saw this again.
dgpplain2008-08-08 23:33:21
Logged In: YES 
user_id=80530
Originator: YES


Testing 8.5.4, I now see this
test *crashing* !! on thread-enabled Tcl.
dgpplain2008-08-08 23:38:59
Logged In: YES 
user_id=80530
Originator: YES


Grrr... doesn't crash every time.
Sometimes merely fails.
Sometimes passes.
dgpplain2008-08-08 23:41:18
Logged In: YES 
user_id=80530
Originator: YES


Back to prio-7 since it's not
repeatable.
dkf Ticket [1774689fff]: 1 change [History diff]2008-12-22 18:38:34
mistachkinplain2009-10-03 00:58:15
This may be caused by a subtle (and rare) race condition in the test itself.
mistachkinplain2009-10-18 12:25:05
To see this test fail reliably, simply change the line in proc hang3
from: [string repeat {;incr i;} 1500000] to: [string repeat {;incr i;} 150]

The test itself assumes that the constructed script will be pending long enough for the async event to be delivered.  This is not correct.
mistachkinplain2009-10-18 14:11:25
Changing the integer constant to 150 causes a segfault on my system.
mistachkinplain2009-10-18 14:44:04
There are actually two distinct bugs here.  The test failure and the segfault.  Further research reveals that the "testasync marklater" sub-command creates and uses a child thread and shares data without using thread-safe mechanisms.  This change was introduced in 2003 (revision 1.73).  The bug appears to exist only in 8.5 and HEAD.  Previously, the code assumed that only one thread was accessing the data stored in firstHandler.
ferrieuxplain2011-08-19 06:04:43
No need to keep two threads. Marking this one as Dup of 2981154.
ferrieuxplain2011-08-19 21:09:06
Reopening: segfault fixed in 2981154; failure remains.

Again, this failure is a mundane one: it simply indicates that the finite stretch of bytecodes that we meant to interrupt somehow managed to outpace a thread with a Tcl_Sleep(1). Maybe we should just pour an [after 1] in the stretch of [incr].
ferrieuxplain2011-08-19 21:24:12
Fixed in HEAD, by adding an [after 10] to the sequence to interrupt.
ferrieux Closed ticket [1774689fff]. [History diff]2011-08-19 21:24:13
dgpplain2011-08-19 21:36:08
Can the fix be applied to 8.5.11 as well?
ferrieuxplain2011-08-19 22:22:25
Backported.
Log in (anonymous is fine) to add a comment.