Uploads fail, presumably because of MySQL timeout (shared hosting)

Hello everybody,

im running Nextcloud 11.0.3 in a shared hosting environment which runs quite well except for one problem: If an upload takes more than 60 seconds, it ends with an “internal server error”.
EDIT: The upload continues for longer than 60 seconds. The error occurs after the upload finishes. The uploaded file, unfortunately, doesn’t appear in the Nextcloud file interface.

The root cause for this is very probably the timeout of the MySQL server, which is set to 60 (while PHP execution time is 240).

Furthermore, at each failed attempt, nextcloud creates a log entry saying “2006 MySQL > server has gone away”.

The file gets uploaded completely (a file ending with .part exists on the server, invisible from within nextcloud), because of the timeout the rename of this *.part file seems to fail.

My hosting provider (www.goneo.de) doesn’t allow me to change the MySQL timeout…

So my questions are: Is there anything I can do about this? Is there anything Nextcould could do about this (= should I file a bug report)?

Why can’t nextcloud just open a new connection to the SQL server if the previous is gone?

Sure it is not a php issue?

Also, are you sure that the issue is related to time and not size of the file you upload?

I’m quite sure that it isn’t a php issue - it occurs if the upload takes more than 60 seconds. To clarify: the upload is not cancelled by the error. It finishes (taking more than 60 seconds), then the error occurs (saying that the SQL server went away).

If I log into my webspace by ssh, I find a file ending with .part with exactly the size of the uploaded file. This file doesn’t appear in nextcloud, but it is there on the server, proving that the file got uploaded correctly, just the rename didn’t work (presumably because it needs to change some entry in the database which has gone away after 60 seconds…)

And I’m also sure it is related to time - because it occurs with different file sizes depending on network bandwith. I have this problem usually when using the iOS client from mobile network. Because it’s slower. From my highspeed internet at home i’ve got the problem only with large files which take longer to upload.

So yes, I’m quite positive it’s caused by the MySQL timeout.

Couldn’t solve the problem yet. Updated to Nextcloud 12 and it’s still there.

I’m intending to write a bug report about this, but didn’t find the time to do that yet…

I am having the very same problem. I use Nextcloud 12.0.5 at a shared hosting provider. When I upload a 70MB file via the web interface, this takes 10 to 15 minutes, then I see the error message “internal server error” at the end. But the file itself has fully arrived at the file system on the server, just with a temporary file ending. The server log then shows the “…SQL server has gone away” error message.
I am pretty sure that my php settings are not the probem. I am nearly 100% sure now, because I convinded my hosting provider, to temorarily increase the mysql timeout setting, and then the upload worked fine. But now he returned to this “normal” value :frowning: This values is set to 6 minutes he says.
I have also tried to add the following line to config.php of the nextcloud installation:
‘dbdriveroptions’ => array(PDO::MYSQL_ATTR_INIT_COMMAND => ‘SET wait_timeout = 28800’)
But this did not help.
Question: Is there any existing solution to this? Do I need to open a new bug report?

I found a solution (or at least explanation) for my case: When I do the connection in the browser via http instead of https (as was my default), then uploading larger files works fine again.
I think this is not how it should be, I’ll try to file a bug report about this lateron.