ID:               33167
 Updated by:       [EMAIL PROTECTED]
 Reported By:      jsnell at networkninja dot com
-Status:           Open
+Status:           Feedback
 Bug Type:         PostgreSQL related
 Operating System: Debian (dotdeb), gentoo
 PHP Version:      5.0.5
 New Comment:

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz

And this time: TRY the snapshot for real. And provide the backtrace
using that snapshot if the crash still happens.



Previous Comments:
------------------------------------------------------------------------

[2005-09-18 02:58:35] jsnell at networkninja dot com

The 5.0.5 error was produced in a debian build.  In order to get a
debug build, --disable-debug was modified to --enable-debug and
dh_strip was commented from the debian rules.

php -v
PHP 5.0.5-dbg (cli) (built: Sep 17 2005 19:42:02) (DEBUG)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.5, Copyright (c) 1998-2004 Zend Technologies

------------------------------------------------------------------------

[2005-09-18 02:56:05] jsnell at networkninja dot com

This is in the debian builds using debug libc

I'm still getting odd behavior in variants of this code.  The following
produces a segfault:
error_reporting(E_STRICT);
$db_user = "user";
$db_password =  "pass";
$db_name = "db";
$db_port = 5432;

$connect_string =  "user=$db_user " .
"password=$db_password " .
"port=$db_port ".
"dbname=$db_name";

$db_link = pg_connect($connect_string);

$query = 'select 1 as one';
$result = pg_exec($db_link, $query);
$i = (float) floor(4/5);
echo("PRE"); flush();
$data =  pg_fetch_array($result, $i); // i think it gets corrupted
here
echo($i);

$data = pg_fetch_array($result, ($i));
$data = pg_fetch_array($result, ($i));
echo("z\n");
?>

#0  0xb7b354c5 in *__GI___mempcpy (dstpp=0xb7927000, srcpp=0x0,
len=1024)
    at ../sysdeps/generic/mempcpy.c:57
#1  0xb7b2b281 in _IO_new_file_xsputn (f=0xb7be3100, data=0x0,
n=16384)
    at fileops.c:1319
#2  0xb7b219a9 in _IO_fwrite (buf=0x0, size=1, count=16384,
fp=0xb7be3100)
    at iofwrite.c:45
#3  0x08298893 in sapi_cli_ub_write (str=0x0, str_length=1515870810)
    at /usr/src/php5/php5-5.0.5/sapi/cli/php_cli.c:192
#4  0x082237d5 in php_ub_body_write_no_header (str=0x0,
str_length=1515870810)
    at /usr/src/php5/php5-5.0.5/main/output.c:687
#5  0x082221d9 in php_body_write (str=0x0, str_length=1515870810)
    at /usr/src/php5/php5-5.0.5/main/output.c:119
#6  0x08211af6 in php_body_write_wrapper (str=0x0,
str_length=1515870810)
    at /usr/src/php5/php5-5.0.5/main/main.c:1255
#7  0x082567bf in zend_print_zval_ex (
    write_func=0x8211ad0 <php_body_write_wrapper>, expr=0x852bb1c,
indent=0)
    at /usr/src/php5/php5-5.0.5/Zend/zend.c:288
#8  0x08256732 in zend_print_zval (expr=0x852bb1c, indent=0)
    at /usr/src/php5/php5-5.0.5/Zend/zend.c:269
#9  0x08255e65 in zend_print_variable (var=0x852bb1c)
    at /usr/src/php5/php5-5.0.5/Zend/zend_variables.c:168
#10 0x08281fd9 in zend_echo_handler (execute_data=0xbfffbd00,
    opline=0x8526b68, op_array=0x851f68c)
    at /usr/src/php5/php5-5.0.5/Zend/zend_execute.c:2022
#11 0x08280648 in execute (op_array=0x851f68c)
    at /usr/src/php5/php5-5.0.5/Zend/zend_execute.c:1437
#12 0x08257fdf in zend_execute_scripts (type=8, retval=0x0,
file_count=3)
    at /usr/src/php5/php5-5.0.5/Zend/zend.c:1064
#13 0x0821252f in php_execute_script (primary_file=0xbfffe110)
    at /usr/src/php5/php5-5.0.5/main/main.c:1643
#14 0x08299c77 in main (argc=2, argv=0xbfffe1a4)
    at /usr/src/php5/php5-5.0.5/sapi/cli/php_cli.c:946


A variation of this code produces:
/usr/src/php5/php5-5.0.5/ext/pgsql/pgsql.c(1446) :  Freeing 0x085248C4
(16 bytes), script=/home/jsnell/public_html/relay2/global/breaker.php
=== Total 1 memory leaks detected ===

Here is the code:
<?php
error_reporting(E_STRICT);
$db_user = "dbuser";
$db_password =  "dbpass";
$db_name = "dbname";
$db_port = 5432;

$connect_string =  "user=$db_user " .
"password=$db_password " .
"port=$db_port ".
"dbname=$db_name";

$db_link = pg_connect($connect_string);

$query = 'select 1 as one';
$result = pg_exec($db_link, $query);
$i = (float) floor(4/5);
echo("PRE"); flush();
$data =  pg_fetch_array($result, $i); // i think it gets corrupted
here

echo("z\n");
?>

------------------------------------------------------------------------

[2005-06-14 01:00:03] php-bugs at lists dot php dot net

No feedback was provided for this bug for over a week, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".

------------------------------------------------------------------------

[2005-06-06 23:45:56] [EMAIL PROTECTED]

Please try using this CVS snapshot:

  http://snaps.php.net/php5-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php5-win32-latest.zip

I'm pretty sure that leak/crash is fixed now.


------------------------------------------------------------------------

[2005-05-30 07:58:06] jsnell at networkninja dot com

While the snapshot solved my original case, I'm still having problems
with similar code.  I haven't quite narrowed it down yet as even
changing the position of an echo seems to affect the outcome.  

PHP 5.1.0-dev (cli) (built: May 28 2005 13:09:48)
Copyright (c) 1997-2005 The PHP Group
Zend Engine v2.1.0-dev, Copyright (c) 1998-2004 Zend Technologies

[Switching to Thread -1213082528 (LWP 16161)]
0xb7d4f0a1 in mallopt () from /lib/tls/libc.so.6
(gdb) bt
#0  0xb7d4f0a1 in mallopt () from /lib/tls/libc.so.6
#1  0xb7d4ef6e in mallopt () from /lib/tls/libc.so.6
#2  0xb7d4ddcb in free () from /lib/tls/libc.so.6
#3  0x081da1e6 in shutdown_memory_manager (silent=1, full_shutdown=0)
    at /usr/src/php5-src/php5-200505280230/Zend/zend_alloc.c:511
#4  0x081b677d in php_request_shutdown (dummy=0x0)
    at /usr/src/php5-src/php5-200505280230/main/main.c:1248
#5  0x0825e8f0 in main (argc=2, argv=0xbfffe824)
    at /usr/src/php5-src/php5-200505280230/sapi/cli/php_cli.c:1134

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
    http://bugs.php.net/33167

-- 
Edit this bug report at http://bugs.php.net/?id=33167&edit=1

Reply via email to