public inbox for glibc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libc/4402] New: gettimeofday() and time() hang and consume all cpu when called in sig_child handler
@ 2007-04-21 11:13 nico-linux-glibc at schottelius dot org
  2007-04-27  9:15 ` [Bug libc/4402] " jakub at redhat dot com
  2007-08-22  7:30 ` drepper at redhat dot com
  0 siblings, 2 replies; 3+ messages in thread
From: nico-linux-glibc at schottelius dot org @ 2007-04-21 11:13 UTC (permalink / raw)
  To: glibc-bugs

If I call gettimeofday() or time() in my signal handler of SIG_CHLD, the program
hangs in the time() or gettimeofday() call and uses all available cpu-time.

Code in sig_child:

while((pid = waitpid(-1, &tmp, WNOHANG)) > 0) {
[...]
// Either
//delay = MAX_DELAY / (time(NULL) - svc->start);
// Or
// never returns from gettimeofday
            if(gettimeofday(&now,NULL) == -1) {
               print_errno(MSG_GETTIMEOFDAY);;
               delay = 0;
            } else {
               delay = MAX_DELAY / (now.tv_sec - svc->start);
            }

The full source code is available at 
http://unix.schottelius.org/cgi-bin/gitweb.cgi?p=cLinux/cinit.git;a=tree
under src/core/sig_child.c


Installed libc: 
ii  libc6                             2.5-2                           GNU C
Library: Shared libraries
ii  libc6-amd64                       2.5-2                           GNU C
Library: 64bit Shared libraries for AM
ii  libc6-dbg                         2.5-2                           GNU C
Library: Libraries with debugging symb
ii  libc6-dev                         2.5-2                           GNU C
Library: Development Libraries and Hea

-- 
           Summary: gettimeofday() and time() hang and consume all cpu when
                    called in sig_child handler
           Product: glibc
           Version: unspecified
            Status: NEW
          Severity: normal
          Priority: P2
         Component: libc
        AssignedTo: drepper at redhat dot com
        ReportedBy: nico-linux-glibc at schottelius dot org
                CC: glibc-bugs at sources dot redhat dot com


http://sourceware.org/bugzilla/show_bug.cgi?id=4402

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/4402] gettimeofday() and time() hang and consume all cpu when called in sig_child handler
  2007-04-21 11:13 [Bug libc/4402] New: gettimeofday() and time() hang and consume all cpu when called in sig_child handler nico-linux-glibc at schottelius dot org
@ 2007-04-27  9:15 ` jakub at redhat dot com
  2007-08-22  7:30 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: jakub at redhat dot com @ 2007-04-27  9:15 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From jakub at redhat dot com  2007-04-27 10:14 -------
Pedantically, gettimeofday isn't mentioned among
http://www.opengroup.org/onlinepubs/009695399/functions/xsh_chap02_04.html#tag_02_04_03
and therefore you shouldn't call it from async signal handler.

time() and gettimeofday() are just syscalls (or vsyscall), so I very much doubt
it is hanging in these functions rather than elsewhere in your program.
Anyway, if you want us to look into this, please prepare a small self-contained
testcase.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |WAITING


http://sourceware.org/bugzilla/show_bug.cgi?id=4402

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

* [Bug libc/4402] gettimeofday() and time() hang and consume all cpu when called in sig_child handler
  2007-04-21 11:13 [Bug libc/4402] New: gettimeofday() and time() hang and consume all cpu when called in sig_child handler nico-linux-glibc at schottelius dot org
  2007-04-27  9:15 ` [Bug libc/4402] " jakub at redhat dot com
@ 2007-08-22  7:30 ` drepper at redhat dot com
  1 sibling, 0 replies; 3+ messages in thread
From: drepper at redhat dot com @ 2007-08-22  7:30 UTC (permalink / raw)
  To: glibc-bugs


------- Additional Comments From drepper at redhat dot com  2007-08-22 07:30 -------
No reply in almost 4 months.  Closing.

-- 
           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|WAITING                     |RESOLVED
         Resolution|                            |WORKSFORME


http://sourceware.org/bugzilla/show_bug.cgi?id=4402

------- You are receiving this mail because: -------
You are on the CC list for the bug, or are watching someone who is.


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-08-22  7:30 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-21 11:13 [Bug libc/4402] New: gettimeofday() and time() hang and consume all cpu when called in sig_child handler nico-linux-glibc at schottelius dot org
2007-04-27  9:15 ` [Bug libc/4402] " jakub at redhat dot com
2007-08-22  7:30 ` drepper at redhat dot com

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 read-only IMAP folder(s) and NNTP newsgroup(s).