php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #71709 make test ext/curl/tests/curl_setopt_basic003.phpt never completes
Submitted: 2016-03-03 21:26 UTC Modified: 2016-07-26 13:12 UTC
Votes:10
Avg. Score:4.0 ± 0.9
Reproduced:10 of 10 (100.0%)
Same Version:7 (70.0%)
Same OS:6 (60.0%)
From: kspen72 at gmail dot com Assigned: pierrick (profile)
Status: Closed Package: cURL related
PHP Version: 7.0.4 OS: Debian 3.2.73-2+deb7u2 x86_64
Private report: No CVE-ID: None
 [2016-03-03 21:26 UTC] kspen72 at gmail dot com
Description:
------------
make test ext/curl/tests/curl_setopt_basic003.phpt (test 3017) never completes.

Did not have this problem with "make test" using any previous version of PHP 5.6 or 7.0 on this same server.  Used same config.nice (below) on 7.0.3 and several versions of 5.6 without issue.


'./configure' \
'--with-apxs2=/usr/local/apache2/bin/apxs' \
'--with-zlib' \
'--enable-sockets' \
'--disable-ipv6' \
'--with-mcrypt' \
'--enable-mbstring' \
'--with-jpeg-dir' \
'--with-kerberos' \
'--with-curl' \
'--enable-zip' \
'--with-openssl' \
'--enable-soap' \
'--with-xmlrpc' \
'--with-pdo-mysql' \
'--with-mysqli' \
'--with-bz2' \
'--with-gd' \
'--with-freetype-dir' \
'--enable-gd-native-ttf' \
'--with-gettext' \
'--with-libdir=/lib/x86_64-linux-gnu' \
"$@"



Patches

71709.patch (last revision 2016-06-24 12:05 UTC by cmb@php.net)

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-04-20 14:27 UTC] dn at cstech dot ru
Have this bug too.
Debian 7.9
PHP 7.0.5

TEST 3079/11800 [ext/curl/tests/curl_setopt_basic003.phpt] never completes.
 [2016-04-20 14:51 UTC] kspen72 at gmail dot com
Just FYI, didn't have this problem on same server with 7.0.5.
 [2016-04-21 13:34 UTC] j dot starke at meeva dot de
+1 for PHP 7.0.5 and Debian 7.10

Stays on TEST 3053/13186 [ext/curl/tests/curl_setopt_basic003.phpt]
for 12+ Hours.

Configure: ./configure --prefix=/opt/php7 --with-openssl --with-zlib --enable-bcmath --with-bz2 --with-curl --enable-exif --enable-ftp --with-gd --with-gettext --with-imap --with-imap-ssl --enable-intl --enable-mbstring --with-mcrypt --with-mysqli --with-pdo-mysql --with-pspell --with-readline --enable-soap --enable-sockets --enable-zip --with-pear --with-kerberos
OS: Debian 3.2.68-1+deb7u6 x86_64
 [2016-06-24 11:43 UTC] klaus dot keppler at gmail dot com
Can confirm this, too.
Only happens when building PHP 7.x on Debian 7.
Same build parameters work fine on Debian 8.
(XEN domU, 64bit)

When this test is hit, a segmentation fault is written to syslog:

[11039555.163908] php[15573]: segfault at d ip 00000000006929e0 sp 00007fff9cfe1638 error 4 in php[400000+89e000]

The shell instance around the test script remains as a zombie in the process list. This effectively "stops" all further tests.

However, this bug isn't always triggered; sometimes the tests run ok.
(I guess in about 50% the "make test" hangs)

So I assume that there's a timing problem...?
 [2016-06-24 12:05 UTC] cmb@php.net
The following patch has been added/updated:

Patch Name: 71709.patch
Revision:   1466769900
URL:        https://bugs.php.net/patch-display.php?bug=71709&patch=71709.patch&revision=1466769900
 [2016-06-24 12:05 UTC] cmb@php.net
-Status: Open +Status: Feedback -Assigned To: +Assigned To: cmb
 [2016-06-24 12:05 UTC] cmb@php.net
Please try the attached 71709.patch.
 [2016-06-24 12:23 UTC] klaus dot keppler at gmail dot com
Ok, bug is 100% reproducible on Debian 7.11 with curl 7.26.0-1+wheezy13 and PHP 7.0.8
Running the test script within the build tree triggers the segmentation fault.

We have two independent problems:
1.) if a single test crashes, the "make test" environment shouldn't stop. I don't know the details of the test system, but it looks like a SIGCHLD is not catched properly, leading to a zombie child.

2.) there's a bug/problem in the CURL module. I've pasted the detailed GDB output and backtrace below.

Best regards

   -Klaus


kk@debian7-amd64-build:/usr/src/php/php-7.0.8$ gdb sapi/cli/php
GNU gdb (GDB) 7.4.1-debian
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/src/php/php-7.0.8/sapi/cli/php...done.
(gdb) run ext/curl/tests/curl_setopt_basic003.phpt
Starting program: /usr/src/php/php-7.0.8/sapi/cli/php ext/curl/tests/curl_setopt_basic003.phpt
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
--TEST--
curl_setopt() call with CURLOPT_HTTPHEADER
--CREDITS--
Paul Sohier
#phptestfest utrecht
--SKIPIF--
--FILE--
*** curl_setopt() call with CURLOPT_HTTPHEADER
bool(false)

Program received signal SIGSEGV, Segmentation fault.
_zval_ptr_dtor (zval_ptr=0x4) at /usr/src/php/php-7.0.8/Zend/zend_execute_API.c:533
533             i_zval_ptr_dtor(zval_ptr ZEND_FILE_LINE_RELAY_CC);
(gdb) bt
#0  _zval_ptr_dtor (zval_ptr=0x4) at /usr/src/php/php-7.0.8/Zend/zend_execute_API.c:533
#1  0x00007ffff3d9e305 in _php_curl_setopt (ch=0x7ffff485c8c0, option=<optimized out>,
    zvalue=0x7ffff48132c0) at /usr/src/php/php-7.0.8/ext/curl/interface.c:2822
#2  0x00007ffff3d9f084 in zif_curl_setopt (execute_data=<optimized out>, return_value=0x7ffff48131d0)
    at /usr/src/php/php-7.0.8/ext/curl/interface.c:2984
#3  0x00000000006ef062 in ZEND_DO_ICALL_SPEC_HANDLER (execute_data=0x7ffff4813030)
    at /usr/src/php/php-7.0.8/Zend/zend_vm_execute.h:586
#4  0x00000000006dfb20 in execute_ex (ex=<optimized out>)
    at /usr/src/php/php-7.0.8/Zend/zend_vm_execute.h:417
#5  0x0000000000730517 in zend_execute (op_array=op_array@entry=0x7ffff487c000,
    return_value=return_value@entry=0x0) at /usr/src/php/php-7.0.8/Zend/zend_vm_execute.h:458
#6  0x00000000006a1ea4 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0,
    file_count=file_count@entry=3) at /usr/src/php/php-7.0.8/Zend/zend.c:1427
#7  0x0000000000643ab0 in php_execute_script (primary_file=primary_file@entry=0x7fffffffd8a0)
    at /usr/src/php/php-7.0.8/main/main.c:2494
#8  0x0000000000732000 in do_cli (argc=2, argv=0xf5f3a0)
    at /usr/src/php/php-7.0.8/sapi/cli/php_cli.c:974
#9  0x000000000043a66c in main (argc=2, argv=0xf5f3a0) at /usr/src/php/php-7.0.8/sapi/cli/php_cli.c:1344
(gdb)
 [2016-06-24 12:32 UTC] klaus dot keppler at googlemail dot com
Patch 71709 doesn't help, still crashing with SEGFAULT.

Error occurs at PHP line "curl_setopt($ch, CURLOPT_HTTPHEADER, array());"
 [2016-06-24 13:03 UTC] cmb@php.net
-Status: Feedback +Status: Open
 [2016-06-24 13:03 UTC] cmb@php.net
Thanks for the backtrace and for testing the patch. Indeed, there
appears to be something terribly wrong, because the segfault is
happening when PHP is processing curl_setopt(…,
CURLOPT_PROGRESSFUNCTION)[1], which is not supposed to happen
during this test. I'll try to reproduce the issue.

[1] <https://github.com/php/php-src/blob/php-7.0.8/ext/curl/interface.c#L2822>
 [2016-06-24 18:19 UTC] cmb@php.net
-Status: Assigned +Status: Verified -Assigned To: cmb +Assigned To:
 [2016-06-24 18:19 UTC] cmb@php.net
I can confirm the issue on a bento/debian-7.10 vagrant box
with the official PHP 7.0.8. Running

  ./configure --disable-all --enabli-cli --with-curl
  make

and then running the test stalls. Setting a breakpoint on
_php_curl_setopt shows erratic program flow in gdb (might be due
to wrong macro expansion).

After

  make clean
  ./configure --disable-all --enabli-cli --with-curl --enable-debug
  make

the test runs as expected.
 [2016-06-25 01:34 UTC] pierrick@php.net
-Assigned To: +Assigned To: pierrick
 [2016-07-26 02:52 UTC] chrisbolt at gmail dot com
Just to add another data point, we ran into this in our production environment, not just a test failure (see also https://bugs.php.net/bug.php?id=71703). Using Debian 7.10 and 7.0.8 built with gcc 4.7.2, this minimal test case would crash:

<?php
$ch = curl_init('http://www.google.com/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array());
?>

Our fix was to edit the Makefile to compile ext/curl/interface.c with -O0.
 [2016-07-26 12:22 UTC] cmb@php.net
> Using Debian 7.10 and 7.0.8 built with gcc 4.7.2, this minimal
> test case would crash:

I can reproduce this (same environment).

> Our fix was to edit the Makefile to compile ext/curl/interface.c
> with -O0.

`-O1` also works for me, and also `-O2 -fno-tree-tail-merge`.

Not sure if there's really an issue with -f-tree-tail-merge in gcc
4.7.2, but at least disabling this option might be a viable
workaround.
 [2016-07-26 12:26 UTC] cmb@php.net
-Package: Testing related +Package: cURL related
 [2016-07-26 13:12 UTC] cmb@php.net
> -f-tree-tail-merge

Should of course have been -ftree-tail-merge.
 [2016-07-26 23:25 UTC] pierrick@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=24d8f6ed7c583c82d6ed63080d235474f8afec6a
Log: Fixed bug #71709
 [2016-07-26 23:25 UTC] pierrick@php.net
-Status: Verified +Status: Closed
 [2016-10-17 10:10 UTC] bwoebi@php.net
Automatic comment on behalf of pierrick
Revision: http://git.php.net/?p=php-src.git;a=commit;h=24d8f6ed7c583c82d6ed63080d235474f8afec6a
Log: Fixed bug #71709
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC