[freetds] help debugging segfault

Mark A. Hershberger mah at everybody.org
Sun Mar 3 20:55:18 EST 2013


I'm working on enabling a connection to Azure's SQL server from PHP (see
https://bugs.php.net/bug.php?id=64338).

The connection now works -- at least, I can connect to a database other
than the master one -- but since errors from the server are only
available from the debug log that FreeTDS has, I need to enable the
debug log.

The problem: I get a segfault after turning on debugging.

The end of the log is included at [1].

I've also included a backtrace from gdb at [2].

Is this a bug in FreeTDS?  Or is the way I set up the connection from
PHP wrong?

[1] Debug log end
20:05:03.365572 867 (token.c:2355):tds_process_end() state set to TDS_IDLE
20:05:03.365583 867 (util.c:156):Changed query state from READING to IDLE
20:05:03.365595 867 (token.c:2370):                rows_affected = 0
20:05:03.365606 867 (util.c:104):logic error: cannot change query state
from IDLE to PENDING
20:05:03.365618 867 (token.c:540):tds_process_tokens(0x1014090,
0x7fffffff9b08, 0x7fffffff9b0c, 0x100)
20:05:03.365630 867 (token.c:543):tds_process_tokens() state is COMPLETED
20:05:03.365641 867 (login.c:496):successful login
20:05:03.365656 867 (dblib.c:239):dblib_add_connection(0x7ffff0464640,
0x1014090)
20:05:03.365682 867 (dblib.c:4317):dbsetopt(0x1013520, 17, 2147483647, -1)
20:05:03.365697 867 (dblib.c:4386):Got DBTEXTSIZE, with param
'2147483647' (max is 2147483647)

(I added the "successful login" and the "Got DBTEXTSIZE" messages.)

[2] Backtrace from gdb

(gdb) bt
#0  0x00007ffff4da3304 in vfprintf () from /lib/x86_64-linux-gnu/libc.so.6
#1  0x00007ffff023d769 in ?? () from /usr/lib/x86_64-linux-gnu/libsybdb.so.5
#2  0x00007ffff020f774 in dbsetopt () from
/usr/lib/x86_64-linux-gnu/libsybdb.so.5
#3  0x00007fffeeae4629 in pdo_dblib_handle_factory (dbh=0x7ffff7fc4b70,
driver_options=0x7fffffe9)
    at
/home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/ext/pdo_dblib/dblib_driver.c:323
#4  0x00007ffff3e9fa41 in zim_PDO_dbh_constructor (ht=1,
return_value=0x7fffffe9, return_value_ptr=0x30,
    this_ptr=0x7ffff7fc4b40, return_value_used=1) at
/home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/ext/pdo/pdo_dbh.c:380
#5  0x00007ffff40c2edc in xdebug_execute_internal
(current_execute_data=0x7ffff7f8f060, return_value_used=0)
    at /tmp/buildd/xdebug-2.2.1/build-php5/xdebug.c:1483
#6  0x00000000007468be in zend_do_fcall_common_helper_SPEC
(execute_data=0x7ffff7f8f060)
    at
/home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/Zend/zend_vm_execute.h:644
#7  0x00000000007002c7 in execute (op_array=0x7ffff7fc4070)
    at
/home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/Zend/zend_vm_execute.h:410
#8  0x00007ffff40c2a81 in xdebug_execute (op_array=0x7ffff7fc4070) at
/tmp/buildd/xdebug-2.2.1/build-php5/xdebug.c:1391
#9  0x00000000006a010e in zend_execute_scripts (type=8,
retval=0x7ffff7fc3800, file_count=3)
    at /home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/Zend/zend.c:1279
#10 0x000000000063f6e3 in php_execute_script (primary_file=0x7ffff4d9edbc)
    at /home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/main/main.c:2473
#11 0x0000000000749033 in do_cli (argc=0, argv=0x7fffffffe18b)
    at /home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/sapi/cli/php_cli.c:988
#12 0x00000000004310ca in main (argc=32767, argv=0xdb9210)
    at /home/mah/work/DEB-BUILD/build-dir/php5-5.4.4/sapi/cli/php_cli.c:1361
-- 
http://hexmode.com/

Many that live deserve death. And some that die deserve life. Can you
    give it to them? Then do not be too eager to deal out death in
    judgment. For even the very wise cannot see all ends.
        -- J.R.R. Tolkien, The Fellowship of the Ring


More information about the FreeTDS mailing list