Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

threads and toplevels #2984

Closed
vicuna opened this issue Oct 7, 2001 · 5 comments
Closed

threads and toplevels #2984

vicuna opened this issue Oct 7, 2001 · 5 comments
Labels

Comments

@vicuna
Copy link

vicuna commented Oct 7, 2001

Original bug ID: 560
Reporter: administrator
Status: closed
Resolution: not a bug
Priority: normal
Severity: minor
Category: ~DO NOT USE (was: OCaml general)

Bug description

Hello,

it seems that combinations of threads + the unix library + toplevels
can cause problems, e.g.:

ocamlmktop -thread -custom unix.cma threads.cma -o mytop

file: mydf.ml

let _ =
let ic = Unix.open_process_in "/bin/df" in
ignore (input_line ic)

This will block:

mytop mydf.ml

But when I build the toplevel without threads.cma:

ocamlmktop -thread -custom unix.cma -o mytop

then the program terminates. Things always work fine when I compile the
file to either byte- or native code with the same set of libraries.

I am using the most recent CVS-snapshot (07.10) of OCaml on a Linux-box.

Regards,
Markus

--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus

@vicuna
Copy link
Author

vicuna commented Oct 8, 2001

Comment author: administrator

it seems that combinations of threads + the unix library + toplevels
can cause problems, e.g.:

I'll look into this. One question, though: is this bytecode threads
or system (POSIX) threads?

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Oct 8, 2001

Comment author: administrator

On Mon, 08 Oct 2001, Xavier Leroy wrote:

it seems that combinations of threads + the unix library + toplevels
can cause problems, e.g.:

I'll look into this. One question, though: is this bytecode threads
or system (POSIX) threads?

Ah, yes, I always keep leaving out the important bits: it's POSIX threads.

Regards,
Markus

--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus

@vicuna
Copy link
Author

vicuna commented Oct 12, 2001

Comment author: administrator

Hello,

it seems that combinations of threads + the unix library + toplevels
can cause problems

I looked into the problem and it seems to match a known problem with
some versions of LinuxThreads, namely that calling "exec" when several
threads are running hangs the program. (My involvment in LinuxThreads
is now so low that I don't even known when this bug appeared and when
/ whether it was fixed...)

There is something strange with your example, though:

ocamlmktop -thread -custom unix.cma threads.cma -o mytop

file: mydf.ml

let _ =
let ic = Unix.open_process_in "/bin/df" in
ignore (input_line ic)

This will block:

mytop mydf.ml

Here, one thread is created while "mytop" executes mydf.ml
(not by your code, obviously, and probably not from the OCaml runtime
either), so the "exec" in "open_process_in" hangs.

But when I build the toplevel without threads.cma:

ocamlmktop -thread -custom unix.cma -o mytop

then the program terminates. Things always work fine when I compile the
file to either byte- or native code with the same set of libraries.

With a stand-alone executable, no additional thread is created, hence
the "exec" completes normally.

This is rather mysterious to me, and to make things worse I can't
debug multithreaded programs with gdb (because of a Mandrake bug).
I'll try with an older Linux machine at some point.

  • Xavier Leroy

@vicuna
Copy link
Author

vicuna commented Oct 12, 2001

Comment author: administrator

On Fri, 12 Oct 2001, Xavier Leroy wrote:
[snip]

This is rather mysterious to me, and to make things worse I can't
debug multithreaded programs with gdb (because of a Mandrake bug).
I'll try with an older Linux machine at some point.

The problem is not critical to me, I just noticed it accidentially. So
I don't mind if you invest your time into more important things. Thanks
anyway for having a look at it and for the explanation!

Regards,
Markus

--
Markus Mottl markus@oefai.at
Austrian Research Institute
for Artificial Intelligence http://www.oefai.at/~markus

@vicuna
Copy link
Author

vicuna commented Oct 12, 2001

Comment author: administrator

Apparently a LinuxThreads bug.

@vicuna vicuna closed this as completed Oct 12, 2001
@vicuna vicuna added the bug label Mar 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant