php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #45761 make test & make install failure
Submitted: 2008-08-08 11:59 UTC Modified: 2008-08-22 01:00 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
From: a dot sanders at manchester dot ac dot uk Assigned:
Status: No Feedback Package: Compile Failure
PHP Version: 5.2CVS-2008-08-11 OS: Solaris 9
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2008-08-08 11:59 UTC] a dot sanders at manchester dot ac dot uk
Description:
------------
'make test' fails immediately with a segmentation fault. Re-compiling
with compiler flag DEBUG_ZEND=2 allows 'make test' to get to test
4399 before spawning several thousand php-cgi children and consuming all 
the system memory.


Actual result:
--------------
Initial configure command was:

    env LDFLAGS="-R/copac/gcc-4/lib" ./configure --prefix=~/apache-
2_2/ --with-mysql=/home/copacw/mysql5/mysql --with-libxml-
dir=/home/copacw/apache-2_2

A 'make test' from the above results in this:

 huntly copacw/php-5.2.6 $ make test
 Build complete.
 Don't forget to run 'make test'.
 Segmentation Fault - core dumped 
 make: [test] Error 139 (ignored)

A backtrace of the core file from the above:

 #0  0x00220130 in _zval_ptr_dtor (zval_ptr=0x39d8a8)
     at /home/copacw/php-5.2.6/Zend?/zend_execute_API.c:412 
 412             (*zval_ptr)->refcount--;
 (gdb) list
 407     ZEND_API void _zval_ptr_dtor(zval **zval_ptr 
ZEND_FILE_LINE_DC)
 408     {
 409     #if DEBUG_ZEND>=2
 410             printf("Reducing refcount for %x (%x):  %d->%d\n", 
*zval_ptr, zval_ptr, (*zval_ptr)->refcount, (*zval_ptr)-
>refcount-1);
 411     #endif
 412             (*zval_ptr)->refcount--;
 413             if ((*zval_ptr)->refcount==0) {
 414                     zval_dtor(*zval_ptr);
 415                     safe_free_zval_ptr_rel(*zval_ptr 
ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_CC);
 416             } else if ((*zval_ptr)->refcount == 1) {
 (gdb) print *zval_ptr
 $1 = (zval *) 0x1

I reconfigured by adding CFLAGS="-DDEBUG_ZEND=2" to the start of the 
configure command, did a 'make clean', then 'make', then 
'make test'.
This time the 'make test' gets to test 4399 and then fails as below:

 ....
 PASS XMLWriter: libxml2 XML Writer DTD Element & Attlist 
[ext/xmlwriter/tests/OO_008.phpt] 
 PASS XMLWriter: PI, Comment, CDATA [ext/xmlwriter/tests/OO_009.phpt] 
 PASS Bug #39504 (xmlwriter_write_dtd_entity() creates Attlist tag, 
not enity) [ext/xmlwriter/tests/bug39504.phpt] 
 PASS Bug #41287 (Namespace functions don't allow xmlns defintion to 
be optional) [ext/xmlwriter/tests/bug41287.phpt] 
 PASS Bug #41287 (Writing empty tags with Xmlwriter::WriteElement?
[ns]) [ext/xmlwriter/tests/bug41326.phpt] 
 TEST 4399/4426 [sapi/cgi/tests/001.phpt]

Test 4399 spawned over 4400 php-cgi child processes (on a previous run 
when I left it
to its own devices it kept going until it had consumed all the system 
memory and swap.)

A ps of the process it created is as follows:

 $ ps -ef | grep php-cgi        
   copacw    40    37  0 12:22:05 pts/3    0:00 sh -c 
/home/copacw/php-5.2.6/sapi/cgi/php-cgi -n -v
   copacw 29989 29988  0 12:22:03 pts/3    0:00 /home/copacw/php-
5.2.6/sapi/cgi/php-cgi -n -v
   copacw  1721  1720  0 12:23:07 pts/3    0:00 /home/copacw/php-
5.2.6/sapi/cgi/php-cgi -n -v
   ...

I also tried 'make install'. The first compile WITHOUT the DEBUG_ZEND 
flag failed
on a 'make install' with a segmentation fault. The compile WITH the 
flag successfully
performed the 'make install'.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-08 18:11 UTC] jani@php.net
Get this:
http://snaps.php.net/php5.2-latest.tar.gz

And do not apply any 3rd party options. And do (exactly) this:

# ./configure --disable-all && make test

 [2008-08-08 18:12 UTC] jani@php.net
s/options/patches/ :)
 [2008-08-11 09:45 UTC] a dot sanders at manchester dot ac dot uk
I downloaded the latest this morning and did
 
  ./configure --disable-all
  make test

I compiles okay and then still seg faults when it
gets to the test part of make test:

 ...
 Build complete.
 Don't forget to run 'make test'.

 Segmentation Fault - core dumped
 make: [test] Error 139 (ignored)

Same stuff as before from gdb:

 #0  0x0010003c in _zval_ptr_dtor (zval_ptr=0x23f1e0)
     at /home/copacw/php5.2-200808110830/Zend/zend_execute_API.c:412
 412             (*zval_ptr)->refcount--;
 (gdb) print *zval_ptr
 $1 = (zval *) 0x1
 (gdb) 

I recompiled again with the DEBUG_ZEND=2 flag and got the following result:

 Build complete.
 Don't forget to run 'make test'.
 
 
 +-----------------------------------------------------------+
 |                       ! ERROR !                           |
 | The test-suite requires that you have pcre extension      |
 | enabled. To enable this extension either compile your PHP |
 | with --with-pcre-regex or if you've compiled pcre as a    |
 | shared module load it via php.ini.                        |
 +-----------------------------------------------------------+

So reconfigured and recompiled again with --disbale-all --with-pcre_regex. This time it compiled and got to test 3519 when
it again tried to spawn thousands of child processes. It
was in danger of consuming all available memory, so I killed
it at that point.

  TEST 3519/3546 [sapi/cgi/tests/001.phpt]
 [2008-08-12 14:32 UTC] jani@php.net
Add the output of '(gdb) bt' here of the crash. Compile using this configure line:

# ./configure --disable-all --enable-debug

Also, when you generate the backtrace, make sure you're not loading any php.ini file using the '-n' parameter. f.e.

# USE_ZEND_ALLOC=0 gdb sapi/cli/php -n run-tests.php
 [2008-08-12 15:13 UTC] a dot sanders at manchester dot ac dot uk
When I compiled with

 ./configure --disable-all --enable-debug --with-pcre-regex

I can do a make test and it gets to the same place as before
(the cgi test) without core dumping. I then have to kill it
before it consumes the system memory.

You told me to run gdb as follows:

 USE_ZEND_ALLOC=0 gdb sapi/cli/php -n run-tests.php

gdb wont accept such a command line, so I entered

  run -n run-tests.php

from the gdb prompt and I then get the message:

 Starting program: /home/copacw/php5.2-200808110830/sapi/cli/php -n run-tests.php
 ERROR: environment variable TEST_PHP_EXECUTABLE must be set to specify PHP executable!

 Program exited with code 01.

I've tried setting a TEST_PHP_EXECUTABLE environment variable to point to the php executable, but I still get the same message.
 [2008-08-12 15:37 UTC] jani@php.net
This should work:

# USE_ZEND_ALLOC=0 TEST_PHP_EXECUTABLE=/full/path/to/php \
gdb --arg /full/path/to/php -n /full/path/to/php \
run-tests.php -n /full/path/to/php/src/



 [2008-08-13 09:10 UTC] a dot sanders at manchester dot ac dot uk
Output from gdb as follows. Is this what you were expecting? It
doesn't crash out, so there's no backtrace.

(gdb) run
Starting program: /home/copacw/php5.2-200808110830/sapi/cli/php -n /home/copacw/php5.2-200808110830/sapi/cli/php run-tests.php -n /home/copacw/php5.2-200808110830/sapi/cli/php

Warning: Unexpected character in input:  '' (ASCII=16) state=1 in /home/copacw/php5.2-200808110830/sapi/cli/php on line 3309

Parse error: syntax error, unexpected T_STRING in /home/copacw/php5.2-200808110830/sapi/cli/php on line 3309

Program exited with code 0377.
 [2008-08-13 14:20 UTC] jani@php.net
Almost there. :) You tried to execute the php binary as a script, leave that sapi/cli/php out of the last path, it's supposed to be the s.c. top_srcdir. This should be correct for you:

# USE_ZEND_ALLOC=0 \
TEST_PHP_EXECUTABLE=/home/copacw/php5.2-200808110830/sapi/cli/php \
gdb --arg /home/copacw/php5.2-200808110830/sapi/cli/php -n \
run-tests.php -n /home/copacw/php5.2-200808110110830/

(gdb) run
<possible segfault>
(gdb) bt

Start copying the output of "bt" command from the line after the "run" command which has the line with the crash info.
 [2008-08-13 14:26 UTC] a dot sanders at manchester dot ac dot uk
I don't think we're quite there yet. I copied and pasted your
suggested command line and got the following:

carew copacw/php5.2-200808110830 $ USE_ZEND_ALLOC=0 \
> TEST_PHP_EXECUTABLE=/home/copacw/php5.2-200808110830/sapi/cli/php \
> gdb --arg /home/copacw/php5.2-200808110830/sapi/cli/php -n \
> run-tests.php -n /home/copacw/php5.2-200808110110830/
GNU gdb 6.2.1
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 "sparc-sun-solaris2.9"...
(gdb) run
Starting program: /home/copacw/php5.2-200808110830/sapi/cli/php -n run-tests.php -n /home/copacw/php5.2-200808110110830/
bogus test name /home/copacw/php5.2-200808110110830/

Program exited normally.
(gdb) 

(My apologies for being too dumb to sort this out myself.)
 [2008-08-13 19:12 UTC] jani@php.net
Does this directory contain the sources of PHP or not:
/home/copacw/php5.2-200808110110830/ 

If not, point that to the sources then..or where ever the hell the tests are you run when you do 'make test'..
 [2008-08-14 07:17 UTC] a dot sanders at manchester dot ac dot uk
That directory does contain the sources.
 [2008-08-14 17:56 UTC] jani@php.net
It's something you're doing very wrong or is pretty messed up on your system. Try testing on other Solaris machine. I'm done with this, it works fine for me on several different Linux machines.
 [2008-08-22 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: Sat May 11 03:01:29 2024 UTC