| Anonymous | Login | Signup for a new account | 2013-05-18 17:58 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 | ||||||
| 0003236 | OCaml | OCaml general | public | 2004-10-25 22:06 | 2012-09-11 09:35 | ||||||
| Reporter | administrator | ||||||||||
| Assigned To | |||||||||||
| Priority | normal | Severity | minor | Reproducibility | always | ||||||
| Status | acknowledged | Resolution | open | ||||||||
| Platform | OS | OS Version | |||||||||
| Product Version | |||||||||||
| Target Version | 4.00.2+dev | Fixed in Version | |||||||||
| Summary | 0003236: Queue+Threads+Cygwin native causes crash | ||||||||||
| Description | Full_Name: Matthew W. Boyd Version: 3.08.1 OS: Windows/Cygwin Submission from: outbound.mlog.com (216.127.133.66) The following application will cause a core dump when compiled in the following way (Under Cygwin): ocamlopt -thread -o qthr unix.cmxa threads.cmxa qthr.ml (* ---------------------------------------- *) open Unix open Printf open Pervasives let q = Queue.create () let try_take () = try Queue.take q with Queue.Empty -> 0 let rec randomaction n = let () = match Random.int 2 with | 0 -> printf "Taking: %d\n" (try_take ()) | _ -> printf "Adding\n"; Queue.add n q in flush stdout; randomaction (n+1) let v = let a = Array.create 10 (Thread.self()) in for i = 0 to 9 do a.(i) <- Thread.create randomaction i done; a ;; let hent = Unix.gethostbyname "localhost" in for i = 0 to 9 do Thread.join v.(i) done ;; (* ---------------------------------------- *) I noticed this while I was attempting to use a shared queue with multiple threads. In this sample application, the program will not crash unless I call Unix.gethostbyname. I also noticed that if I call Unix.gethostbyname after unblocking Sys.sigint, the signal will be blocked again after the call to Unix.gethostbyname; however, if I unblock the signal after calling gethostbyname, it will remain unblocked. I also noticed that I can prevent the segmentation fault by wrapping any Queue function calls with Mutex locks. | ||||||||||
| Tags | No tags attached. | ||||||||||
| Attached Files | |||||||||||
Notes |
|
|
(0003092) administrator (administrator) 2005-02-02 16:56 |
Unlocked concurrent accesses to Queue are inherently unsafe. Still, can't reproduce crash under Linux. Can reproduce it under Cygwin with and without the gethostbyname. gdb gives no useful context. No can do. |
|
(0008054) doligez (manager) 2012-09-11 09:35 |
Just looking at the code of Queue.take, it's obvious that concurrent access to a queue can cause a crash. This should be documented. We also need to investigate the interference between Unix.gethostbyname and signals under Cygwin. |
Issue History |
|||
| Date Modified | Username | Field | Change |
| 2005-11-18 10:14 | administrator | New Issue | |
| 2012-07-11 17:32 | doligez | Target Version | => 4.01.0+dev |
| 2012-07-11 17:32 | doligez | Description Updated | View Revisions |
| 2012-07-31 13:37 | doligez | Target Version | 4.01.0+dev => 4.00.1+dev |
| 2012-09-11 09:35 | doligez | Note Added: 0008054 | |
| 2012-09-11 09:35 | doligez | Target Version | 4.00.1+dev => 4.00.2+dev |
| 2012-09-11 09:35 | doligez | Resolution | unable to reproduce => open |
| Copyright © 2000 - 2011 MantisBT Group |