Mantis Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0004844OCamlOCaml generalpublic2009-08-07 12:512012-03-24 15:01
ReporterChristoph Bauer 
Assigned Togildor 
PrioritynormalSeverityminorReproducibilityalways
StatusclosedResolutionfixed 
PlatformOSOS Version
Product Version3.11.0 
Target VersionFixed in Version3.12.0+dev 
Summary0004844: Unix.select bug (triggered if linked against threads)
DescriptionThe attached program fails, if compiled with
     ocamlopt -thread -o selectbug.exe unix.cmxa threads.cmxa selectbug.ml
and runs, if compiled with
     ocamlopt -thread -o selectbug.exe unix.cmxa selectbug.ml

If you run it, please type some input, because it makes a Unix.select on stdin.
Additional InformationThere was a discussion on the mailing (8-July-2009) list about the problem.
TagsNo tags attached.
Attached Files? file icon selectbug.ml [^] (522 bytes) 2009-08-07 12:51 [Show Content]
c file icon select.c [^] (29,650 bytes) 2009-08-10 10:18 [Show Content]

- Relationships

-  Notes
(0005041)
gildor (developer)
2009-08-07 13:28

Discussion is here
http://groups.google.com/group/fa.caml/browse_thread/thread/c634c736765897ee# [^]

Possible problem/solution:

I use "lpOrig = (void *)fd;" where fd is an OCaml value (in select.c). Without thread and during the enter/leave_blocking_section(), there is less chance to trigger the GC and to modify "fd" value. This is the reason why it seems correct without thread and fall into a bug with thread.

The obvious solution is to replace "lpOrig = (void *)fd" by a non-OCaml value (e.g. EMode + nth in ocaml list).
(0005042)
Christoph Bauer (reporter)
2009-08-10 10:17

The hinted solution seems to work. I'll attach a modified version of otherlibs/win32unix/select.c,
which solved the problems in selectbug.ml and my original program. But beware, I haven't it tested very well.
(0005219)
Christoph Bauer (reporter)
2010-01-07 10:16

I use this patch (select.c) every day - and it works. So now I could say, it's well tested.
(0005506)
gildor (developer)
2010-05-25 15:21

Apply patch by C. Bauer, replace lpOrig by lpOrigIdx which can survive a GC collection

- Issue History
Date Modified Username Field Change
2009-08-07 12:51 Christoph Bauer New Issue
2009-08-07 12:51 Christoph Bauer File Added: selectbug.ml
2009-08-07 13:28 gildor Note Added: 0005041
2009-08-10 10:17 Christoph Bauer Note Added: 0005042
2009-08-10 10:18 Christoph Bauer File Added: select.c
2010-01-07 10:16 Christoph Bauer Note Added: 0005219
2010-01-07 15:17 doligez Status new => acknowledged
2010-04-18 20:35 xleroy Status acknowledged => assigned
2010-04-18 20:35 xleroy Assigned To => gildor
2010-05-20 10:47 gildor Status assigned => confirmed
2010-05-25 15:21 gildor Note Added: 0005506
2010-05-25 15:21 gildor Status confirmed => resolved
2010-05-25 15:21 gildor Fixed in Version => 3.12.0+dev
2010-05-25 15:21 gildor Resolution open => fixed
2012-03-24 15:01 xleroy Status resolved => closed


Copyright © 2000 - 2011 MantisBT Group
Powered by Mantis Bugtracker