| Anonymous | Login | Signup for a new account | 2013-05-27 04:54 CEST | ![]() |
| Main | My View | View Issues | Change Log | Roadmap |
| View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] | |||||||
| ID | Project | Category | View Status | Date Submitted | Last Update | |||
| 0005013 | OCaml | OCaml general | public | 2010-04-01 00:20 | 2011-05-29 12:19 | |||
| Reporter | omion | |||||||
| Assigned To | xleroy | |||||||
| Priority | normal | Severity | major | Reproducibility | random | |||
| Status | closed | Resolution | fixed | |||||
| Platform | OS | OS Version | ||||||
| Product Version | 3.11.1 | |||||||
| Target Version | Fixed in Version | 3.12.0+dev | ||||||
| Summary | 0005013: Condition.broadcast may not wake up all threads in native Windows build | |||||||
| Description | If two threads are waiting on a condition, Condition.broadcast should wake both of them up. However, if the first thread to be awoken waits on the same condition again it may be woken up again instead of the other thread. I marked reproducibility as random since it depends on threads, but it happens about 50% of the time. Linux and bytecode-Windows seem to be immune from this problem. | |||||||
| Additional Information | The attached code can display the problem. Each line of the output begins with the thread which is printing it. two threads "t1" and "t2" wait on condition "c". The main thread then broadcasts the condition, which SHOULD wake up both threads eventually. On Linux this program always outputs: 1: waiting first 2: waiting first 0: BROADCAST 2: going from broadcast; waiting second 1: going from broadcast; waiting second indicating that both threads woke up. On Windows the program may return: 1: waiting first 2: waiting first 0: BROADCAST 1: going from broadcast; waiting second 2: going from broadcast; waiting second which is also correct (the threads were woken up in the opposite order as on Linux, but that doesn't matter). However Windows may also return the following: 1: waiting first 2: waiting first 0: BROADCAST 2: going from broadcast; waiting second 2: going from broadcast a second time basically the broadcast woke up thread #2 TWICE, without waking up thread #1 at all. If this were a real program which was waiting on thread #1 to continue it would deadlock. | |||||||
| Tags | No tags attached. | |||||||
| Attached Files | ||||||||
Notes |
|
|
(0005283) omion (reporter) 2010-04-01 03:06 |
Actually, after further testing, it looks like it only occurs in 64-bit Windows compiles. My 32-bit compilation of the code seems to work properly... |
|
(0005394) xleroy (administrator) 2010-04-27 10:04 |
The Win32 implementation of condition variables was indeed incorrect w.r.t. Condition.broadcast. Reimplemented condition variables under Win32 in a way that should conform to POSIX semantics. Will go in 3.12.0. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2010-04-01 00:20 | omion | New Issue | |
| 2010-04-01 00:20 | omion | File Added: threadconditions.ml | |
| 2010-04-01 03:06 | omion | Note Added: 0005283 | |
| 2010-04-01 11:13 | xleroy | Assigned To | => xleroy |
| 2010-04-01 11:13 | xleroy | Status | new => acknowledged |
| 2010-04-27 10:04 | xleroy | Note Added: 0005394 | |
| 2010-04-27 10:04 | xleroy | Status | acknowledged => resolved |
| 2010-04-27 10:04 | xleroy | Resolution | open => fixed |
| 2010-04-27 10:04 | xleroy | Fixed in Version | => 3.12.0+dev |
| 2011-05-29 12:19 | xleroy | Status | resolved => closed |
| Copyright © 2000 - 2011 MantisBT Group |