[unixODBC-support] Segfault in libodbccr.so on x86_64

Colin Snover unixodbc.org at zetafleet.com
Sat Dec 22 11:14:50 GMT 2007


Hello all,

I am experiencing a problem with unixODBC nearly identical to the
problem sent to the list in mid-November by Cherie Soleil ("core dump in
libodbccr.so on HP iA64"). I am running on x86_64 rather than IA64, but
the problem seems to occur at the same place in the code. Here is the
full stack trace:

#0  0x00002b29d319d01c in memcpy () from /lib/libc.so.6
#1  0x00002b29dc8c8e73 in fetch_row (cl_statement=0xe36b00,
row_number=0, offset=0) at SQLExtendedFetch.c:277
#2  0x00002b29dc8c91b1 in fetch_rowset (cl_statement=0xe36b00,
rows_in_set=1, row_offset=0, fetched_rows=0x7fffda28eb04,
row_status_array=0x0, rows_fetched_ptr=0x0)
    at SQLExtendedFetch.c:464
#3  0x00002b29dc8c93e7 in do_fetch_scroll (cl_statement=0xe36b00,
fetch_orientation=1, fetch_offset=0, row_status_ptr=0xe3fb20,
rows_fetched_ptr=0x0, ext_fetch=0)
    at SQLExtendedFetch.c:749
#4  0x00002b29dc8c9a04 in CLFetchScroll (statement_handle=0xe36b00,
fetch_orientation=1, fetch_offset=0) at SQLFetchScroll.c:98
#5  0x00002b29d9c3dcd6 in SQLFetchScroll (statement_handle=0xe3e2b0,
fetch_orientation=1, fetch_offset=0) at SQLFetchScroll.c:270
#6  0x00002b29da71716a in odbc_stmt_fetch (stmt=0xdcffa8, ori=<value
optimized out>, offset=6) at
/home/colin/software/source/php5-5.2.1/ext/pdo_odbc/odbc_stmt.c:360
#7  0x00002b29d9e9b173 in ?? () from /usr/lib/php5/20060613/pdo.so
#8  0x00002b29d9e9b364 in ?? () from /usr/lib/php5/20060613/pdo.so
#9  0x00002b29d9e9c44b in ?? () from /usr/lib/php5/20060613/pdo.so
#10 0x0000000000676642 in ?? ()
#11 0x0000000000666cac in execute ()
#12 0x0000000000647cd3 in zend_execute_scripts ()
#13 0x0000000000606288 in php_execute_script ()
#14 0x00000000006d0960 in main ()

As you can probably tell from the paths in the backtrace, I'm trying to
use unixODBC via the PHP PDO_ODBC extension. The database being used is
a MSSQL database, with unixODBC configured to use the FreeTDS ODBC
driver. The script used to trigger this problem is very basic:

<?php
$pdo = new PDO('odbc:dbname', 'username', 'password');
$pdo->query('SET QUOTED_IDENTIFIERS ON');
$stmt = $pdo->query('exec sp_columns @table_name = "Audio"');
$stmt->fetchAll(PDO::FETCH_NUM);
?>

Any time a fetch is performed, a segfault occurs, so this could be made
into an even simpler testcase.

I tried downloading and compiling unixODBC-2.2.13pre from the FTP
server, but there was a compilation failure (presumably due to a missing
diaginternal.h file). For fun, here's the compile error:

 gcc -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\"
-DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE=\"unixODBC\"
-DVERSION=\"2.2.13pre\" -DYYTEXT_POINTER=1 -DSTDC_HEADERS=1
-DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1
-DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1
-DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1
-DHAVE_SYS_SEM_H=1 -DHAVE_DLFCN_H=1 -DHAVE_ICONV=1 -DICONV_CONST=
-DHAVE_LIBCRYPT=1 -DHAVE_READLINE_HISTORY_H=1 -DHAVE_READLINE=1
-DHAVE_SCANDIR=1 -DTIME_WITH_SYS_TIME=1 -DHAVE_SYS_TIME_H=1
-DSIZEOF_LONG=8 -DPLATFORM64=1 -DHAVE_LONG_LONG=1 -DSIZEOF_LONG_INT=8
-DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 -DHAVE_VSNPRINTF=1
-DHAVE_STRTOL=1 -DHAVE_ATOLL=1 -DHAVE_STRTOLL=1 -DHAVE_ENDPWENT=1
-DHAVE_GETTIMEOFDAY=1 -DHAVE_FTIME=1 -DHAVE_TIME=1 -DHAVE_LIBPTHREAD=1
-D_REENTRANT=1 -DHAVE_LOCALTIME_R=1 -DHAVE_FTOK=1 -DHAVE_SEMGET=1
-DHAVE_SHMGET=1 -DHAVE_SEMOP=1 -DHAVE_SNPRINTF=1 -DNEED_SEMUNDO_UNION=1
-DCOLLECT_STATS=1 -DSTDC_HEADERS=1 -DHAVE_MALLOC_H=1 -DHAVE_UNISTD_H=1
-DHAVE_PWD_H=1 -DHAVE_CRYPT_H=1 -DHAVE_LIMITS_H=1 -DHAVE_STRINGS_H=1
-DHAVE_STRING_H=1 -DHAVE_LOCALE_H=1 -DHAVE_SYS_TYPES_H=1
-DHAVE_SYS_SEM_H=1 -DHAVE_STDARG_H=1 -DHAVE_SYS_TIME_H=1
-DHAVE_SYS_TIMEB_H=1 -DHAVE_TIME_H=1 -DHAVE_DIRENT_H=1 -DHAVE_ALLOCA_H=1
-DHAVE_ALLOCA=1 -DHAVE_VPRINTF=1 -DHAVE_PUTENV=1 -DHAVE_SOCKET=1
-DHAVE_STRDUP=1 -DHAVE_STRSTR=1 -DHAVE_SETENV=1 -DHAVE_SETLOCALE=1
-DHAVE_STRCHR=1 -DUNIXODBC_SOURCE=1 -I. -I. -I../include -g -O2
-DENABLE_INI_CACHING -pthread -MT diag.lo -MD -MP -MF .deps/diag.Tpo -c
diag.c  -fPIC -DPIC -o .libs/diag.o
diag.c:10:26: error: diaginternal.h: No such file or directory
diag.c:12: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:18: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'g_aDiagStates'
diag.c:140: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagAlloc'
diag.c:161: error: expected ')' before 'h'
diag.c:171: error: expected ')' before 'h'
diag.c:189: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagPush'
diag.c:220: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagPeek'
diag.c:230: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagPop'
diag.c:250: error: expected ')' before 'h'
diag.c:260: error: expected ')' before 'h'
diag.c:271: error: expected ')' before 'h'
diag.c:281: error: expected ')' before 'h'
diag.c:291: error: expected ')' before 'h'
diag.c:301: error: expected ')' before 'h'
diag.c:312: error: expected ')' before 'h'
diag.c:323: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagGetCursorRowCount'
diag.c:333: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:343: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagGetDyanmicFunctionCode'
diag.c:353: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagGetNumber'
diag.c:363: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagGetReturnCode'
diag.c:373: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagGetRowCount'
diag.c:383: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:393: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:403: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagRecordAlloc'
diag.c:437: error: expected ')' before 'h'
diag.c:449: error: expected ')' before 'h'
diag.c:459: error: expected ')' before 'h'
diag.c:487: error: expected ')' before 'h'
diag.c:497: error: expected ')' before 'h'
diag.c:507: error: expected ')' before 'h'
diag.c:517: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:527: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagRecordGetColumnNumber'
diag.c:537: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:547: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:561: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagRecordGetNative'
diag.c:571: error: expected '=', ',', ';', 'asm' or '__attribute__'
before 'diagRecordGetRowNumber'
diag.c:581: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:591: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
diag.c:601: error: expected '=', ',', ';', 'asm' or '__attribute__'
before '*' token
make[1]: *** [diag.lo] Error 1
make[1]: Leaving directory
`/home/colin/software/source/unixODBC-2.2.13pre/diag'

The first step, I guess, would be to get that source package updated on
FTP with diaginternal.h to see if it resolves the problem, then move on
from there if it doesn't.

Thanks for your help!

Regards,

-- 
Colin Snover
http://www.zetafleet.com





More information about the unixODBC-support mailing list