bug-glibc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

libc6 localtime race?


From: Ryan Underwood
Subject: libc6 localtime race?
Date: Sun, 10 Nov 2002 03:17:28 +0000

Hi,

There seems to be some problems with the localtime() function under 
multithreaded
operation.  (Debian GNU/Linux 2.4.19 x86) Occasionally, the call to localtime
will result in a SIGSEGV and the thread will die.

Please see this post for a related Debian bug report:
http://groups.google.com/groups?selm=handler.75163.D75163.97863864410131.ackdone%40bugs.debian.org&oe=utf-8&output=gplain
The Debian maintainers do not believe the problem exists, but clearly it
does.

I have attached a test program that will duplicate the behavior
immediately on my systems.

Here is a sample backtrace (note that the code is inside a function which
is run through pthread_create().

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 7176 (LWP 32148)]
0x400c9582 in getenv () from /lib/libc.so.6
(gdb) bt 
#0  0x400c9582 in getenv () from /lib/libc.so.6
#1  0x40133e83 in adjtime () from /lib/libc.so.6
#2  0x40134c3e in tzset () from /lib/libc.so.6
#3  0x401318c2 in localtime () from /lib/libc.so.6
#4  0x080e0bd4 in event_thread (arg=0x82bad68) at main.cpp:1219
#5  0x400220ba in pthread_start_thread () from /lib/libpthread.so.0
(gdb) up
#1  0x40133e83 in adjtime () from /lib/libc.so.6
(gdb) up
#2  0x40134c3e in tzset () from /lib/libc.so.6
(gdb) up
#3  0x401318c2 in localtime () from /lib/libc.so.6
(gdb) up
#4  0x080e0bd4 in event_thread (arg=0x82bad68) at main.cpp:1219
1219                    now_tm=*localtime(&now);
Current language:  auto; currently c++
(gdb) list
1214    #endif
1215
1216            while(!sbbs->terminated && telnet_socket!=INVALID_SOCKET) {
1217
1218                    now=time(NULL);
1219                    now_tm=*localtime(&now);
1220
1221                    if(now-lastsemchk>=sbbs->cfg.node_sem_check) {
1222                            check_semaphores=true;
1223                            lastsemchk=now;

---------------------------------------------------------------------------

Any suggestions would be appreciated.

-- 
Ryan Underwood, <nemesis at icequake.net>, icq=10317253

Attachment: localtime-segv.c
Description: Binary data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]