-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Automatically Set MySQL/MariaDB Session Transaction Isolation to "Read Committed" for Upon Reconnection #17947
Comments
server/lib/private/DB/Connection.php Line 151 in 0d778fc
I think the above code should do that. Does not work for you? 🤔 |
Hmm, that's interesting... This appears to be a separate root cause that was not actually affected by this bug; we thought it was related to seeing "Failed to send QUERY packet" in the logs, but it's actually separate. It was not clear from the logs that Nextcloud is actually able to recover from "Failed to send QUERY packet" and it is not fatal.
<?xml version="1.0" encoding="utf-8"?>
<d:error xmlns:d="DAV:" xmlns:s="http://sabredav.org/ns">
<s:exception>Sabre\DAV\Exception\Forbidden</s:exception>
<s:message/>
</d:error>
{
"reqId": "1UhRDgTUW4Mc4UDd6DLM",
"level": 3,
"time": "2019-11-14T05:21:56+00:00",
"remoteAddr": "123.45.67.123",
"user": "TestUser",
"app": "PHP",
"method": "MOVE",
"url": "/remote.php/dav/uploads/TestUser/web-file-upload-7799eafe3dcfe3ec9bb691f16742b576-1573707497231/.file",
"message": "Error while sending QUERY packet. PID=83 at /var/www/html/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOConnection.php#107",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/78.0.3904.97 Safari/537.36",
"version": "16.0.6.1"
}
|
Thanks for sharing the log message. I have a guess ;) Probably the database connection is lost and we retry a reconnect. The |
@kesselb I appreciate the PR... but it looks like there's actually one other log message I missed that may make my original log message a red herring. I'm in the process of debugging it further... but it looks like the 403 might actually be coming from this error:
So far, it looks like this comes from If this is the case, then the isolation level may or may not be the root cause that's impacting our chunked uploads. |
@kesselb I rewrote this ticket to cover the bug you believe you've found. I'm writing up a separate ticket for what appears to be to blame for the issues we're now seeing with chunked uploads and 403 errors. For verifying that the bug in this ticket exists, and verifying that your fix works, I would think the following sequence would work:
|
Ok, so, the root cause for our most-recently chunked upload failures is coming from #17980. We thought it was directly related to the transaction isolation because we made the mistake of assuming that the issue would appear for all large uploads when in fact it only appears for uploads exactly greater than 620 MB. One of our test files is 617 MB and that happened to be the file we were testing with after adjusting the isolation level. The user who reported the issue was testing with a file that was 1.5 GB. |
Fix is at #18227 |
I found this issue trying to research whether/why I need to set server/lib/private/DB/Connection.php Line 151 in 0d778fc
master or the latest releases. Does anyone know why that is?
I assume there must be a reason why it can't be done this way? Is there any way I can use |
|
@kesselb Thank you -- I had read that, but the fact that the docs still state under "Database Requirements" that I'll leave my global transaction isolation level set to Thank you very much! |
Is your feature request related to a problem? Please describe.
As someone responsible for deploying and maintaining our Nextcloud deployment, I'd like it if Nextcloud automatically set the transaction isolation level to "READ COMMITTED" when reconnecting to the database during a long-running request so that I don't have to set it at the server level, affecting all other applications using the same application server.
Describe the solution you'd like
It appears that Nextcloud automatically sets the transaction isolation level to "Read Committed" whenever Nextcloud opens a database connection to MySQL or MariaDB, but it doesn't restore this if the connection dies and Nextcloud has to reconnect.
This transaction isolation level is necessary to ensure that the transaction isolation level is as it needs to be for Nextcloud not to deadlock the DB on file operations.
Describe alternatives you've considered
Change the global default value for
transaction_isolation
on the MySQL server per the installation docs, and then either:Neither option is great.
The text was updated successfully, but these errors were encountered: