Support » Plugin: Nginx Helper » Import timeout with Nginx Helper

  • ResolvedPlugin Contributor RavanH

    (@ravanh)


    Hi Rahul,

    I just ran into the following issue trying a 1.8MB WordPress XML import. At fist, the upload would fail so I added some parameters to nginx.conf among which client_max_body_size 16M… After this the upload went through but the actual import process would still take a very long time to finally result in in a blank page. Returning to the admin, I saw only a few of the over 300 posts where imported. I tried again but no improvement. In the php/slow logs I found several traces all looking like this:

    [20-Nov-2013 22:49:27]  [pool www] pid 9158
    script_filename = /var/www/scop.pro/htdocs/wp-admin/admin.php
    [0x00007f5eeccb8310] curl_exec() /var/www/scop.pro/htdocs/wp-includes/class-http.php:1249
    [0x00007f5eeccb8168] request() /var/www/scop.pro/htdocs/wp-includes/class-http.php:266
    [0x00007f5eeccb7f80] _dispatch_request() /var/www/scop.pro/htdocs/wp-includes/class-http.php:192
    [0x00007f5eeccb7e08] request() /var/www/scop.pro/htdocs/wp-includes/class-http.php:309
    [0x00007f5eeccb7ce0] get() /var/www/scop.pro/htdocs/wp-includes/http.php:179
    [0x00007f5eeccb7ba0] wp_remote_get() /var/www/scop.pro/htdocs/wp-content/plugins/nginx-helper/purger.php:230
    [0x00007f5eeccb7a10] _do_remote_get() /var/www/scop.pro/htdocs/wp-content/plugins/nginx-helper/purger.php:222
    [0x00007f5eeccb77a0] purgeUrl() /var/www/scop.pro/htdocs/wp-content/plugins/nginx-helper/purger.php:134
    [0x00007f5eeccb75c0] _purge_by_options() /var/www/scop.pro/htdocs/wp-content/plugins/nginx-helper/purger.php:115
    [0x00007fff586ea9c0] purgePost() unknown:0
    [0x00007f5eeccb73b8] call_user_func_array() /var/www/scop.pro/htdocs/wp-includes/plugin.php:429
    [0x00007f5eeccb7268] do_action() /var/www/scop.pro/htdocs/wp-includes/post.php:3314
    [0x00007f5eeccb6e18] wp_transition_post_status() /var/www/scop.pro/htdocs/wp-includes/post.php:2945
    [0x00007f5eeccb6b20] wp_insert_post() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:613
    [0x00007f5eeccb69b8] process_posts() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:116
    [0x00007f5eeccb68c8] import() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:92
    [0x00007fff586eac90] dispatch() unknown:0
    [0x00007f5eeccb66d8] call_user_func() /var/www/scop.pro/htdocs/wp-admin/admin.php:301

    And in the nginx error log:

    2013/11/20 22:54:05 [error] 9395#0: *3381 upstream timed out (110: Connection timed out) while reading upstream, client: xxxxx, server: xxxxx, request: "POST /wp-admin/admin.php?import=wordpress&step=2 HTTP/1.1", upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "xxxxx", referrer: "http://xxxxx/wp-admin/admin.php?import=wordpress&step=1&_wpnonce=487d5abb7d"

    Looking at the trace again, I noticed the wp_remote_get() from purger.php being mentioned. So I decided to switch off the purging option in Nginx Helper and attempt another import. And what do you know? This time the import completed without apparent hick-ups. All 300+ posts and attachments where imported.

    However, looking at the logs again, there still appeared a trace in the php slow log. This time it read:

    [20-Nov-2013 23:05:10]  [pool www] pid 9619
    script_filename = /var/www/scop.pro/htdocs/wp-admin/admin.php
    [0x00007f5eeccb7de8] curl_exec() /var/www/scop.pro/htdocs/wp-includes/class-http.php:1249
    [0x00007f5eeccb7c40] request() /var/www/scop.pro/htdocs/wp-includes/class-http.php:266
    [0x00007f5eeccb7a58] _dispatch_request() /var/www/scop.pro/htdocs/wp-includes/class-http.php:192
    [0x00007f5eeccb78f0] request() /var/www/scop.pro/htdocs/wp-includes/http.php:163
    [0x00007f5eeccb77a8] wp_remote_request() /var/www/scop.pro/htdocs/wp-content/plugins/xml-sitemap-feed/includes/core.php:943
    [0x00007f5eeccb75d8] ping() /var/www/scop.pro/htdocs/wp-content/plugins/xml-sitemap-feed/includes/core.php:970
    [0x00007fff586ea9c0] do_pings() unknown:0
    [0x00007f5eeccb73c0] call_user_func_array() /var/www/scop.pro/htdocs/wp-includes/plugin.php:429
    [0x00007f5eeccb7268] do_action() /var/www/scop.pro/htdocs/wp-includes/post.php:3312
    [0x00007f5eeccb6e18] wp_transition_post_status() /var/www/scop.pro/htdocs/wp-includes/post.php:2945
    [0x00007f5eeccb6b20] wp_insert_post() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:613
    [0x00007f5eeccb69b8] process_posts() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:116
    [0x00007f5eeccb68c8] import() /var/www/scop.pro/htdocs/wp-content/plugins/wordpress-importer/wordpress-importer.php:92
    [0x00007fff586eac90] dispatch() unknown:0
    [0x00007f5eeccb66d8] call_user_func() /var/www/scop.pro/htdocs/wp-admin/admin.php:301

    Notice te wp_remote_request() in there? It’s from my own plugin that pings Google on each new publication. I think it gets fired during import too… And so does the purging from Nginx Helper, I suppose?

    Any ideas on how to prevent this pinging and purging upon each post during an import?

    http://wordpress.org/plugins/nginx-helper/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Rahul Bansal

    (@rahul286)

    Nginx helper triggers “cache purging” when new content gets added. We did not take post-importing into consideration but it will take time to rectify codes.

    As a quick workaround, you can disable “cache purging” option in Nginx-helper (via settings) or disable Nginx-helper altogether during import.

    Even if you disable nginx-helper on a high traffic sites, it won’t affect caching. Nginx-helper only helps in “purging” cache. Nginx can create cached pages without Nginx-helper.

    Please let me know if I can be of any more help.

    Thanks for taking time to report this in details.

    Plugin Contributor RavanH

    (@ravanh)

    As a quick workaround, you can disable “cache purging” option in Nginx-helper (via settings) or disable Nginx-helper altogether during import.

    Yes, doing that so no problem during imports any more 🙂

    However, I have the feeling that the problem is really something going wrong on my VPS. You see, even when modifying one post, I get the same time-outs and see a similar trace in the slow log. I conclude even purgin one post is causing a time-out. 🙁

    Important note: there will never be a cached version of the post available because the site is not open to public yet, only to me as logged in admin. Might it be that a 404 response on a purge request by Nginx Helper can cause a timeout? Or is there some setting in my Nginx or PHP options that is causing issues with cURL()? Or did I miss a module or package during installation?

    Any thoughts are welcome as I’m running around in circles right now 😉

    Plugin Author Rahul Bansal

    (@rahul286)

    Make sure “Purge Archives:” is disabled.

    If you have too many posts then it might take some time to purge all archives. In that case, “Purge Cache” link in admin bar will be better.

    Plugin Contributor RavanH

    (@ravanh)

    OK, will have to test that. Thanks for the tip 🙂

    Meanwhile, I notice in the NGX Helper log (I temporarily activated the option) these kinds of intries:

    2013-11-23 21:34:46  | INFO | Purging homepage 'http://mydomain.tld/'
    2013-11-23 21:34:46  | INFO | - Purging URL | http://mydomain.tld/
    2013-11-23 21:34:49  | INFO | - - http://mydomain.tld/purge/ is currently not cached
    2013-11-23 21:34:50  | INFO | - - http://mydomain.tld/purge/feed/ *** PURGED ***
    2013-11-23 21:34:52  | INFO | - - http://mydomain.tld/purge/feed/atom/ *** PURGED ***
    2013-11-23 21:34:52  | INFO | - - http://mydomain.tld/purge/feed/rdf/ *** PURGED ***

    What is that /purge/ doing there? Is that an typo in logging or is the plugin really trying to purge nonexistent addresses like http://mydomain.tld/purge/feed/ etc?

    Plugin Author Rahul Bansal

    (@rahul286)

    /purge/ is for https://github.com/FRiCKLE/ngx_cache_purge/ module

    You will find “location /purge/ {}” block with directive to purge in nginx’s fastcgi-cache.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Import timeout with Nginx Helper’ is closed to new replies.