From: Anders Peter Fugmann <anders@fugmann.net>
To: caml-list <caml-list@inria.fr>
Subject: [Caml-list] Bug when printing from signal handlers?
Date: Wed, 19 Mar 2014 22:21:34 +0100 [thread overview]
Message-ID: <532A0A5E.6070107@fugmann.net> (raw)
Hi,
I'm experiencing a live lock while printing from a signal handler.
It seems to be triggered when the main is interrupted while printing.
The following program exposes the problem:
(tested on 4.00.1 and 4.01.0)
let rec loop () =
print_endline "In main thread";
loop ()
let _ =
Sys.(set_signal sigalrm
(Signal_handle
(fun _ -> print_endline "In signal handler")));
let _ = Unix.(setitimer ITIMER_REAL
{ it_interval = 0.1; it_value = 0.1 })
in
loop ()
For some reason, in caml_flush_parial channel->buff becomes greater than
channel->curr which means caml_flush never completes, as
caml_flush_partial never returns true.
Is printing from a signal handler illegal?
I tries searching for bug on this matter but only found examples that
printed from signal handlers.
Regards
Anders
next reply other threads:[~2014-03-19 21:21 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-19 21:21 Anders Peter Fugmann [this message]
2014-03-19 22:19 ` Jesper Louis Andersen
2014-03-19 23:21 ` Gerd Stolpmann
2014-03-20 5:29 ` ygrek
2014-03-20 7:42 ` Anders Fugmann
2014-03-20 20:07 ` Gerd Stolpmann
2014-03-23 10:01 ` ygrek
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=532A0A5E.6070107@fugmann.net \
--to=anders@fugmann.net \
--cc=caml-list@inria.fr \
/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