|
Ok, this one has me stumped. I have done DNS via threading with Jobo's threading snipet, this is for a mud which is FAR removed from Godwars but was still close enough for me to be able to get the threading in with a little work, however now we have a crash that I just can't find.
Here is the GDB session for it, including the BT: [New Thread 7176 (LWP 20029)]
Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 7176 (LWP 20029)] 0x400e41a7 in malloc () from /lib/libc.so.6 (gdb) bt #0 0x400e41a7 in malloc () from /lib/libc.so.6 #1 0x400e3f98 in malloc () from /lib/libc.so.6 #2 0x400d59be in fopen () from /lib/libc.so.6 #3 0x40bf0735 in _nss_files_endservent () from /lib/libnss_files.so.2 #4 0x40bf1870 in _nss_files_gethostbyaddr_r () from /lib/libnss_files.so.2 #5 0x40164b99 in gethostbyaddr_r () from /lib/libc.so.6 #6 0x080e963a in lookup_address (darg=0x40c17248) at comm.c:4827 #7 0x40053e24 in pthread_start_thread_event (arg=0xbebffc00) at manager.c:274
The line of code in question is: gethostbyaddr_r( darg->buf, sizeof(darg->buf), AF_INET, &ent, buf, 16384, &from, &err);
But, more interesting things, it crashes occasionaly in other places where an fopen is called in the code.
My only thought is that I need to do a pthread_mutex_lock and pthread_mutex_unlock before and after all instances where an fopen would be called, but I'm not sure if that's the solution. Any help on this?
|