|Anonymous | Login | Signup for a new account||2014-03-07 10:02 CET|
|Main | My View | View Issues | Change Log | Roadmap|
|View Issue Details|
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0004666||OCaml||OCaml general||public||2008-12-06 21:17||2009-04-19 11:02|
|Target Version||Fixed in Version||3.11.1+dev|
|Summary||0004666: Execv unix calls fail with threaded program on Mac OS X.|
|Description||Prior to bug fix for PR#457, threaded programs could overcome the following limitation of mac os x execve (execv failing with EOPNOTSUPP when a process as multiple active threads):|
by forking first, see example below.
I do not know if there is a right thing to do though.
(* fork_exec.ml *)
(* Compiled with:
ocamlbuild -tag use_unix -cflags "-I +vmthreads" -lflags "-I +vmthreads" -libs unix,threads fork_exec.byte
works on mac os x, but with the following, it will fails in execvp with EOPNOTSUPP in 3.11:
ocamlbuild -tag use_unix -cflags "-I +threads" -lflags "-I +threads" -libs unix,threads fork_exec.byte
Used to work in 3.10.2.
let () =
let t = Thread.create (fun () -> ()) () in
(fun () ->
match Unix.fork () with
| 0 -> Unix.execvp "ls" [| "ls"; "-l" |];
| pid -> ()
Gregoire Henri said:
> PR#4577: reinitialize thread machinery after fork
> http://caml.inria.fr/mantis/view.php?id=4577 [^]
> The trick of systematically calling fork before exec in a threaded
> program does not work anymore, because the ocaml Unix.fork restart a
> thread after forking.
|Tags||No tags attached.|
That's a nasty bug in MacOS X. One possible fix would be to create the 'tick' thread on demand, i.e. the first time a thread is created after the initial launch of the program or after a fork (in the child process). I'll look into this.
Tentative fix (on-demand creation of tick thread) in 3.11 release branch, to be included in 3.11.1 if it works.
|The same problem was reported under FreeBSD. The fix in the release branch appears to fix it.|
From: Mike Spivey
I wanted to add a note in Mantis (but couldn't see how to do it) to say
that I had encountered the problem described in 0004666 in a program that
contains OCaml + LablGTK + GTK+OSX + threads + sockets. The fix that is
in the 3.11 release branch on CVS solved the problem for me.
-- Mike Spivey
|Based on feedback so far, the fix appears to work. I'm closing this PR.|
|2008-12-06 21:17||gguyomarch||New Issue|
|2008-12-12 09:52||xleroy||Note Added: 0004795|
|2008-12-12 09:52||xleroy||Assigned To||=> xleroy|
|2008-12-12 09:52||xleroy||Status||new => acknowledged|
|2008-12-14 19:17||xleroy||Note Added: 0004798|
|2008-12-14 19:17||xleroy||Status||acknowledged => resolved|
|2008-12-14 19:17||xleroy||Resolution||open => fixed|
|2008-12-19 09:43||xleroy||Note Added: 0004806|
|2009-01-24 19:41||doligez||Note Added: 0004821|
|2009-01-26 18:15||xleroy||Note Added: 0004824|
|2009-01-26 18:15||xleroy||Status||resolved => closed|
|2009-03-28 17:48||xleroy||Relationship added||related to 0004725|
|2009-04-19 11:02||xleroy||Fixed in Version||=> 3.11.1+dev|
|Copyright © 2000 - 2011 MantisBT Group|