Page 1 of 1

Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 1:44 pm
by kenworth
I have been running ZM 1.26.5 for several weeks without issue until recently when all of the binaries started generating segmentation faults on exit. This prevented ZM from starting up since zmfix would fault. I was able to get ZM up and running by commenting zmfix out of zmpkg.pl, but all of the other binaries continue to segfault on exit. I also tried building and running the latest source from git...everything segfaults there as well. This appears to be happening in libpthread.so and in the case of zmfix occurs in the last line of code (return(0);). Debug output below (sorry if some of the syntax looks off...trying to figure out how to get gdb output posted without the offsite URL block):

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 1:46 pm
by kenworth
gdb output from core file....still fighting the "offsite URL" issue...despite the fact there are no URL's in my gdb output:


Program terminated with signal SIGSEGV, Segmentation fault.
#0 __GI___pthread_mutex_lock (mutex=0x8) at ../nptl/pthread_mutex_lock.c:66
66 unsigned int type = PTHREAD_MUTEX_TYPE_ELISION (mutex);

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 1:52 pm
by kenworth
backtrace...couple lines at a time until I figure out the URL pattern matching secret:

(gdb) bt
#0 __GI___pthread_mutex_lock (mutex 0x8) at pthread_mutex_lock.c:66
#1 0x0000003dc5022bc4 in host_table_final () at hosttable.c:54
#2 0x0000003d9980f8ea in _dl_fini () at dl-fini.c:252

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 1:59 pm
by kenworth
0x0000003d99c39515 in __GI_exit (status=<optimized out>) at exit.c:104
#5 0x0000003d99c21d6c in __libc_start_main (main=0x409ac7 <main(int, char**)>, argc=1, argv=0x7fffffffe3e8,
init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffffffe3d8)
at libc-start.c:319
#6 0x0000000000409539 in _start ()
(gdb)

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 2:03 pm
by kenworth
Sorry folks...the forum simply will not let me paste line 3 of the backtrace...for some reason thinks it has an offsite URL in it...it doesn't, but I can't figure out what it is pattern matching on. Line 3 is in run_exit_handlers at exit.c:82

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 6:35 pm
by AllenTuttle
I have not been able to get ZoneMinder to compile on my Fedora boxes for over a year.
Could you post your configure line, I would be happy to test on a current ZoneMinder version.
I have it running fine on RHEL5.

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 7:53 pm
by kenworth
Don't think you want my build config. I just edited zmfix.cpp so all it does is a return(0); Still causes a segmentation fault, so I suspect something in my compile options is causing this in conjunction with a library change on my server. These binaries were working for several weeks without issue and then after some patching and a reboot started segfaulting.

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 8:18 pm
by AllenTuttle
After an update over a year ago I had the same kind of problem.
I knew several of the needed libraries had been updated so I have been hoping that I could just recompile.
My old source would not compile nor would the last two updates.
I've tried finding a way to fix the Fedora library problems in this forum and elsewhere to no avail.

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Tue Feb 11, 2014 9:00 pm
by kenworth
Ok, I have narrowed this down to the /usr/lib64/mysql/libmysqlclient.so library. Even with my simple version of zmfix that only does a return(0);, if I link that library to the executable it will seg fault every time in pthread_mutex_lock. If I remove it from the linker line, the resulting binary will run without issue.

Compile lines to reproduce this are below (again, my simple version of zmfix.cpp only has a return(0); in main):

[root@shadow src]# /usr/lib64/ccache/c++ -Wall -D__STDC_CONSTANT_MACROS -g -I/home/public/ZoneMinder-1.26.5/src -I/home/public/ZoneMinder-1.26.5 -I/usr/include/ffmpeg -o CMakeFiles/zmfix.dir/zmfix.cpp.o -c /home/public/ZoneMinder-1.26.5/src/zmfix.cpp

[root@shadow src]# /usr/lib64/ccache/c++ -Wall -D__STDC_CONSTANT_MACROS -g CMakeFiles/zmfix.dir/zmfix.cpp.o -o zmfix -rdynamic -lz -ljpeg -lssl -lcrypto -lpthread -lpcre -lgcrypt -lgnutls /usr/lib64/mysql/libmysqlclient.so -lavformat -lavcodec -lavdevice -lavutil -lswscale -Wl,-rpath,/usr/lib64/mysql

[root@shadow src]# ./zmfix
Segmentation fault (core dumped)

Pull libmysqlclient.so from the link:

[root@shadow src]# /usr/lib64/ccache/c++ -Wall -D__STDC_CONSTANT_MACROS -g CMakeFiles/zmfix.dir/zmfix.cpp.o -o zmfix -rdynamic -lz -ljpeg -lssl -lcrypto -lpthread -lpcre -lgcrypt -lgnutls -lavformat -lavcodec -lavdevice -lavutil -lswscale -Wl,-rpath,/usr/lib64/mysql

[root@shadow src]# ./zmfix

[root@shadow src]# echo $?
0
[root@shadow src]#

Not sure where to go from here as that library will be required for the real zmfix as well as the other binaries.

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Wed Feb 12, 2014 4:37 pm
by knight-of-ni
I don't have a silver bullet for you, but I've got a couple bits of information that might help:
- zmfix has been removed from all future versions of zoneminder. The next version 1.27 will be released shortly.

- Have you looked at my Fedora rpms here?
http://www.zoneminder.com/forums/viewto ... =9&t=21400

I built these on F19, and I plan to build zm 1.27 for F20 sometime after 1.27 is released.
I've been told that these rpms do work on F20. If you run into problems, try to rebuild the srpm like so:

Code: Select all

rpmbuild --rebuild zoneminder-1.26.5-1.fc19.src.rpm
You'll need to get all the build dependencies for this work.

Lastly, the latest bits required to build zoneminder on fedora can always be found here:
https://github.com/ZoneMinder/ZoneMinde ... ros/fedora

Re: Segfaults with ZM 1.26.5 and Fedora 20 64 bit

Posted: Wed Feb 12, 2014 10:04 pm
by kenworth
I actually identified the source of the problem this morning but didn't have time to post. It is the gnutls library. I recently updated that to 3.1.20-1.fc20.x86_64 as part of a yum update. I downgraded it via yum downgrade to 3.1.16-1.fc20.x86_64 and the segfaults completely disappeared.

It appears to be some kind of interaction between libmysqlclient and the gnutls library.