I noticed Paul made some minor changes to the mutexes and this might fix
your problem.

I'm adding some wrapper functions to all mutexes which will make it possible
to log any error-codes from the mutex-calls. I guess the first failing
mutex-call will log a readable error, and the second error will generate a
segmentation fault before being able to log the error.
No pthread-calls handling mutexes _should_ return any errors if the code is
working, but it could be useful to make it possible to turn on logging for
those failing calls. It will of course generate some more stack-usage, but
it shouldn't be noticeable.
Compiling with --disable-debug should remove all extra wrapper functions.
I really need this feature with uClibc-0.9.29 which seems to have a broken
libpthread. It could be used on any system to make sure all mutexes are
working as they should...

I was thinking of something like this to turn on the debug-output.
./owserver --fatal_debug --fatal_debug_file /tmp/owfs_fatal

"--fatal_debug" will log all errors to stderr or syslog depending on
--error_print
"--fatal_debug_file /tmp/owfs_fatal" will also log all errors to a file
/tmp/owfs_fatal.pid

I have checked in the changes to the CVS, and I hope this will show if there
are more existing bugs with the mutexes.

/Christian




-----Original Message-----
From: Serg Oskin [mailto:s...@oskin.ru] 
Sent: Thursday, December 18, 2008 4:44 PM
To: owfs-developers@lists.sourceforge.net
Subject: Re: [Owfs-developers] general protection

Unfortunately, I can not devote enough time, but I will strongly contribute
to solving this problem.

> Hi All!
> 
> version 2.7p11
> 
> # dmesg
> ...
> owserver[18546] general protection rip:2b88f97f76c0 rsp:53b29dc8 error:0
> owserver[20757] general protection rip:2b13e1c026c0 rsp:4e8f1dc8 error:0
> 
> 
> Sometimes this happens, starting with version 2.7p4.
> 
> # file core.15352
> core.15352: ELF 64-bit LSB core file AMD x86-64, version 1 (SYSV), 
> SVR4-style, from 'owserver'
> # gdb /usr/sbin/owserver core.15352
> GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you 
> are
> welcome to change it and/or distribute copies of it under certain 
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
details.
> This GDB was configured as "x86_64-redhat-linux-gnu"...Using host 
> libthread_db library "/lib64/libthread_db.so.1".
> 
> Reading symbols from /usr/lib64/libow-2.7.so.11...Reading symbols from 
> /usr/lib/debug/usr/lib64/libow-2.7.so.11.0.0.debug...done.
> done.
> Loaded symbols for /usr/lib64/libow-2.7.so.11
> Reading symbols from /usr/lib64/libusb-0.1.so.4...done.
> Loaded symbols for /usr/lib64/libusb-0.1.so.4
> Reading symbols from /lib64/libm.so.6...done.
> Loaded symbols for /lib64/libm.so.6
> Reading symbols from /lib64/libdl.so.2...done.
> Loaded symbols for /lib64/libdl.so.2
> Reading symbols from /lib64/libpthread.so.0...done.
> Loaded symbols for /lib64/libpthread.so.0
> Reading symbols from /lib64/libc.so.6...done.
> Loaded symbols for /lib64/libc.so.6
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Reading symbols from /lib64/libgcc_s.so.1...done.
> Loaded symbols for /lib64/libgcc_s.so.1
> Core was generated by `/usr/sbin/owserver -p 30003 -d /dev/ttyS0 -t 30'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x00002b88f97f76c0 in __pthread_mutex_unlock_usercnt () from 
> /lib64/libpthread.so.0
> (gdb)
> (gdb) bt
> #0  0x00002b88f97f76c0 in __pthread_mutex_unlock_usercnt () from 
> /lib64/libpthread.so.0
> #1  0x00002b88f911e506 in LockRelease (pn=0x53b2a058) at ow_locks.c:194
> #2  0x00002b88f912504c in FS_r_given_bus (owq=0x53b2a040) at ow_read.c:238
> #3  0x00002b88f912514f in FS_read_distribute (owq=0x53b2a040) at 
> ow_read.c:193
> #4  0x00002b88f91255ef in FS_read_postparse (owq=0x53b2a040) at 
> ow_read.c:109
> #5  0x000000000040278e in ReadHandler (hd=0x51325f00, cm=0x53b2a0e0, 
> owq=0x53b2a040) at read.c:86
> #6  0x0000000000403025 in DataHandler (v=<value optimized out>) at 
> data.c:124
> #7  0x00002b88f97f42f7 in start_thread () from /lib64/libpthread.so.0
> #8  0x00002b88f9ad9e3d in clone () from /lib64/libc.so.6
> (gdb)
> 
> # gdb /usr/sbin/owserver core.19785
> GNU gdb Red Hat Linux (6.5-37.el5_2.2rh)
> Copyright (C) 2006 Free Software Foundation, Inc.
> GDB is free software, covered by the GNU General Public License, and you 
> are
> welcome to change it and/or distribute copies of it under certain 
> conditions.
> Type "show copying" to see the conditions.
> There is absolutely no warranty for GDB.  Type "show warranty" for
details.
> This GDB was configured as "x86_64-redhat-linux-gnu"...Using host 
> libthread_db library "/lib64/libthread_db.so.1".
> 
> Reading symbols from /usr/lib64/libow-2.7.so.11...Reading symbols from 
> /usr/lib/debug/usr/lib64/libow-2.7.so.11.0.0.debug...done.
> done.
> Loaded symbols for /usr/lib64/libow-2.7.so.11
> Reading symbols from /usr/lib64/libusb-0.1.so.4...done.
> Loaded symbols for /usr/lib64/libusb-0.1.so.4
> Reading symbols from /lib64/libm.so.6...done.
> Loaded symbols for /lib64/libm.so.6
> Reading symbols from /lib64/libdl.so.2...done.
> Loaded symbols for /lib64/libdl.so.2
> Reading symbols from /lib64/libpthread.so.0...done.
> Loaded symbols for /lib64/libpthread.so.0
> Reading symbols from /lib64/libc.so.6...done.
> Loaded symbols for /lib64/libc.so.6
> Reading symbols from /lib64/ld-linux-x86-64.so.2...done.
> Loaded symbols for /lib64/ld-linux-x86-64.so.2
> Reading symbols from /lib64/libgcc_s.so.1...done.
> Loaded symbols for /lib64/libgcc_s.so.1
> Core was generated by `/usr/sbin/owserver -p 30003 -d /dev/ttyS0 -t 30'.
> Program terminated with signal 11, Segmentation fault.
> #0  0x00002b13e1c026c0 in __pthread_mutex_unlock_usercnt () from 
> /lib64/libpthread.so.0
> (gdb) bt
> #0  0x00002b13e1c026c0 in __pthread_mutex_unlock_usercnt () from 
> /lib64/libpthread.so.0
> #1  0x00002b13e1529506 in LockRelease (pn=0x4e8f2058) at ow_locks.c:194
> #2  0x00002b13e153004c in FS_r_given_bus (owq=0x4e8f2040) at ow_read.c:238
> #3  0x00002b13e153014f in FS_read_distribute (owq=0x4e8f2040) at 
> ow_read.c:193
> #4  0x00002b13e15305ef in FS_read_postparse (owq=0x4e8f2040) at 
> ow_read.c:109
> #5  0x000000000040278e in ReadHandler (hd=0x72d2bf00, cm=0x4e8f20e0, 
> owq=0x4e8f2040) at read.c:86
> #6  0x0000000000403025 in DataHandler (v=<value optimized out>) at 
> data.c:124
> #7  0x00002b13e1bff2f7 in start_thread () from /lib64/libpthread.so.0
> #8  0x00002b13e1ee4e3d in clone () from /lib64/libc.so.6
> (gdb)
> 
> 
> ------------------------------------------------------------------------
> 
>
----------------------------------------------------------------------------
--
> SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas,
Nevada.
> The future of the web can't happen without you.  Join us at MIX09 to help
> pave the way to the Next Web now. Learn more and register at
>
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Owfs-developers mailing list
> Owfs-developers@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/owfs-developers

----------------------------------------------------------------------------
--
SF.Net email is Sponsored by MIX09, March 18-20, 2009 in Las Vegas, Nevada.
The future of the web can't happen without you.  Join us at MIX09 to help
pave the way to the Next Web now. Learn more and register at
http://ad.doubleclick.net/clk;208669438;13503038;i?http://2009.visitmix.com/
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers


------------------------------------------------------------------------------
_______________________________________________
Owfs-developers mailing list
Owfs-developers@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/owfs-developers

Reply via email to