Summary: | Infrequent random stop in futex_wait using printf inside alarm signal handler | ||
---|---|---|---|
Product: | glibc | Reporter: | Jonathan Andrews <jon> |
Component: | libc | Assignee: | Not yet assigned to anyone <unassigned> |
Status: | RESOLVED INVALID | ||
Severity: | normal | CC: | drepper.fsp, ppluzhnikov |
Priority: | P2 | Flags: | fweimer:
security-
|
Version: | unspecified | ||
Target Milestone: | --- | ||
Host: | Target: | ||
Build: | Last reconfirmed: |
Description
Jonathan Andrews
2012-03-14 13:08:03 UTC
printf and fflush are not async-signal-safe. (In reply to comment #1) > printf and fflush are not async-signal-safe. Thats nice ! Would it not have been an idea to tell someone, in the documentation for alarm for example. That way time would saved I would be swearing less. (In reply to comment #3) > http://pubs.opengroup.org/onlinepubs/9699919799/functions/V2_chap02.html#tag_15_04 Ok, I found the reference to the issue in an up to date man page for "signal" on a Debian box. My older development machine does not mention it, nor does the man page for alarm I referenced. "unspecified" is also a pretty vague term. Lots of nice unsafe examples via google - thanks web .... http://www.ccplusplus.com/2011/10/alarm-function-example-in-c.html "Interactions between alarm() and setitimer() are unspecified" No "Only thread safe functions should be used in the alarm signal handler" Its documented with the assumption that somebody has read it in the correct order, the documentation isn't thread safe itself :-( Thanks, Jon (In reply to comment #4) > No "Only thread safe functions should be used in the alarm signal handler" That statement would be incorrect. The correct statement reads: "only async-signal-safe functions can be used inside asynchronous signal handler". http://pubs.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html This fact is the "ABC" of signal handling, surely *everybody* knows that? |