Gabriel Biberian
2004-05-26 10:26:40 UTC
Hello,
I recently had to compile a C++ program on SCO OpenServer (5.0.7). The
software runs fine on linux, bsd, osx, aix, solaris, but OpenServer
seems to cause troubles.
I installed the gnutools from ftp.sco.com and as i need Posix Threads, i
also installed FSU-Threads v3.9 from SKUNKWARE.
There are many read/write/select calls on sockets and the program always
randomly segfaults and dumps core.
gdb backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x080e92f4 in kill ()
(gdb) bt
#0 0x080e92f4 in kill ()
#1 0x08093038 in default_action ()
#2 0x08093256 in handle_thread_signal ()
#3 0x080938ed in handle_one_signal ()
#4 0x08093acf in pthread_handle_one_process_signal ()
#5 0x0809f080 in pthread_signal_sched ()
#6 0x0809e852 in pthread_sched_wrapper ()
#7 0x08093de0 in sighandler ()
#8 0x08099ea1 in pthread_sigaction ()
#9 0x080e6810 in malloc ()
#10 0x080d6018 in __builtin_new ()
another backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x080e9348 in kill ()
(gdb) bt
#0 0x080e9348 in kill ()
#1 0x08093034 in default_action ()
#2 0x08093252 in handle_thread_signal ()
#3 0x080938e9 in handle_one_signal ()
#4 0x08093acb in pthread_handle_one_process_signal ()
#5 0x0809f07c in pthread_signal_sched ()
#6 0x0809e84e in pthread_sched_wrapper ()
#7 0x08093ddc in sighandler ()
#8 0x08099e9d in pthread_sigaction ()
#9 0x080e7434 in _real_free ()
#10 0x080e73e2 in free ()
#11 0x080d5faf in __builtin_delete ()
Apparently there seems to be a problem in memory alloc/free...
Here is how i link the program
g++ -L/usr/local/lib -lmalloc -lgthreads -lsocket -lgthreads
I read something in the MySQl documentation that to get pthreads to run
well with sockets, you must link with gnu malloc, but i don't think i
understand how to do that. I tried:
g++ -L/usr/local/lib -L/usr/local/lib/libmalloc.a -lgthreads -lsocket
-lgthreads
but it doesn't help at all.
I also tried installing a more recent version of FSU-threads (3.14), but
the problem persists.
Anyone out there encounter this problem???
Is there a solution?
Another problem:
I encountered a weirdness in the select call on OpenServer: select
(according to the man page) is supposed to return the #of file
descriptors that respond, -1 in case of error and 0 if there were no
descriptors ready after timeval. Yet select sometimes returns 0
immediately without having waited timeval. Is this normal??? My
solution is to call select again if it has returned 0 without waiting
timeval, but that's an ugly hack.
Thanks in advance,
Gabriel Biberian
Beemo Technologie
I recently had to compile a C++ program on SCO OpenServer (5.0.7). The
software runs fine on linux, bsd, osx, aix, solaris, but OpenServer
seems to cause troubles.
I installed the gnutools from ftp.sco.com and as i need Posix Threads, i
also installed FSU-Threads v3.9 from SKUNKWARE.
There are many read/write/select calls on sockets and the program always
randomly segfaults and dumps core.
gdb backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x080e92f4 in kill ()
(gdb) bt
#0 0x080e92f4 in kill ()
#1 0x08093038 in default_action ()
#2 0x08093256 in handle_thread_signal ()
#3 0x080938ed in handle_one_signal ()
#4 0x08093acf in pthread_handle_one_process_signal ()
#5 0x0809f080 in pthread_signal_sched ()
#6 0x0809e852 in pthread_sched_wrapper ()
#7 0x08093de0 in sighandler ()
#8 0x08099ea1 in pthread_sigaction ()
#9 0x080e6810 in malloc ()
#10 0x080d6018 in __builtin_new ()
another backtrace:
Program terminated with signal 11, Segmentation fault.
#0 0x080e9348 in kill ()
(gdb) bt
#0 0x080e9348 in kill ()
#1 0x08093034 in default_action ()
#2 0x08093252 in handle_thread_signal ()
#3 0x080938e9 in handle_one_signal ()
#4 0x08093acb in pthread_handle_one_process_signal ()
#5 0x0809f07c in pthread_signal_sched ()
#6 0x0809e84e in pthread_sched_wrapper ()
#7 0x08093ddc in sighandler ()
#8 0x08099e9d in pthread_sigaction ()
#9 0x080e7434 in _real_free ()
#10 0x080e73e2 in free ()
#11 0x080d5faf in __builtin_delete ()
Apparently there seems to be a problem in memory alloc/free...
Here is how i link the program
g++ -L/usr/local/lib -lmalloc -lgthreads -lsocket -lgthreads
I read something in the MySQl documentation that to get pthreads to run
well with sockets, you must link with gnu malloc, but i don't think i
understand how to do that. I tried:
g++ -L/usr/local/lib -L/usr/local/lib/libmalloc.a -lgthreads -lsocket
-lgthreads
but it doesn't help at all.
I also tried installing a more recent version of FSU-threads (3.14), but
the problem persists.
Anyone out there encounter this problem???
Is there a solution?
Another problem:
I encountered a weirdness in the select call on OpenServer: select
(according to the man page) is supposed to return the #of file
descriptors that respond, -1 in case of error and 0 if there were no
descriptors ready after timeval. Yet select sometimes returns 0
immediately without having waited timeval. Is this normal??? My
solution is to call select again if it has returned 0 without waiting
timeval, but that's an ugly hack.
Thanks in advance,
Gabriel Biberian
Beemo Technologie