From: "David Baelde" <david.baelde@gmail.com>
To: Ocaml <caml-list@inria.fr>
Subject: Freezing
Date: Tue, 23 May 2006 02:04:50 +0200 [thread overview]
Message-ID: <53c655920605221704r5ff97fdfj1fa953f6f858a8b1@mail.gmail.com> (raw)
Hi list,
This could be a bug report but I have only a very bad description of
it, and it may also be nothing but an unfortunate feature...
I have a program streaming audio, and occasionally downloading files,
using ocaml-smbclient wrapped in ocaml-fetch. I want to avoid too long
(or frozen) downloads. To do so, here is essentially the code I use:
<<<
flush_all () ;
let pid = Unix.fork () in
if pid = 0 then begin
ignore (Unix.alarm 20) ;
Fetch.cp there here ;
exit 0
end else
Unix.waitpid [] pid
>>>
It's that simple (modulo the mess inside the Fetch.cp) and it works as
it should.. until some download process gets stuck, never returns. At
the end of this message is the gdb trace I got from such a frozen
process. It looks like the process wants to flush IO (could it be part
of the exit procedure ?) but cannot because some other thread is
blocking.
The main process is threaded but the child isn't. Isn't it weird that
it gets blocked in such a way ? Gdb doesn't show me any other thread
in the child process.
Another question: assuming this kind of hangup is unavoidable if I try
to flush in a threaded process, is there a way to terminate a caml
process without any extra possibly-blocking stuff ?
I'm sorry to experience and report such a mess..
(gdb) bt
#0 0xffffe410 in __kernel_vsyscall ()
#1 0xb7bc556e in __lll_mutex_lock_wait ()
from /lib/tls/i686/cmov/libpthread.so.0
#2 0xb7bc323b in pthread_cond_signal@@GLIBC_2.3.2 ()
from /lib/tls/i686/cmov/libpthread.so.0
#3 0x08066ad5 in caml_thread_enter_blocking_section ()
#4 0x0806c006 in caml_enter_blocking_section ()
#5 0x08066c72 in caml_io_mutex_lock ()
#6 0x0807025d in caml_ml_flush ()
#7 0x08079f8d in caml_interprete ()
#8 0x08075eb0 in caml_callbackN_exn ()
#9 0x08075efa in caml_callback_exn ()
#10 0x080670b8 in caml_thread_start ()
#11 0xb7bc0e60 in start_thread () from /lib/tls/i686/cmov/libpthread.so.0
#12 0xb7afe8ee in clone () from /lib/tls/i686/cmov/libc.so.6
next reply other threads:[~2006-05-23 0:04 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-05-23 0:04 David Baelde [this message]
2006-05-23 3:03 ` [Caml-list] Freezing skaller
2006-05-23 13:24 ` Eric Cooper
2006-05-24 15:51 ` David Baelde
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53c655920605221704r5ff97fdfj1fa953f6f858a8b1@mail.gmail.com \
--to=david.baelde@gmail.com \
--cc=caml-list@inria.fr \
--cc=david.baelde@ens-lyon.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).