I’ve been experiencing this issue on and off over the last year. It only happens randomly about once every 2-3 months and is difficult to troubleshoot.
To preface, this is a WordPress Multisite deployment developed by Bitnami on Google Cloud Platform running three websites. One is basically a static landing page, the second is an e-commerce site for events ticketing, and the third is a private user portal mostly used for booking equipment. Specs are further down.
Symptoms:
Basically, when one of my admin users uploads some media (often just a photo or pdf) it causes the server to hang and become unresponsive to any type of connection (http, ssh, ftp, etc). Sometimes after about 30 minutes it will recover but occasionally I’ve had to remote shutdown the VM it’s running on which then breaks a few more things.
Evidence:
Every instance of this had something to do with media upload. In early instances, we thought it was file size as one of the PDFs that caused this was quite large. However, the most recent incident was only a 500kb jpg.
When the server hangs I can see on GCP monitoring that my disk throughput maxes out. My memory goes quite high as well (90%), but I can’t tell how far because a few of the monitoring tools stop reporting when this happens. This site doesn’t see all that much traffic so CPU utilization is typically below 5%, the highest peak in the last month was 30%. Memory is at about 50% utilization minimum, although after the last month it has slowly crept up to 70%. I’ve seen it peak out at 90% during one of these upload instances, and after ‘figuring things out’ it goes back down to 50%. The latest instance only dipped from 70% down to 60% for a few days and then came back to 70%. Watching the resource monitor (top) in CLI, I can see about 25% of the memory is going to mysql and another 22-25% is going to ruby processes. Is that how much they should be using? I noted my wordpress memory limit is currently set to 512MB, which is about 20% of the current RAM, is that insufficient for running a multisite (3 sites)?
After it recovered I pulled my error and access logs, the main thing I noted is in the access logs I was getting 504 errors on /wp-admin/async-upload.php and the /wp-admin/admin-ajax.php pages. The error logs didn’t say much other than some timeouts on /wp-admin/post-new.php which for all I know might be some earlier page sessions. I can post those logs if necessary.
I mean, the implication is not enough RAM, but why does the disk throughput get maxed out? What is it doing while hanging/unresponsive for half an hour and why would it be triggered by such a small media upload.
I have already requested support from bitnami for the deployment, but they’re at a loss, it appears to be WordPress issue. As far as I can tell, I don’t feel like it’s plugins either (despite that being the go-to answer) as there’s no evidence suggesting a plugin process is hanging.
Setup:
This is a Bitnami WordPress Multisite deployment on Google Cloud Platform. The VM specs are 1 vCPU (Intel Skylake), 2.75 GB memory, 20GB storage.
Wordpress details: (yes I’m aware a few things are out of date. I’m working on redeploying the whole thing and migrating to a new instance)
WordPress version 5.7
Wordpress memory limit 512MB
Server info: Apache
PHP version: 7.3.14
PHP post max size: 40 MB
PHP time limit: 300
PHP max input vars: 1000
cURL version: 7.68.0, OpenSSL/1.1.1d
MySQL version: 8.0.18
Max upload size: 40 MB
]]>Active plugins (29) (pulled from the largest of the three sites)
All in One SEO by All in One SEO Team – 4.0.17
Event Tickets Plus by The Events Calendar – 5.2.2.1
Event Tickets by The Events Calendar – 5.1.2.1
The Events Calendar PRO by The Events Calendar – 5.5.0
Salient WPBakery Page Builder by Michael M – WPBakery.com | Modified by ThemeNectar – 6.6.0
Salient Core by ThemeNectar – 1.8.1
Salient Nectar Slider by ThemeNectar – 1.7
Salient Shortcodes by ThemeNectar – 1.5
Salient Social by ThemeNectar – 1.2
Salient Widgets by ThemeNectar – 1.2
The Events Calendar: Filter Bar by The Events Calendar – 5.1.0
The Events Calendar by The Events Calendar – 5.5.0
WooCommerce Square by WooCommerce – 2.4.1 (update to version 2.5.3 is available)
WooCommerce Zapier by OM4 Software – 2.2.0
WooCommerce by Automattic – 5.1.0 (update to version 5.6.0 is available)
WP Mail SMTP by WPForms – 2.7.0
Zapier for WordPress by Zapier – 1.0.2
Envato Market by Envato – 2.0.6
Customizer Export/Import by The Beaver Builder Team – 0.9.2
Really Simple SSL by Really Simple Plugins – 4.0.15
Classic Editor by WordPress Contributors – 1.6
Smash Balloon Instagram Feed by Smash Balloon – 2.9
AMP by AMP Project Contributors – 2.0.11
All In One WP Security by Tips and Tricks HQ, Peter Petreski, Ruhul, Ivy – 4.4.8
All in One SEO by All in One SEO Team – 4.0.17
Google Analytics for WordPress by MonsterInsights by MonsterInsights – 7.17.0
Hide Admin Bar From Non-admins by Stranger Studios – 1.0
Jetpack by WordPress.com by Automattic – 9.5
WP-Optimize – Clean, Compress, Cache by David Anderson, Ruhani Rabin, Team Updraft – 3.1.8Inactive plugins (22) (might be active on other parts of the multisite)
Akismet Anti-Spam by Automattic – 4.1.9
BetterDocs by WPDeveloper – 1.7.2
Contact Form 7 by Takayuki Miyoshi – 5.4
Facebook for WooCommerce by Facebook – 2.3.5
Google Ads & Marketing by Kliken by Kliken – 1.0.7
Hello Dolly by Matt Mullenweg – 1.7.2
Import Users from CSV by Andrew Lima – 1.0.1
My Private Site by David Gewirtz – 3.0.3
Redirection by John Godley – 5.1.1
Remove Dashboard Access by Drew Jaynes (DrewAPicture) – 1.1.3
Salient Demo Importer by ThemeNectar – 1.3
Salient Home Slider by ThemeNectar – 1.4
Salient Portfolio by ThemeNectar – 1.7
Simple Local Avatars by Jake Goldman, 10up – 2.2.0
TablePress by Tobias B?thge – 1.13
TaxoPress by TaxoPress – 3.0.3
UpdraftPlus – Backup/Restore by UpdraftPlus.Com, DavidAnderson – 1.16.50
User Meta Lite by Khaled Hossain – 2.3
WordPress Importer by wordpressdotorg – 0.7
WP Crontrol by John Blackbourn & crontributors – 1.10.0
WPForms Lite by WPForms – 1.6.5`
I need to pass some additional parameters with the async-upload
Ajax request, I was able to use the global variable uploader
as below:
uploader.settings.multipart_params.my_param = 'somevalue'
However, this only works under /wp-admin/media-new.php
not elsewhere (e.g: under wp-admin/upload.php
). Is there any alternative way to use?
I’m developing a WordPress site locally using Xampp on Windows 7, using the latest version of Polylang (2.3.7) and WordPress (4.9.6). I’ve built my own theme based on underscores.
For a custom post type I’ve made custom meta boxes, including an ajax image upload leveraging the built in async-upload.php of WordPress:
PHP:
$data = array(
'upload_url' => admin_url('async-upload.php'),
'ajax_url' => admin_url('admin-ajax.php'),
'nonce' => wp_create_nonce('media-form')
);
wp_localize_script( $this->name . '-meta', 'flyer_ajax_config', $data );
HTML:
<fieldset class="pelske-event-flyer">
<legend>Upload flyer</legend>
<label for="event-flyer">Upload .jpg</label>
<input type="file" id="event-flyer-file" name="async-upload" size="25" />
<input type="hidden" name="image_id">
<input type="hidden" name="action" value="image_submission">
</fieldset>
jQuery:
$('#event-flyer-file').on('change', function(e){
e.preventDefault();
var $imgPreview = $('#event-flyer-preview');
var $imgFile = $('#event-flyer-file');
var $imgId = $('.pelske-event-flyer [name="image_id"]');
var formData = new FormData();
formData.append('action', 'upload-attachment');
formData.append('async-upload', $imgFile[0].files[0]);
formData.append('name', $imgFile[0].files[0].name);
formData.append('_wpnonce', flyer_ajax_config.nonce);
$.ajax({
url: flyer_ajax_config.upload_url,
data: formData,
processData: false,
contentType: false,
dataType: 'json',
type: 'POST',
success: function(resp) {
console.log(resp);
},
error: function(resp) {
console.log(resp);
}
});
});
This all works fine, I get a succes response and the image is indeed uploaded to my uploads folder. However it throws the following error:
load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,svg-painter,wp-auth-check&ver=4.9.6:8
Uncaught TypeError: a.split is not a function
at Object.unserialize (load-scripts.php?c=1&load[]=hoverIntent,common,admin-bar,heartbeat,autosave,suggest,wp-ajax-response,jquery-color,wp-lists,jquery-ui-core,jquery-ui-widget,j&load[]=query-ui-mouse,jquery-ui-sortable,postbox,jquery-ui-position,jquery-ui-menu,wp-a11y,jquery-ui-autocomplete,tags-suggest,tags-box&load[]=,underscore,word-count,post,svg-painter,wp-auth-check&ver=4.9.6:8)
at HTMLDocument.<anonymous> (post.min.js?ver=2.3.7:1)
at HTMLDocument.dispatch (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:2117)
at HTMLDocument.r.handle (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:1996)
at Object.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:2085)
at Object.a.event.trigger (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:4817)
at y (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:4023)
at XMLHttpRequest.c (load-scripts.php?c=1&load[]=jquery-core,jquery-migrate,utils&ver=4.9.6:formatted:4228)
When I disable Polylang the error disappears. The only other plugin I have installed is Yoast SEO. Diving into the inspector in Chrome and prettifying load-scripts.php the variable split is being applied to does appear to be a string, so I am thoroughly confused…
Can anyone help me out?
Thanks in advance.
POST https://MY_SITE.com.br/wp-admin/async-upload.php 500 (Internal Server Error)
I checked the directory on host and the file is there, but it doesn’t appear on WordPress media library.
My php.ini settings:
max_execution_time 1200
max_file_uploads 20
max_input_time 3600
memory_limit 512M
Script timed out before returning headers: async-upload.php, referer: wp-admin/post.php?post=75064&action=edit&message=1
Script timed out before returning headers: async-upload.php, referer: wp-admin/post.php?post=75262&action=edit&message=10
Script timed out before returning headers: async-upload.php, referer: wp-admin/post.php?post=75269&action=edit&message=6
and were all over the place.
I’m not sure if these time outs occurred when the admin-side post pages were loaded or saved, but the upshot is that the posts ended up losing a lot of data in the process. I have a number of meta boxes set up on each of these post pages that are populated with saved custom field values (meta). When a post is saved, I’ve defined a custom save function that checks for current values that should be saved and those that should be deleted based on what is submitted through the WP form within these custom meta boxes I’ve defined. Somewhere in the load/save process while my editors were going to town, it seems that the values that should have been present in my custom meta boxes weren’t there and so they all got deleted when my editors saved the posts.
I’ve verified that this condition doesn’t occur at any time other than when the server CPU is capping (at 100%) and apparently it also only happens when the above php errors are being reported.
Thus, in order to debug my problem any further, I need to know what happens when the async-upload.php file terminates early because of a time out. Rather than go digging into the core WP code, I thought I’d ask here first to see if an expert could give me some information that I didn’t have, as I know that digging into the core WP files and trying to figure out what they’re doing is probably going to take me (an admitted non-expert) a bundle of time.
As this error is only happening on the admin side and also only when the server CPU is capping, I’m not going to leave a link for my site.
]]>Posting with wp-user-frontend works excellent, but JS-upload in the Add Media (its a POST to /wp-admin/async-upload.php) fails with an ‘302 Found’ and no response Date (in firebug its red)
I tried several solutions:
function.php send_headers with
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
and in .htaccess
Header append x-frame-options “ALLOW-FROM https://example.com”
(example.com is my domain)
and
Header append x-frame-options "ALLOW-FROM *"
https://codex.www.ads-software.com/Create_A_Network
https://www.ads-software.com/extend/plugins/wp-user-frontend/
https://codex.www.ads-software.com/Media_Add_New_Screen
I am using WordPress 3.4.1, and until yesterday everything was working fine. Today, I tried to upload an image using both the browser uploader and the multi-file uploader, and after the progress bar reached 100% it just got stuck on “Crunching”. The name of the file also disappears, and when I inspect the Network section it says that the async-upload.php file fails with a 500 Internal Server error.
Everything was working fine yesterday, with my same plugins and settings. I tried deactivating all my plugins, and it still appears to be broken. Can anyone give me some advice on how to get it working again? Uploading thumbnail images through FTP is no fun.
Thank you very much for all your help.
]]>We have two wordpress installations for dev and production we access using the same credential.
If we connect to the dev installation via proxy and we load a picture using the featured images box the images is uploaded to the production installation.
Cheers,
PennyKing
<IfModule mod_security.c>
<Files async-upload.php>
SecFilterEngine Off
SecFilterScanPOST Off
</Files>
</IfModule>
If i don’t enable aapass with the fix above, all works correctly but if i active aapass, it returns me old upload image error.
Any suggestion? Thanks
https://www.ads-software.com/extend/plugins/askapache-password-protect/
]]>