php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #40708 Crashes when using PostgreSQL module
Submitted: 2007-03-03 15:55 UTC Modified: 2007-03-13 01:00 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: max at to-the-max dot net Assigned:
Status: No Feedback Package: PostgreSQL related
PHP Version: 5.2.1 OS: FreeBSD 6.2-STABLE - AMD64
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: max at to-the-max dot net
New email:
PHP Version: OS:

 

 [2007-03-03 15:55 UTC] max at to-the-max dot net
Description:
------------
Every couple hundred of requests PHP crashes while accessing a PostgreSQL database.

Backtrace always points to ext/pgsql/pgsql.c __zend_lineno=375


Reproduce code:
---------------
Different scripts. All have in common that they use the PostgreSQL module.

Actual result:
--------------
===
Backtrace 1
===

www3# gdb /usr/local/bin/php php.core.500
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.3...done.
Loaded symbols for /lib/libcrypt.so.3
Reading symbols from /usr/local/pgsql/lib/libpq.so.5...done.
Loaded symbols for /usr/local/pgsql/lib/libpq.so.5
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /lib/libz.so.3...done.
Loaded symbols for /lib/libz.so.3
Reading symbols from /lib/libm.so.4...done.
Loaded symbols for /lib/libm.so.4
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x7fff00000031, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
1012            if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) {
(gdb) bt
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x7fff00000031, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
#1  0x000000000067c6e1 in _zend_mm_free_int (heap=0x95c000, p=0x7fff00000031, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1520
#2  0x000000000067d90d in _efree (ptr=0x7fff00000031, __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", 
    __zend_lineno=375, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1877
#3  0x000000000050f30f in _php_pgsql_notice_ptr_dtor (ptr=0xac0098) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:375
#4  0x00000000006a9872 in zend_hash_clean (ht=0x9539a8) at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:552
#5  0x000000000050fbfc in zm_deactivate_pgsql (type=1, module_number=10) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:574
#6  0x00000000006a44d6 in module_registry_cleanup (module=0x9f5e00) at /usr/home/max/tmp/php-5.2.1/Zend/zend_API.c:1945
#7  0x00000000006a9cf2 in zend_hash_apply (ht=0x957d40, apply_func=0x6a44a0 <module_registry_cleanup>)
    at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:673
#8  0x000000000069c205 in zend_deactivate_modules () at /usr/home/max/tmp/php-5.2.1/Zend/zend.c:839
#9  0x00000000006458e1 in php_request_shutdown (dummy=0x0) at /usr/home/max/tmp/php-5.2.1/main/main.c:1293
#10 0x0000000000718b06 in main (argc=1, argv=0x7fffffffedc8) at /usr/home/max/tmp/php-5.2.1/sapi/cgi/cgi_main.c:1796







===
Backtrace 2
===


www3# gdb /usr/local/bin/php php.core.501
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.3...done.
Loaded symbols for /lib/libcrypt.so.3
Reading symbols from /usr/local/pgsql/lib/libpq.so.5...done.
Loaded symbols for /usr/local/pgsql/lib/libpq.so.5
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /lib/libz.so.3...done.
Loaded symbols for /lib/libz.so.3
Reading symbols from /lib/libm.so.4...done.
Loaded symbols for /lib/libm.so.4
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x3d0000004e, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
1012            if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) {
(gdb) bt
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x3d0000004e, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
#1  0x000000000067c6e1 in _zend_mm_free_int (heap=0x95c000, p=0x3d0000004e, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1520
#2  0x000000000067d90d in _efree (ptr=0x3d0000004e, __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", 
    __zend_lineno=375, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1877
#3  0x000000000050f30f in _php_pgsql_notice_ptr_dtor (ptr=0xabac18) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:375
#4  0x00000000006a9872 in zend_hash_clean (ht=0x9539a8) at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:552
#5  0x000000000050fbfc in zm_deactivate_pgsql (type=1, module_number=10) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:574
#6  0x00000000006a44d6 in module_registry_cleanup (module=0x9f5e00) at /usr/home/max/tmp/php-5.2.1/Zend/zend_API.c:1945
#7  0x00000000006a9cf2 in zend_hash_apply (ht=0x957d40, apply_func=0x6a44a0 <module_registry_cleanup>)
    at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:673
#8  0x000000000069c205 in zend_deactivate_modules () at /usr/home/max/tmp/php-5.2.1/Zend/zend.c:839
#9  0x00000000006458e1 in php_request_shutdown (dummy=0x0) at /usr/home/max/tmp/php-5.2.1/main/main.c:1293
#10 0x0000000000718b06 in main (argc=1, argv=0x7fffffffedc8) at /usr/home/max/tmp/php-5.2.1/sapi/cgi/cgi_main.c:1796




===
Backtrace 2
===


www3# gdb /usr/local/bin/php php.core.501
GNU gdb 6.1.1 [FreeBSD]
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "amd64-marcel-freebsd"...
Core was generated by `php'.
Program terminated with signal 11, Segmentation fault.
Reading symbols from /lib/libcrypt.so.3...done.
Loaded symbols for /lib/libcrypt.so.3
Reading symbols from /usr/local/pgsql/lib/libpq.so.5...done.
Loaded symbols for /usr/local/pgsql/lib/libpq.so.5
Reading symbols from /usr/local/lib/libiconv.so.3...done.
Loaded symbols for /usr/local/lib/libiconv.so.3
Reading symbols from /lib/libz.so.3...done.
Loaded symbols for /lib/libz.so.3
Reading symbols from /lib/libm.so.4...done.
Loaded symbols for /lib/libm.so.4
Reading symbols from /lib/libc.so.6...done.
Loaded symbols for /lib/libc.so.6
Reading symbols from /libexec/ld-elf.so.1...done.
Loaded symbols for /libexec/ld-elf.so.1
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x3d0000004e, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
1012            if (p->info._size != ZEND_MM_NEXT_BLOCK(p)->info._prev) {
(gdb) bt
#0  0x000000000067b0b9 in zend_mm_check_ptr (heap=0x95c000, ptr=0x3d0000004e, silent=1, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1012
#1  0x000000000067c6e1 in _zend_mm_free_int (heap=0x95c000, p=0x3d0000004e, 
    __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", __zend_lineno=375, __zend_orig_filename=0x0, 
    __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1520
#2  0x000000000067d90d in _efree (ptr=0x3d0000004e, __zend_filename=0x78d218 "/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c", 
    __zend_lineno=375, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /usr/home/max/tmp/php-5.2.1/Zend/zend_alloc.c:1877
#3  0x000000000050f30f in _php_pgsql_notice_ptr_dtor (ptr=0xabac18) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:375
#4  0x00000000006a9872 in zend_hash_clean (ht=0x9539a8) at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:552
#5  0x000000000050fbfc in zm_deactivate_pgsql (type=1, module_number=10) at /usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c:574
#6  0x00000000006a44d6 in module_registry_cleanup (module=0x9f5e00) at /usr/home/max/tmp/php-5.2.1/Zend/zend_API.c:1945
#7  0x00000000006a9cf2 in zend_hash_apply (ht=0x957d40, apply_func=0x6a44a0 <module_registry_cleanup>)
    at /usr/home/max/tmp/php-5.2.1/Zend/zend_hash.c:673
#8  0x000000000069c205 in zend_deactivate_modules () at /usr/home/max/tmp/php-5.2.1/Zend/zend.c:839
#9  0x00000000006458e1 in php_request_shutdown (dummy=0x0) at /usr/home/max/tmp/php-5.2.1/main/main.c:1293
#10 0x0000000000718b06 in main (argc=1, argv=0x7fffffffedc8) at /usr/home/max/tmp/php-5.2.1/sapi/cgi/cgi_main.c:1796


===
Other debug messages
===


Some debug messages also indicate memory leaks:


[Sat Mar  3 16:32:07 2007]  Script:  '/home/site/index.php'
/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c(357) :  Freeing 0x0098A360 (16 bytes), script=/home/site/index.php
[Sat Mar  3 16:32:07 2007]  Script:  '/home/site/index.php'
/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c(285) :  Freeing 0x0098E3E8 (256 bytes), script=/home/site/index.php
=== Total 2 memory leaks detected ===
[Sat Mar  3 16:32:07 2007]  Script:  '/home/site/index.php'
/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c(285) :  Freeing 0x00B3BE08 (256 bytes), script=/home/site/index.php
[Sat Mar  3 16:32:07 2007]  Script:  '/home/site/index.php'
/usr/home/max/tmp/php-5.2.1/ext/pgsql/pgsql.c(357) :  Freeing 0x0098B7E8 (16 bytes), script=/home/site/index.php


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-05 09:53 UTC] tony2001@php.net
Please try using this CVS snapshot:

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


 [2007-03-13 01:00 UTC] 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".
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Dec 27 11:01:30 2024 UTC