File Upload error when uploading multiple files at once

Hi, when I upload multiple images at one (eg. 40 images) i am getting an error and the upload stops.

Screenshot 2020-03-21 10.11.43

how can i fix this?
thanks!

But can you upload the same images without errors if you upload them in chunks (like 10 or 20 at a time)?

Looks like it doesn’t happen every time.
And not the same file every time either.
I’m uploading the files via FTP now. I have now made several attempts, but can’t see a fixed pattern. After some intensive testing I would say that the problem only occurs every 5th time. This is ok for me for now. Maybe I’m not the only one and others also report such a problem … let’s see.

What I find irritating is the error message. Can’t remember having seen that before. Do you get any more information in your PHP error logs or in the browser console when this happens?

I see REQUEST_BODY_FILE error. Do you using nginx?
I searched a little, could there be a problem with nginx settings?

@ahmetbora Thanks. I don’t know if nginx is running. Have to ask my provider …

In Chrome console i get this error during an upload that failed:

PHP Error Log says

[21-Mar-2020 16:34:45 Europe/Berlin] PHP Warning:  REQUEST_BODY_FILE: open('/dev/shm/php.140101761275648') failed: No such file or directory (2) in Unknown on line 0

I asking my provider for help … will keep you updated.

Maybe related to some memory issues? https://superuser.com/questions/45342/when-should-i-use-dev-shm-and-when-should-i-use-tmp

Hi @texnixe and @ahmetbora – thanks for your help. My provider (UDMedia) told me now, that he pushed a fix to his server to solve this problem. Yeah :slight_smile:

Great! Do you know what the issue was?

Let me quote the support-answer in german:

[…] das hat nichts mit dem CMS zu tun, sondern mit unserem PHP-FPM Handler Module für Apache. Normalerweise startet ein HTTP-Request auf eine PHP-Datei sofort eine Instanz des PHP-Backends und die Daten werden vom Webserver-Prozess einfach hin- und her kopiert. Die Anzahl an PHP-Prozessen ist aber pro Account limitiert um Attacken und allgemein vor Überlast zu schützen. Zudem ist die maximale Laufzeit ebenfalls limitiert. Nun ergibt sich hier ein Problem beim Upload: Wenn die Bandbreite beim Upload gering ist, dauert der Upload sehr lange und der PHP-Prozess terminiert vorzeitig. Somit auch der Upload.

Daher schreibt das Apache Module bei multipart/form-data Requests (Uploads) den gesamten Request in eine temporäre Datei und startet erst anschließend den PHP-Prozess und übergibt über den Socket den Filedescriptor zu dieser Datei (fd passing).

Soweit zur Technik.

Ich vermute nun das Problem ist dass diese temporäre Datei bei einer hohen Anzahl an gleichzeitiger Uploads nicht einzigartig genug war und sich zwei (oder mehrer) Requests überschrieben haben. D.h. ich habe nun neben der Thread ID noch einen zufälligen Teil zum Dateinamen hinzugefügt. Bin aber trotzdem nicht ganz sicher ob es das war.

Short version: Too many simultaneous uploads may overlap. Therefore, he added a random number on the server in addition to the thread ID. It was a problem of the server, not Kirby.