-
-
Notifications
You must be signed in to change notification settings - Fork 49
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
"Unhandled Exception, OperationalError: database is locked" error when --path is set to mounted Samba file server #52
Comments
Hmmmmm, can you try execute this code ? it's basically test to see if writing sqlite database with import sqlite3
con = sqlite3.connect("file:/mnt/W/some_test_folder_in_samba_dir/test.db?nolock=1", check_same_thread=False, uri=True)
con.execute('CREATE TABLE "test" ("name" TEXT NOT NULL);')
con.commit()
con.close() If it's still not working, maybe this answer could help https://stackoverflow.com/a/4695262. NOTE: You might need to backup your files before doing this. |
The sqlite test was successful:
It created an empty test.db file when sqlite3.connect was run. It increased to 8KB after the commit.
adding the My fstab line now looks like this: I rebooted my computer after saving that and downloads/updates seem to work just fine now:
I made sure to test a few comics (around ten) and there were no errors. Everything worked as it should. I did try searching for the error, but didn't think to include Thank you for the help though! |
I have made PR #53 about this, so users should not experience errors like this and do the Make sure you testing on new manga, not on existing manga and don't forget to remove Installation: python3 -m pip install git+https://github.com/mansuf/mangadex-downloader.git@744c4496156ea0bcd32fc2182215c13e5e1b1398 |
I don't mind testing it at all. I just removed After that, I attempted to download a new test manga to my Samba server with the existing install of mangadex-dl just to verify that it is still behaving the same way it was prior to adding
Next, I installed the fixed version via your command above, though I had to modify it because pip kept using the cached v.2.8.0 to reinstall itself. I needed to add
Success! The fix seems to have worked:
Folders/files created:
Since I attempted to download that one with the old version before the update, I also tested one that has never been on the Samba server.
Files/folders created:
Just to be thorough, I made sure that it could still download successfully to the local (OS) drive, though I didn't have any reason to think that it wouldn't:
Success was short lived... After a little more testing, I did come across a likely related issue. There is now a database lock error that only shows up for comics with an existing
It makes it further in the process now at least, instead of throwing an error right at the beginning of the download like it did before. |
The connection to sqlite3 database is opened up with lock enabled if the database file ( New installation: python3 -m pip install --no-cache-dir --upgrade git+https://github.com/mansuf/mangadex-downloader.git@0cb9bebbd87e828914b6791843c233bc3e5fee89 |
The update installed successfully:
Next, to test it quick, I deleted a chapter from one of the mangas that I used for previous testing so it would force a re-download and database update:
That worked perfectly, so I did a full run to update 54 MangaDex mangas. At least 75% of them converted the old database to the new database format. There were 9 of the 54 that downloaded at least 1 new chapter. There were no database lock errors during the entire run. I put the huge amount of output on 0bin in case you would like to verify, though please note that I used a bash script to parse a text list of mangas to download. Because of this, the mangadex-dl command itself is run from the script and is not output to the console and I have extra extra information from the script that outputs to the console. So, the database locking issue when saving to a Samba file server seems to now be completely fixed. Thank you for the time and effort you put in to fix this! I would have been happy enough with keeping the |
Nice, the PR has been merged and will be released soon in v2.8.1. Thank you for your contribution 💖 |
What happened ?
When trying to download new or update existing manga series that are located on my Samba file server, mangadex-dl throws the error "[ERROR] Unhandled exception, OperationalError: database is locked"
Console output from trying to update existing manga on Samba server:
Just to note - my Samba file server runs Ubuntu 18.04.6 LTS (GNU/Linux 4.15.0-204-generic x86_64)
Permissions for the directories that the above manga resides:
Linux Mint
ls -l
in /mnt/W/Manga/:drwxrwxrwx 2 x x 0 Feb 25 10:02 Manga
Linux Mint
ls -l
in /mnt/W/Manga/Manga/:drwxrwxrwx 2 x x 0 Feb 28 14:39 'Sometimes Even Reality Is a Lie!'
Ubuntu Server
ls -l
for the same directories:drwxr-sr-x 23 x x 4096 Feb 25 10:02 Manga
drwxr-sr-x 2 x x 4096 Feb 28 14:39 'Sometimes Even Reality Is a Lie!'
I have
create mask = 0777
set in smb.conf, so folder perms shouldn't be an issue here.After running mangadex-dl and getting the error, there is an empty
download.db
file (0B) that is created in the download directory:-rwxrwxrwx 1 x x 0 Feb 28 14:39 download.db
The above error only happens when setting the path to my file server. Saving locally still works perfectly fine. This was a local successful test (initial download):
Re-running the command (update):
What did you expect to happen ?
The expected result was for mangadex-dl to download/update comic series located on the file server like the local test above.
Versions 2.7.x would save to the file server without issue.
OS version
Linux Mint 20.3 Cinnamon
Full System Info
App version
Release v2.8.0
No development versions have been installed or used.
Installation origin
Other
Installation origin (other sources)
mangadex-dl was initially installed via PyPI 3 versions ago (v.2.7.0 I believe). Updated to v2.8.0 today via the 'mangadex-dl --update' command. Had to manually update 'requests-doh' and 'requests' via PIP after update.
Reproducible command
mangadex-dl -lang "en" --save-as "cbz" --path "/mnt/W/Manga/Manga/" --group "all" https://mangadex.org/title/de9e3b62-eac5-4c0a-917d-ffccad694381/sometimes-even-reality-is-a-lie
Additional context
mangadex-dl --update
console output from today, including PIP requirements errors that required manual updates:requests-doh
andrequests
threw an incompatibility error (version mismatch) during the update. I had to update them manually usingpython3 -m pip install --force-reinstall requests==2.28.1
andpython3 -m pip install --force-reinstall requests-doh==0.3.0
/etc/fstab entry in Linux Mint for the file server:
//192.168.1.93/ga7pesh2 /mnt/W cifs username=x,password=xxxxxxxxxx,uid=1000,gid=1000,iocharset=utf8,rw,file_mode=0777,dir_mode=0777,sec=ntlmv2,nounix 0 0
The text was updated successfully, but these errors were encountered: