This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/4402] New: gettimeofday() and time() hang and consume all cpu when called in sig_child handler


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.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]