Open emadrigal99 opened 4 years ago
If nothing else has changed, I have no idea, unfortunately. The extension uses the MW API to upload files. It may be worth to look into MW and DB server log files.
I work with emadrigal99 and want to chime in on this problem. First, thanks for the great extension to allow efficient file uploading.
We run MW 1.31.1 + PHP 7.2.11 + SimpleBatchUpload (1.5.0). We have also tried MW 1.31.6 + PHP 7.2.27 + SimpleBatchUpload 1.5.0. Both of these setups are deployed essentially using the official docker images from MW (https://github.com/wikimedia/mediawiki-docker) along with a docker image for MariaDB (10.4.2-MariaDB-1:10.4.2+maria~bionic-log). This is running on Rancher Kubernetes v2.3.2 with an inginx ingress and apache as the webserver in the mediawiki container. So there is some networking complexity with a proxy routing traffic to our mediawiki docker application.
The problem with server communication error seems to occur more frequently when uploading many files (20 or more) at once via drag & drop and tends to be more problematic on faster network speeds compared to a slower one. I suspect that either our server/deployment setup or the MW upload API cannot handle too many upload requests at once. No MW errors are thrown in the debug log and no glaring apache errors are seen when the communication problem happens.
I looked into the jQuery-File-Upload library which this extension is based on and see that there are several options to configure (https://github.com/blueimp/jQuery-File-Upload/wiki/Options). To throttle the upload, we have decided to only allow sequential uploads with the sequentialUploads parameter. I edited res/ext.SimpleBatchUpload.js around line 54 to include this new parameter ("sequentialUploads: true,":
... dropZone: $( '.fileupload-dropzone', container $ sequentialUploads: true, progressInterval: 100, ...
I tested this with 6 or so batches of uploads with 50 files each (MB size) and did not see the server communication error. So far in the past week in production, we have not had the server communication error show up. Perhaps there are other parameters to throttle the upload that could be tried to allow parallel uploads to a certain degree. We will stick with sequential uploads for now and report back if this continues to work.
Another thing to try would be to reactivate the console log at https://github.com/s7eph4n/SimpleBatchUpload/blob/master/res/ext.SimpleBatchUpload.js#L120 and see what it says.
So I turned on the console log as you suggested and was able to produce the error after commenting out my sequentialUploads:true setting. Here is the error I see in the console for the two files showing server communication error when trying to upload 50 images. Not sure how helpful this is:
Notice: Uncommitted DB writes (transaction from Wikimedia\Rdbms\Database::begin). in /var/www/html/includes/libs/rdbms/database/Database.php on line 4543
\n","status":200,"statusText":"parsererror"},"1":"parsererror","2":{}}
In addition, I also see many files with another error:
Could not store file "/tmp/phpaFwbHh" at "mwstore://local-backend/local-public/
These problems are worse when uploading very quickly on a 1 gigabit network in our office vs when I do it at home on a slower connection. We have not seen these errors after implementing the sequentialUploads:true setting.
Just wanted to provide a quick update that it has been two full weeks of using "sequentialUploads: true," in production and we have not seen any server communication problems during file uploads (sometimes with up to 30 images dragged and dropped into SimpleBatchUpload). We don't have any need to try other more limited parallel uploads settings.
Somebody else had this problem: https://www.mediawiki.org/wiki/Topic:Vttt2cw4ki309fjs
Our group has been using Extension:SimpleBatchUpload (1.5.0) extensively, but unfortunately we are running into an issue where files are uploaded but fail to be written as a row in the _fileData MW db table or saved to our Cargo db table. To the end user error appears as red highlighted text: ERROR: Server communication failed. We have checked our web server logs during uploads but cannot identify any server issues. Currently running MediaWiki 1.31.1, PHP 7.2.11 (apache2handler). Thank you for your help.