-
Notifications
You must be signed in to change notification settings - Fork 74
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
SQLite errors when copying files to file system -- series/files get stuck in the drop folder #866
Comments
I appreciate the research. The short version is that SQLite has issues dealing with concurrency, and that's a specifc repeatable case where concurrent transactions are likely. |
So, sounds like the guidance for now is one or more of:
Docs say no new MySQL/MariaDB, so that isn't a possible solution. (The web UI allows it, but testing with a MariaDB container failed to connect, so I'm assuming the docs are right.) Testing with the shoko config directory moved to the SSD looks like it's avoiding the issue. (At least until something hammers the SSD. :) ) If you want to add fault tolerance, you may find something like Polly (https://github.com/App-vNext/Polly) helpful. While most people use it to deal with network issues, here's an example with SQL Server https://scottdorman.blog/2020/09/13/database-resiliency-with-polly/. Might make it easier to set up a policy that certain types of errors wait and retry while others respond differently. Their GitHub page doesn't mention .NET Core 3.x, but CHANGELOG.md does in the latest update. If this was NodeJS, I'd be digging into the code to offer a pull request. With .NET, all I can do is throw out ideas. |
While Polly at a glance might work, it would be just as easy to add a retry mechanism in place. As for connecting to MSSQL/MySql(+variants), it should still be possible, as I use MariaDB myself, running in a docker container. |
Another workaround option. Create the shoko config directory on a different device that is low risk for i/o contention. If you want to make it available over a Samba share, https://unix.stackexchange.com/questions/5120/how-do-you-make-samba-follow-symlink-outside-the-shared-path (probably the second set of smb.conf options in the top answer unless you're years out of date). |
VERSION INFORMATION
Server Version: Linux Docker image daily (January 9, 2021, at 3:11 a.m. US Eastern time) Digest:sha256:a45b9630aa08a58e0ccbffd1302497bb08220bda756a83abc8478a9271ac2a87
Desktop Version: n/a, this is a server issue, but I pulled a daily desktop on January 9, 2021, at ~10:00 a.m. (US Eastern time).
LOG FILE
2021-01-12.log
DESCRIPTION
SQLite/SQLite library throws errors when Shoko is working while other activity is happening on the file system.
Examples of other activity include copying files into the drop folder, running
rm -R
on a deep directory tree from the Linux command line.This seems to cause files/series to get stuck in the drop folder.
Workaround
Pause all queues.
Copy files. Wait until finished.
Restart all queues.
Speculation
Root cause seems to be one or more of:
If there is no other solution, maybe wait to start processing queues until no new files/folders in watched folders for a period of time. ("A period of time" could be long if someone is moving a 10+GB movie, so maybe detect file size changes if possible.)
That doesn't resolve the
rm -R
case, but I'll acknowledge that's rare.STEPS TO REPRODUCE
Server setup notes
Ubuntu 20.04.1, last updated <7 days before posting.
Data is on a mirrored BTRFS volume (2x 6 TB Ironwolf CMR drives).
sudo docker pull shokoanime:server/daily reports I have the latest image as of posting.
Data shared via Samba to a Windows machine.
Steps
SQLite Error Example
Could not MOVE Error Example
Note that I'm running the default setup, which Desktop claims is using the Legacy renamer, though the error suggests it's using the group aware renamer. If I delete files stuck in the drop folder, run import and remove missing files, then switch to the group aware renamer and copy data, it will fix the issue (and seems to get about the same result after manually renaming files moved).
The text was updated successfully, but these errors were encountered: