This bug was reported to our project by a user so I will need to figure out how to get the change to the original reporter to test. I did presume its a double free at first but when I looked again at the data he provided there was a glibc double free detection message in the standard out of the program.
*** glibc detected *** ./freeswitch: double free or corruption (fasttop): 0x00007f3a581ae9f0 *** On Tue, Apr 29, 2014 at 7:31 PM, Steve Langasek <vor...@debian.org> wrote: > On Tue, Apr 29, 2014 at 04:42:13PM -0500, Anthony Minessale wrote: > > Package: unixodbc > > Version: 2.2.14p2-5 > > > Unixodbc is patched to use libltdl > > Unixodbc already uses libltdl upstream. It is patched to use the distro > version of libltdl instead of the bundled one, but that doesn't seem to be > relevant here. > > The distro-specific patch is the use of lt_dlsetsearchpath() in particular. > > > The following stack trace shows a double free coming from > lt_dlsetsearchpath() > > when multithread usage of odbc is being done with FreeSWITCH > > > #0 0x00007f3aed113475 in raise () from /lib/x86_64-linux-gnu/libc.so.6 > > #1 0x00007f3aed1166f0 in abort () from /lib/x86_64-linux-gnu/libc.so.6 > > #2 0x00007f3aed14e52b in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > > #3 0x00007f3aed157d76 in ?? () from /lib/x86_64-linux-gnu/libc.so.6 > > #4 0x00007f3aed15cb1c in free () from /lib/x86_64-linux-gnu/libc.so.6 > > #5 0x00007f3aeceddc65 in lt_dlsetsearchpath () from > > /usr/lib/x86_64-linux-gnu/libltdl.so.7 > > #6 0x00007f3aeed9c103 in ?? () from > /usr/lib/x86_64-linux-gnu/libodbc.so.1 > > #7 0x00007f3aeed9edfc in SQLConnect () from > > /usr/lib/x86_64-linux-gnu/libodbc.so.1 > > This backtrace doesn't include any information that shows that the problem > is a double-free. I can see from the code how a double-free could occur, > but do you have a more definitive trace that confirms this is the problem > you're running into? > > > According to the documentation at > > http://www.delorie.com/gnu/docs/libtool/libtool_46.html > > > Note that libltdl is not threadsafe, i.e. a multithreaded application has > > to use a mutex for libltdl. It was reported that GNU/Linux's glibc 2.0's > > dlopen with `RTLD_LAZY' (which libltdl uses by default) is not > thread-safe, > > but this problem is supposed to be fixed in glibc 2.1. On the other hand, > > `RTLD_NOW' was reported to introduce problems in multi-threaded > > applications on FreeBSD. Working around these problems is left as an > > exercise for the reader; contributions are certainly welcome. > > That seems unrelated to the use of lt_dlsetsearchpath(), which does not > invoke dlopen(). > > > I think the patch needs to be changed to use this lib with a mutex to > avoid > > memory corruption when concurrent calls to opening sql drivers are > > performed in a multi-threaded app or the use of this libltdl should be > > discontinued. > > Does the attached patch fix the problem for you? > > -- > Steve Langasek Give me a lever long enough and a Free OS > Debian Developer to set it on, and I can move the world. > Ubuntu Developer http://www.debian.org/ > slanga...@ubuntu.com vor...@debian.org > -- Anthony Minessale II ♬ @anthmfs ♬ @FreeSWITCH ♬ ☞ http://freeswitch.org/ ☞ http://cluecon.com/ ☞ http://twitter.com/FreeSWITCH ☞ irc.freenode.net #freeswitch ☞ *http://freeswitch.org/g+ <http://freeswitch.org/g+>* ClueCon Weekly Development Call ☎ sip:8...@conference.freeswitch.org ☎ +19193869900