From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (qmail 25786 invoked from network); 4 Jan 1999 16:40:28 -0000 Received: from mail.redhat.com (199.183.24.239) by lists.redhat.com with SMTP; 4 Jan 1999 16:40:28 -0000 Received: from rzcomm1.rz.tu-bs.de (root@rzcomm1.rz.tu-bs.de [134.169.9.107]) by mail.redhat.com (8.8.7/8.8.7) with ESMTP id LAA14755 for ; Mon, 4 Jan 1999 11:22:13 -0500 From: y0000218@rzsrv2.rz.tu-bs.de Received: from ppp393.ts.rz.tu-bs.de (ppp393.ts.rz.tu-bs.de [134.169.243.93]) by rzcomm1.rz.tu-bs.de (8.8.6/8.8.6) with ESMTP id RAA24983 for ; Mon, 4 Jan 1999 17:22:02 +0100 (MET) Received: from alpha.utopia (ppp393.ts.rz.tu-bs.de [192.168.0.1]) by ppp393.ts.rz.tu-bs.de (8.9.0/8.8.7) with ESMTP id QAA20239 for ; Mon, 4 Jan 1999 16:15:59 GMT Date: Mon, 4 Jan 1999 16:15:59 GMT Message-Id: <199901041615.QAA20239@ppp393.ts.rz.tu-bs.de> Subject: Threads problem: segfault in ntop1.1a9 I have a problem compiling ntop-1.1a9 (ftp://ftp.unipi.it/pub/ntop/snapshots/ ntop1.1a9.tar.gz) the uses threads. it works on x86. Just compiled ntop on a alpha-redhat-5.2 system, 2.1.130 kernel. Starting program: /home/olaf/bin/./ntop -w 3000 -n Program received signal SIGUSR1, User defined signal 1. __sigsuspend () at ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42 ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42: No such file or directory. Current language: auto; currently asm (gdb) bt #0 __sigsuspend () at ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42 #1 0x2000027d1d0 in pthread_create (thread=0x1201884a0, attr=0x0, start_routine=0x120009450 , arg=0x0) at restart.h:32 #2 0x12000a6a0 in createThread (threadId=0x0, __start_routine=0, __arg=0x0) at util.c:374 #3 0x120003008 in main (argc=4, argv=0x11ffff7f8) at ntop.c:279 (gdb) l util.c:374 369 370 int createThread(pthread_t *threadId, 371 void *(*__start_routine) (void *), 372 void *__arg) { 373 374 int rc = pthread_create(threadId, NULL, 375 __start_routine, __arg); 376 377 return(rc); 378 } after loading the initial page in a web browser. Starting program: /tmp/olaf/ntop-1.1a9/ntop -w 3000 -n (global vars:) #ifdef MULTITHREADED ConditionalVariable packetQueueCondvar; pthread_mutex_t packetQueueMutex; pthread_t dequeueThreadId, handleWebConnectionsThreadId, updateThptThreadId; PacketInformation packetQueue[PACKET_QUEUE_LENGTH]; unsigned int maxPacketQueueLen, packetQueueLen, packetQueueHead, packetQueueTail, packetQueueDroppedPkts; #endif Breakpoint 1, main (argc=4, argv=0x11ffff7f8) at ntop.c:279 279 createThread(&dequeueThreadId, dequeuePacket, NULL); Current language: auto; currently c (gdb) l 274 #ifdef MULTITHREADED 275 maxPacketQueueLen = packetQueueLen = packetQueueHead = 276 packetQueueTail = packetQueueDroppedPkts = 0; 277 createCondvar(&packetQueueCondvar); 278 createMutex(&packetQueueMutex); 279 createThread(&dequeueThreadId, dequeuePacket, NULL); 280 createThread(&updateThptThreadId, updateThptLoop, NULL); 281 #endif 282 283 (void)fprintf(stderr, "ntop v.%s " (gdb) p dequeueThreadId $1 = 0 (gdb) p* dequeueThreadId Cannot access memory at address 0x0. (gdb) p &dequeueThreadId $2 = (pthread_t *) 0x1201884a0 (gdb) p dequeuePacket $3 = {void ()} 0x120009450 (gdb) s createThread (threadId=0x1201884a0, __start_routine=0x120009450 , __arg=0x0) at util.c:374 374 int rc = pthread_create(threadId, NULL, (gdb) l 369 370 int createThread(pthread_t *threadId, 371 void *(*__start_routine) (void *), 372 void *__arg) { 373 374 int rc = pthread_create(threadId, NULL, 375 __start_routine, __arg); 376 377 return(rc); 378 } (gdb) m threadId Ambiguous command "m threadId": maintenance, make, mt. (gdb) p threadId $4 = (pthread_t *) 0x1201884a0 (gdb) p __start_routine $5 = (void *(*)()) 0x120009450 (gdb) p __arg $6 = (void *) 0x0 (gdb) s pthread_create (thread=0xbb8, attr=0x12014839c, start_routine=0x3690e794, arg=0x11ffff7f8) at pthread.c:233 pthread.c:233: No such file or directory. (gdb) b util.c:377 Breakpoint 2 at 0x12000a6a8: file util.c, line 377. (gdb) c Continuing. Program received signal SIGUSR1, User defined signal 1. __sigsuspend () at ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42 ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42: No such file or directory. Current language: auto; currently asm (gdb) bt #0 __sigsuspend () at ../sysdeps/unix/sysv/linux/alpha/sigsuspend.S:42 #1 0x2000027d1d0 in pthread_create (thread=0x1201884a0, attr=0x0, start_routine=0x120009450 , arg=0x0) at restart.h:32 #2 0x12000a6a0 in createThread (threadId=0x0, __start_routine=0, __arg=0x0) at util.c:374 #3 0x120003008 in main (argc=4, argv=0x11ffff7f8) at ntop.c:279 glibc-2.0.7-29 /lib/libpthread-0.7.so /lib/libpthread.so.0 /usr/lib/libpthread.a /usr/lib/libpthread.so x86 system, rh 5.2, same versions, kernel 2.0.36: works. Starting program: /tmp/olaf/ntop-1.1a9/ntop -w 3000 -n Breakpoint 1, main (argc=4, argv=0xbffffd1c) at ntop.c:279 279 createThread(&dequeueThreadId, dequeuePacket, NULL); (gdb) p &dequeueThreadId $1 = (long unsigned int *) 0x80c075c (gdb) p dequeuePacket $2 = {void ()} 0x804df40 (gdb) s createThread (threadId=0x80c075c, __start_routine=0x804df40 , __arg=0x0) at util.c:374 374 int rc = pthread_create(threadId, NULL, (gdb) l 369 370 int createThread(pthread_t *threadId, 371 void *(*__start_routine) (void *), 372 void *__arg) { 373 374 int rc = pthread_create(threadId, NULL, 375 __start_routine, __arg); 376 377 return(rc); 378 } (gdb) p threadId $3 = (long unsigned int *) 0x80c075c (gdb) p __start_routine $4 = (void *(*)()) 0x804df40 (gdb) p __arg $5 = (void *) 0x0 (gdb) s strcmp (p1=0x8048e85 "_IO_stdin_", p2=0x8049096 "pthread_create") at ../sysdeps/generic/strcmp.c:30 ../sysdeps/generic/strcmp.c:30: No such file or directory. (gdb) (gdb) b util.c:377 Breakpoint 2 at 0x804eae7: file util.c, line 377. (gdb) c Continuing. [New Thread 19982] [New Thread 19968] [New Thread 19983] Breakpoint 2, createThread (threadId=0x80c075c, __start_routine=0x804df40 , __arg=0x0) at util.c:378 378 } (gdb) Any hints? Olaf -- "The number of Unix installations Olaf Schnapauff, has grown to 10, with more expected." O.Schnapauff@tu-bs.de - The Unix Programmer's Manual,1972 http://www.tu-bs.de/~c0033014/ See Web page and keyservers for pgp public key