php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47441 PHP segmentation fault on 'make test'
Submitted: 2009-02-18 16:56 UTC Modified: 2009-03-17 07:54 UTC
From: jpilling at fortvale dot com Assigned:
Status: Not a bug Package: Compile Failure
PHP Version: 5.3.0beta1 OS: zLinux - SLES 10 s390x 64bit
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 this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jpilling at fortvale dot com
New email:
PHP Version: OS:

 

 [2009-02-18 16:56 UTC] jpilling at fortvale dot com
Description:
------------
I am trying to compile PHP 5.3.0 Beta 1 on zLinux. Our package is Suse Linux Enterprise Server 10 Service Pack 2 s390x (64bit).

My configure line:

./configure --with-apxs2=/home/apache2/bin/apxs --with-mysql=/home/mysql --prefix=/home/apache2/php --disable-debug

After a successful 'make', I run 'make test' and receive the following error:

/bin/sh: line 1:  1416 Segmentation fault      TEST_PHP_EXECUTABLE=/home/php-5.3.0beta1/sapi/cli/php TEST_PHP_SRCDIR=/home/php-5.3.0beta1 CC="gcc" /home/php-5.3.0beta1/sapi/cli/php -n -c /home/php-5.3.0beta1/tmp-php.ini -d 'open_basedir=' -d 'output_buffering=0' -d 'memory_limit=-1' /home/php-5.3.0beta1/run-tests.php -n -c /home/php-5.3.0beta1/tmp-php.ini -d extension_dir=/home/php-5.3.0beta1/modules/ ` if test "x" != "x"; then for i in ""; do . $i; /home/php-5.3.0beta1/build/shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then for i in ""; do . $i; /home/php-5.3.0beta1/build/shtool echo -n -- " -d zend_extension=/home/php-5.3.0beta1/modules/$dlname"; done; fi`
make: [test] Error 139 (ignored)

Please advise or offer any suggestions.

regards
Jonathan


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-02-18 17:04 UTC] johannes@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a backtrace to see what is happening behind the scenes. To
find out how to generate a backtrace, please read
http://bugs.php.net/bugs-generating-backtrace.php for *NIX and
http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32

Once you have generated a backtrace, please submit it to this bug
report and change the status back to "Open". Thank you for helping
us make PHP better.

Please try to generate a backtrace, the command make is trying to run in your report, please also try using a shorter test script than run-tests.php. (the PHP binary is in sapi/cli/php if you didn\'t install, yet)
 [2009-02-19 08:23 UTC] jpilling at fortvale dot com
I'm sorry, I'm new to bug reporting, please excuse my inexperience. How can I make PHP crash if it won't compile/install/run? 

How do I create a bug report for this?
 [2009-02-19 09:28 UTC] jpilling at fortvale dot com
I tried to compile PHP with the following configure line:

./configure --with-apxs2=/home/apache2/bin/apxs --with-mysql=/home/mysql --prefix=/home/apache2/php --with-config-file-path=/home/apache2/php --enable-debug

During "make" I received an error as follows:

ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_ctor':
/home/php-5.3.0beta1/ext/iconv/iconv.c:2466: undefined reference to `libiconv_op                                                                             en'
ext/iconv/.libs/iconv.o: In function `php_iconv_stream_filter_append_bucket':
/home/php-5.3.0beta1/ext/iconv/iconv.c:2512: undefined reference to `libiconv'
/home/php-5.3.0beta1/ext/iconv/iconv.c:2590: undefined reference to `libiconv'
/home/php-5.3.0beta1/ext/iconv/iconv.c:2590: undefined reference to `libiconv'
collect2: ld returned 1 exit status
make: *** [sapi/cli/php] Error 1

So I added -liconv to the EXTRA_LIBS part of the makefile, and ran "make" again. This time "make" worked and I was able to run the "make test". Here are the results showing errors:

=====================================================================
TEST RESULT SUMMARY
---------------------------------------------------------------------
Exts skipped    :   51
Exts tested     :   27
---------------------------------------------------------------------

Number of tests : 9414              6044
Tests skipped   : 3370 ( 35.8%) --------
Tests warned    :    0 (  0.0%) (  0.0%)
Tests failed    :   29 (  0.3%) (  0.5%)
Expected fail   :    7 (  0.1%) (  0.1%)
Tests passed    : 6008 ( 63.8%) ( 99.4%)
---------------------------------------------------------------------
Time taken      :  754 seconds
=====================================================================

=====================================================================
FAILED TEST SUMMARY
---------------------------------------------------------------------
ob_start(): Ensure unerasable buffer cannot be accessed or erased by ob_get_clean(). [tests/output/ob_start_basic_unerasable_003.phpt]
ob_start(): Ensure unerasable buffer cannot be accessed or flushed by ob_get_flush(). [tests/output/ob_start_basic_unerasable_004.phpt]
Testing operations with undefined variable [Zend/tests/024.phpt]
Bug #16069 (ICONV transliteration failure) [ext/iconv/tests/bug16069.phpt]
iconv_mime_encode() [ext/iconv/tests/iconv_mime_encode.phpt]
iconv stream filter [ext/iconv/tests/iconv_stream_filter.phpt]
mysql connect [ext/mysql/tests/001.phpt]
mysql_connect() [ext/mysql/tests/mysql_connect.phpt]
mysql_[p]connect() - max_links/max_persistent [ext/mysql/tests/mysql_max_links.phpt]
via [ext/pdo_sqlite/tests/common.phpt]
        SQLite PDO Common: Bug #39398 (Booleans are not automatically translated to integers) [ext/pdo_sqlite/tests/bug_39398.phpt]
via [ext/pdo_sqlite/tests/common.phpt]
        SQLite PDO Common: Bug #39656 (Crash when calling fetch() on a PDO statment object after closeCursor()) [ext/pdo_sqlite/tests/bug_39656.phpt]
Testing PDOStatement::debugDumpParams() with bound params [ext/pdo_sqlite/tests/debugdumpparams_001.phpt]
posix_initgroups(): Basic tests [ext/posix/tests/posix_initgroups.phpt]
Bug #46205 (Closure - Memory leaks when ReflectionException is thrown) [ext/reflection/tests/bug46205.phpt]
SPL: FilesystemIterator and foreach [ext/spl/tests/dit_003.phpt]
SQLite3::open error test [ext/sqlite3/tests/sqlite3_15_open_error.phpt]
Bug #43008 (php://filter uris ignore url encoded filternames and can't handle slashes) [ext/standard/tests/file/bug43008.phpt]
Test file_put_contents() function : variation - include path testing [ext/standard/tests/file/file_put_contents_variation5.phpt]
Test is_executable() function: usage variations - file/dir with diff. perms [ext/standard/tests/file/is_executable_variation2.phpt]
Test is_readable() function: usage variations - file/dir with diff. perms [ext/standard/tests/file/is_readable_variation2.phpt]
Test is_writable() and its alias is_writeable() function: usage variations - file/dir with diff. perms [ext/standard/tests/file/is_writable_variation2.phpt]
Test lchown() function : error functionality [ext/standard/tests/file/lchown_error.phpt]
Test tempnam() function: usage variations - permissions(0000 to 0777) of dir [ext/standard/tests/file/tempnam_variation4.phpt]
Test mail() function : basic functionality [ext/standard/tests/mail/mail_basic2.phpt]
Test mail() function : variation force extra parameters [ext/standard/tests/mail/mail_variation2.phpt]
http-stream test [ext/standard/tests/network/http-stream.phpt]
Bug #38770 (unpack() broken with longs on 64 bit machines) [ext/standard/tests/strings/bug38770.phpt]
Test setlocale() function : usage variations - Setting all available locales in the platform [ext/standard/tests/strings/setlocale_variation2.phpt]
substr_compare() [ext/standard/tests/strings/substr_compare.phpt]
=====================================================================

=====================================================================
EXPECTED FAILED TEST SUMMARY
---------------------------------------------------------------------
ob_start(): Ensure unerasable buffer cannot be flushed by ob_flush(). [tests/output/ob_start_basic_unerasable_005.phpt]
Inconsistencies when accessing protected members [Zend/tests/access_modifiers_008.phpt]
Inconsistencies when accessing protected members - 2 [Zend/tests/access_modifiers_009.phpt]
via [ext/pdo_sqlite/tests/common.phpt]
        SQLite PDO Common: Bug #34630 (inserting streams as LOBs) [ext/pdo_sqlite/tests/bug_34630.phpt]
SimpleXML: array casting bug [ext/simplexml/tests/034.phpt]
via [ext/sqlite/tests/pdo/common.phpt]
        SQLite2 PDO Common: Bug #34630 (inserting streams as LOBs) [ext/sqlite/tests/pdo/bug_34630.phpt]
Test file_put_contents() function : variation - include path testing [ext/standard/tests/file/file_put_contents_variation6.phpt]
=====================================================================

You may have found a problem in PHP.
We would like to send this report automatically to the
PHP QA team, to give us a better understanding of how
the test cases are doing. If you don't want to send it
immediately, you can choose "s" to save the report to
a file that you can send us later.
Do you want to send this report now? [Yns]:



I don't know if this helps at all????

If I go ahead and "make install" it seems to be OK and I can create PHP web pages and view them in the browser.

However, if I configure and "make" with: 

./configure --with-apxs2=/home/apache2/bin/apxs --with-mysql=/home/mysql --prefix=/home/apache2/php --with-config-file-path=/home/apache2/php --disable-debug
 
i.e. no debug mode and add -liconv to the EXTRA_LIBS in makefile,I get the following error at "make test":

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

make: warning:  Clock skew detected.  Your build may be incomplete.
lin003:/home/php-5.3.0beta1 # make test

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

/bin/sh: line 1: 27882 Segmentation fault      TEST_PHP_EXECUTABLE=/home/php-5.3                                                                             .0beta1/sapi/cli/php TEST_PHP_SRCDIR=/home/php-5.3.0beta1 CC="gcc" /home/php-5.3                                                                             .0beta1/sapi/cli/php -n -c /home/php-5.3.0beta1/tmp-php.ini -d 'open_basedir=' -                                                                             d 'output_buffering=0' -d 'memory_limit=-1' /home/php-5.3.0beta1/run-tests.php -                                                                             n -c /home/php-5.3.0beta1/tmp-php.ini -d extension_dir=/home/php-5.3.0beta1/modu                                                                             les/ ` if test "x" != "x"; then for i in ""; do . $i; /home/php-5.3.0beta1/build                                                                             /shtool echo -n -- " -d extension=$dlname"; done; fi; if test "x" != "x"; then f                                                                             or i in ""; do . $i; /home/php-5.3.0beta1/build/shtool echo -n -- " -d zend_exte                                                                             nsion=/home/php-5.3.0beta1/modules/$dlname"; done; fi`
make: [test] Error 139 (ignored)
lin003:/home/php-5.3.0beta1 #



HOWEVER, with the configuration that I actually got to install, I get the following backtrace when running gdb in the CLI, and then browsing my PHP pages via apache:

GNU gdb 6.6
Copyright (C) 2006 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 "s390x-suse-linux"...
Using host libthread_db library "/lib64/libthread_db.so.1".
(gdb) run -X
Starting program: /home/apache2/bin/httpd -X
[Thread debugging using libthread_db enabled]
[New Thread 2199027543344 (LWP 26825)]

Program received signal SIGPIPE, Broken pipe.
[Switching to Thread 2199027543344 (LWP 26825)]
0x0000020000389650 in do_writev () from /lib64/libc.so.6
(gdb) bt
#0  0x0000020000389650 in do_writev () from /lib64/libc.so.6
#1  0x000002000023c2e2 in apr_socket_sendv (sock=0x805694e8,
    vec=<value optimized out>, nvec=1, len=0x3ffff91a230)
    at network_io/unix/sendrecv.c:205
#2  0x000000008007042c in writev_it_all (s=0x805694e8, vec=0x3ffff91c440,
    nvec=1, len=244, nbytes=0x3ffff91c568) at core_filters.c:321
#3  0x0000000080070f76 in ap_core_output_filter (f=0x80569f28, b=0x8058f638)
    at core_filters.c:868
#4  0x0000000080199714 in ap_process_request (r=0x805815a8)
    at http_request.c:231
#5  0x0000000080196bdc in ap_process_http_connection (c=0x805696d8)
    at http_core.c:190
#6  0x000000008007982c in ap_run_process_connection (c=0x805696d8)
    at connection.c:43
#7  0x00000000801b6c7c in child_main (child_num_arg=<value optimized out>)
    at prefork.c:650
#8  0x00000000801b6efa in make_child (s=0x802924a0,
    slot=<value optimized out>) at prefork.c:690
#9  0x00000000801b7bc8 in ap_mpm_run (_pconf=<value optimized out>,
    plog=<value optimized out>, s=0x80276dd8) at prefork.c:966
#10 0x000000008005ce5a in main (argc=<value optimized out>,
    argv=0x3ffff91ce98) at main.c:740

Any help is much appreciated
 [2009-02-19 15:26 UTC] jani@php.net
Since you're compiling a handler, and that crash happens inside Apache's filter stuff, how is this PHP bug..? And why are you posting a crash in apache here when this bug report was originally about make test failing?
 [2009-02-19 15:35 UTC] jpilling at fortvale dot com
The bottom line is that if I try to compile PHP as an apache module OR as Fast-CGI - the "make test" fails with a segmentation fault unless --enable-debug is present in my configure line, and -liconv and -glibc are present in the EXTRA_LIBS part of my makefile. 

I've been testing this for months now. So how is this NOT a PHP bug?
 [2009-02-19 21:43 UTC] jani@php.net
I didn't say the ORIGINAL issue wasn't a PHP bug. Please don't post 
irrelevant stuff or multiple bugs in one report.
 [2009-02-19 21:44 UTC] jani@php.net
Oh, and we still don't have the backtrace of the bug you originally 
reported..
 [2009-02-19 22:51 UTC] jpilling at fortvale dot com
Sorry, I don't know which is a PHP fault or which is an Apache fault.

I don't know how to create a backtrace. I read the instructions but i'm struggling to understand. It mentions a script that causes the crash....is that the run-tests.php script?

Do I need to run the home/php5.3.0beta1/sapi/cli/php executable using gdb, and run the test script to get a backtrace? 

If thats correct, I get the error that /home/php5.3.0beta1/sapi/cli/php is not an executable when trying to run it with gdb.

Any ideas?

Sorry for my inexperience.
 [2009-02-20 08:19 UTC] jpilling at fortvale dot com
I tried the following to generate the backtrace (i'm not 100% sure if I'm doing the right thing, sorry ):

TEST_PHP_EXECUTABLE=/home/php-5.3.0beta1/sapi/cli/php gdb

Once GDB starts to run I enter:

run /home/php-5.3.0beta1/run-tests.php

The output is:

Starting program: /home/php-5.2.8/run-tests.php
No executable file specified.
Use the "file" or "exec-file" command.
 [2009-02-20 10:26 UTC] jpilling at fortvale dot com
Ok, I understand how to get the backtrace now, but the segmentation fault on "make test" will only occur if I --disable-debug, so how can I get a backtrace if debugging is not enabled? If I use --enable-debug php compiles OK.

I ran GDB anyway after my compile with --disable-debug, which is probably useless, and i got:

(gdb) run /home/php-5.3.0beta1/run-tests.php
Starting program: /home/php-5.3.0beta1/sapi/cli/php /home/php-5.3.0beta1/run-tests.php
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
(no debugging symbols found)
[Thread debugging using libthread_db enabled]
[New Thread 2199031317472 (LWP 9045)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 2199031317472 (LWP 9045)]
0x000000008027ea22 in ?? ()
 [2009-02-20 11:31 UTC] jpilling at fortvale dot com
PS: I need to compile with --disable-debug to use the Zend Optimizer.
 [2009-02-20 13:18 UTC] jani@php.net
Third strike. You're supposed to disable ALL 3rd party extensions. Especially any zend extensions.
 [2009-02-21 17:14 UTC] jpilling at fortvale dot com
I dont understand.....what I meant is that I want to install PHP with the --disable-debug option, and then once its installed properly I can add the Zend optimizer at a later date as an add on (to use the zend optimizer PHP has to be installed using the --disable-debug option)

The backtrace i submitted was from PHP configured in the following way:

./configure --with-apxs2=/home/apache2/bin/apxs --with-mysql=/home/mysql
--prefix=/home/apache2/php --disable-debug

Are you saying I need to get a backtrace from PHP compiled as follows:

./configure --disable-all --disable-debug

Please advise.
regards
 [2009-02-23 00:16 UTC] jpilling at fortvale dot com
anyone??
 [2009-03-16 19:35 UTC] johannes@php.net
Zend Optimizer is supported by Zend, not php.net
 [2009-03-17 07:54 UTC] jpilling at fortvale dot com
fixed by using:

export CFLAGS=-O1

before compiling.

Nothing to do with Zend, like I tried explaining.
 [2011-01-14 14:55 UTC] ashworth at us dot ibm dot com
I exported CFLAGS=-01 and that did not help.

I modified my Makefile since gcc was complaining about -01.

Changes to Makefile:
    removed -01 from CFLAGS_CLEAN
    added -01 to CFLAGS
    and left the exported CFLAGS set with -01

Compile completed successfully and make test worked as expected.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 23:01:29 2024 UTC