[freetds] Segmentation fault when concurrently opening database connections

James K. Lowden jklowden at schemamania.org
Mon Apr 19 19:38:30 EDT 2004

On Mon, 19 Apr 2004, Joshua Moore-Oliva <josh at chatgris.com> wrote:
> When I concurrently open connections (one per thread), I get a segfault
> while executing the dbopen function.
> it occurs here
> Thread 3:
> ==22112== Invalid read of size 4
> ==22112==    at 0x4032B1C3: tds_get_homedir (in
> /usr/lib/libsybdb.so.4.0)==22112==  Address 0x14 is not stack'd,
> malloc'd or free'd==22112==
> ==22112== Process terminating with default action of signal 11
> (SIGSEGV): dumping core==22112==  Address not mapped to object at
> address 0x14==22112==    at 0x4032B1C3: tds_get_homedir (in
> /usr/lib/libsybdb.so.4.0)
> However, this behaviour does not present itself if the dbopen function
> call is protected by a mutex..

Hmph.  Does the utility addr2line(1) reveal just where in
tds_get_homedir() we go wrong?  As you can see from the code
(src/tds/threadsafe.c), the function is heavily conditionalized for
various forms of homedir getting.  Maybe our detection system needs work. 

Or maybe it would be better to give up and put a local static mutex in


More information about the FreeTDS mailing list