-
Notifications
You must be signed in to change notification settings - Fork 2.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
1205 Lock wait timeout exceeded when trying to access a file on external storage before it's ready #19457
Comments
The problem seems to be that the file is not ready to be worked on when just scanned. If I do a |
This PR #19460 fixes scanFile() so that |
owncloud/gallery#387 (comment) |
@MorrisJobke - I think the problem remain. The locking mechanism should not lock up ownCloud because there is a problem accessing a file. |
We dont retry locks with transactional locking |
OK. It seems to be disabled in Utils\Scanner. In #10922 you say
But the scan aborting is apparently not the only problem here. Maybe the locking issue is not experienced during most scans as each file is accessed for a short amount of time, but it could still be triggered on large installations, no? |
I've updated the OP to make it easier to isolate the issue and with a collection of notes about what I've observed. It's not possible to force people to not use |
@icewind1991 any idea on what we can do to face this issue? THX |
From what I can tell this is caused by the preview generation triggering the file scanner while it's still in the transaction of the scanner causing a lock with the transactions |
There is something I don't understand. Here is the workflow:
How does 4) happen when the folder is locked? I've verified in the UI and you can't access the files while they're being scanned, yet, I'm able to generate previews. |
Is it only locking files for the user? |
Iirc the scanner only gets a read lock on the files, and generating previews only needs write access to the preview file |
Yes, so that should prevent the preview class from reading the files |
No, only a write lock prevents from reading |
OK, got it (https://en.wikipedia.org/wiki/Two-phase_locking)
So generating a preview, triggers another scan? If yes, is there any way to disable that? |
It triggers a scan on the preview file it generated |
OK, but the original scan locks |
Actually, all the files of the user are locked down (just tried to browse another folder). It shouldn't happen with a lock on a single folder. |
It's probably related the the transaction, not the lock How does the request fail when you try to browser? |
I get the spinner and it just waits for the request to complete before loading the list of files. I suspect that if this takes too long, then things start to fail, probably with error 1205 |
This seems to only happen when using the db locking backend |
Fix is here: #19654 |
Steps to reproduce
Now the scanner is going loopy. It tries a hundred time to access the newly uploaded file, but it's never ready (unlocked?). A possible race condition?
This time it's worse, the scanner keeps trying to access the external folder until the command is killed.
Notes
getPreview()
tries to access the file before it's stored in the cachescanFile
eventpostScanFile
things seem to work as expected, but some people have reported experiencing the same issue with itLogs
This is for the last operation, when always getting the folder.
Config
@icewind1991 @PVince81
The text was updated successfully, but these errors were encountered: