php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12018 curl_exec() kills script
Submitted: 2001-07-10 11:45 UTC Modified: 2001-07-18 06:46 UTC
From: colin at easydns dot com Assigned: stas (profile)
Status: Closed Package: cURL related
PHP Version: 4.0.6 OS: Debian (2.4.5)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
25 + 33 = ?
Subscribe to this entry?

 
 [2001-07-10 11:45 UTC] colin at easydns dot com
Every script I have that uses cURL never makes it past the curl_exec() line.  Apache just seems to die at that point.  Apache error log shows:

[Tue Jul 10 11:43:40 2001] [notice] child pid 27769 exit signal Segmentation fault (11)
[Tue Jul 10 11:43:40 2001] [notice] child pid 27768 exit signal Segmentation fault (11)

This is with PHP-4.0.6 Release, and cURL 7.8 final, on Debian (2.4.5-pre3).  cURL is configured:

    configure --with-ssl

PHP is:

    ./configure \
    --with-mysql=/usr/local \
    --with-apxs=/usr/local/apache/bin/apxs \
    --enable-track-vars \
    --disable-magic-quotes \
    --disable-debug \
    --enable-ftp \
    --with-gettext \
    --with-xml \
    --with-dom \
    --enable-wddx \
    --with-curl \
    --with-pgsql \
    --with-zlib \
    --enable-versioning \
    --enable-sockets \
    --with-openssl \
    --with-snmp \
    --with-mcrypt

I was able to determine the following:

I have one script that cURL-posts to another URL on the same server, and that script then cURL-posts to a URL outside.  In this case, the first script dies.

I have another script that directly cURL-posts to the outside URL.  This script works fine.

So it only seems to die if there are 2 cURL processes running on the same server simultaneously (?).  This would explain the 2 segfaults in the Apache log.

Let me know what other info I can give to help track down the problem.

- Colin

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-07-10 11:49 UTC] cmv@php.net
Okay,

I recompile PHP with --enable-debug, so I could get a backtrace.

Now the problem goes away. :/

This is good for me, but must indicate something weird in the cURL implementation, no?

- Colin
 [2001-07-15 19:17 UTC] colin at easydns dot com
After a few patches from Sterling (thanks), I no longer see the memory leak messages in the apache error log, and all the curl_exec() calls seem to work okay.

But:

The setting of CURLOPT_HEADER is treated oddly.  Specifically, when you ask for no HTTP header, it returns one.  When you do ask for one, it returns one, with each line duplicated.

To see what I mean go here:

http://devel.easydns.com/~cmv/curltest/phpnet.php?header=0
http://devel.easydns.com/~cmv/curltest/phpnet.php?header=1

The value of $header is passed to curl_setopt($ch, CURLOPT_HEADER, $header).  You can see the duplicatation.

Sterling has emailed me that he won't be able to look at this for a week or more ... so I'm hoping one of the other developers who is familiar with this extension can take a quick boo and see if it's an easy fix.  My C is limited, but I'm wondering if an extra condition is needed to the if statement on line 378 of curl.c ... something like:

    int get_header;
    curl_easy_getinfo(ch->cp, option, &get_header);
    if (get_header && 
      ch->handlers->write->method == PHP_CURL_RETURN) {
        ...


- Colin
 [2001-07-17 07:13 UTC] stas@php.net
I think I know what's the problem.
 [2001-07-18 06:46 UTC] stas@php.net
Fix committed to the CVS
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 05:01:29 2024 UTC