WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] WordPress update fails, curl_exec hangs upon finishing download (3 posts)

  1. Nevma
    Member
    Posted 1 year ago #

    Hi,

    We have a server with many WordPress installations. The updates there always worked correctly. Suddenly, all updates of major (!) plugins (like Jetpack, WPML) including the WordPress core upgrade itself fail at:

    Downloading update from http://...

    Now this does not seem to be a regular update issue:

    1. The PHP memory limit is high enough (256MB). Also the memory has been sufficient until now.
    2. The access writes are OK. We can check them via SSH. And many other minor plugins can be updated without problems.
    3. We tried the PHP5 AddType directive as suggested here, but the only result was that PHP broke terribly.
    4. The update file is downloaded alright each time. We can see it in the system tmp folder. It is there in full size, but with "tmp" exception. Also (as I will explain later) the process has not got to the point of unpacking it yet, so it is not an unzip problem (and, remember, the minor plugins are updated correctly, so unzip works for them).
    5. This happens in all our WordPress installations in this server regardless of their version. Ranging from 2.9 to 3.5.
    6. We do not believe that our IP is somewhere blacklisted. We can wget the files from the console and (as mentioned above) we see the temporary files being downloaded. Also (again) minor plugins are updated correctly.

    So the problem gets a little crazy. So we start hacking into the core code of WordPress. We put debugging messages through every single step of the update process and we get down to this:

    The process gets to a point where (in file /wp-includes/class-http.php, around line 1140) it executes a PHP curl command to download the update. It does a curl_init, then many curl_setopt calls and, finally a curl_exec.

    Well this curl_exec never returns. Really!

    Then we try to debug the curl download so, after several tries, we add a progress callback to it like this:

    curl_setopt($handle, CURLOPT_NOPROGRESS, FALSE);
    curl_setopt( $handle, CURLOPT_PROGRESSFUNCTION, function ( $resource, $file_descriptor, $length ) {
        echo $length . '<br/>';
    });

    And then, after this addition, the curl_exec finishes fine and the upgrade goes on successfully!

    Any ideas?

  2. Nevma
    Member
    Posted 1 year ago #

    PHP version 5.3.18
    Curl version 7.24.0

  3. Nevma
    Member
    Posted 1 year ago #

    The solution came from out server administrators. It seems that the Apache TimeOut option was low (https://httpd.apache.org/docs/2.0/mod/core.html#TimeOut). The problem is that neither curl nor the WordPress code was in any way notified for this by some kind of error. So, we were left searching in the wild.

Topic Closed

This topic has been closed to new replies.

About this Topic