php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #23116 call to curl_getinfo() causes SIGSEGV
Submitted: 2003-04-08 13:19 UTC Modified: 2003-04-09 13:25 UTC
From: shawn at wnsi dot net Assigned:
Status: Closed Package: cURL related
PHP Version: 4.3.1 OS: Linux
Private report: No CVE-ID: None
 [2003-04-08 13:19 UTC] shawn at wnsi dot net
My script ( using php-cli ) loops over a result set and makes a curl post for each row.  It retreives all the data from the curl post for error detection and performance data.  After succesfully executing a random ( but usually between 50-120 ) number of posts the script will segfault on the call to add_assoc_string_ex() called from within curl_getinfo().

Re-running the script from where it left off will result in another 50-120 succesful posts and another crash. 

In addition I have been able to determine that it is not related to the record being used as the post fields or the response from the receiving end of the post. Sniffing from the side receiving the post that it crashed on shows that it completed the communication succesfully before the crash. The problem record goes through fine on the next run.

Removing the call to curl_getinfo() seems to resolve the problem.


System Details.......
#################################
[root@rambler root]# uname -a
Linux rambler.wnsglobal.net 2.4.7-10smp #1 SMP Thu Sep 6 16:16:16 EDT 2001 i686 unknown
[root@rambler root]# cat /etc/issue
Red Hat Linux release 7.2 (Enigma)
Kernel \r on an \m
#################################
PHP Details......
#################################
 ./configure  --with-xml --enable-ftp --with-curl=/usr/local --with-sybase=/opt/sybase --with-apxs=/usr/local/apache/bin/apxs
#################################
#cURL details
#################################
[root@rambler root]# curl --version
curl 7.10.3 (i686-pc-linux-gnu) libcurl/7.10.3 OpenSSL/0.9.7 zlib/1.1.3

#################################
#Script Details
#################################
Selects a large result set from mssql ( ~3K rows )
for each row it assembles an array to be used as the post fields for curl...
curl commands are as follows...
#################################
$url_id = curl_init($postLoc);
curl_setopt( $url_id, CURLOPT_REFERER, $ref );
curl_setopt( $url_id, CURLOPT_TIMEOUT, '45' );                                              
curl_setopt( $url_id, CURLOPT_MUTE, 1 );                                        
curl_setopt( $url_id, CURLOPT_POST, 1 );                                        
curl_setopt( $url_id, CURLOPT_POSTFIELDS, $post_fields );                                                                       curl_setopt( $url_id, CURLOPT_RETURNTRANSFER,1);                                                                                        
$postResult = curl_exec( $url_id );                                                                                      
$curl_results = curl_getinfo($url_id);
$curl_error = curl_error($url_id);
$curl_errno = curl_errno($url_id);
curl_close ( $url_id );

#################################
#Back Trace ( recreated many times.  Always the same. )
#################################
Program received signal SIGSEGV, Segmentation fault.
0x08128099 in add_assoc_string_ex (arg=0x824acf4, 
key=0x81544ba "content_type", key_len=13, str=0x0, duplicate=1)
at /usr/src/php-4.3.0/Zend/zend_API.c:671
671             ZVAL_STRING(tmp, str, duplicate);
(gdb) bt
#0      0x08128099 in add_assoc_string_ex (arg=0x824acf4, 
        key=0x81544ba "content_type", key_len=13, str=0x0, duplicate=1)
        at /usr/src/php-4.3.0/Zend/zend_API.c:671
#1      0x08066aff in zif_curl_getinfo (ht=1, return_value=0x824acf4, 
        this_ptr=0x0, return_value_used=1)
        at /usr/src/php-4.3.0/ext/curl/curl.c:1042
#2      0x08138f4c in execute (op_array=0x81cb828)
        at /usr/src/php-4.3.0/Zend/zend_execute.c:1596
#3      0x0813910a in execute (op_array=0x81bfedc)
        at /usr/src/php-4.3.0/Zend/zend_execute.c:1640
#4      0x08126b5c in zend_execute_scripts (type=8, retval=0x0, file_count=3)
        at /usr/src/php-4.3.0/Zend/zend.c:864
#5      0x08100abd in php_execute_script (primary_file=0xbffffa60)
        at /usr/src/php-4.3.0/main/main.c:1573
#6      0x081414c0 in main (argc=2, argv=0xbffffb04)
        at /usr/src/php-4.3.0/sapi/cli/php_cli.c:746
#7      0x402b1507 in __libc_start_main (main=0x8140b40 <main>, argc=2, 
        ubp_av=0xbffffb04, init=0x806243c <_init>, fini=0x8141a80 <_fini>, 
        rtld_fini=0x4000dc14 <_dl_fini>, stack_end=0xbffffafc)
        at ../sysdeps/generic/libc-start.c:129

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-04-09 13:25 UTC] shawn at wnsi dot net
Appears to be resolved with the CVS version.  Thanks for your help.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 05:01:28 2024 UTC