meeb / tubesync

Syncs YouTube channels and playlists to a locally hosted media server
GNU Affero General Public License v3.0
1.96k stars 123 forks source link

500 Internal Server Error when adding new channel #14

Closed brandonjones24 closed 3 years ago

brandonjones24 commented 3 years ago

I was able to successfully add 4 channels yesterday, but now I get a 500 error when attempting to add a new channel.

`172.18.0.1 - - [18/Dec/2020:08:19:36 -0500] "POST /source-add HTTP/1.1" 500 268 "http://192.168.7.238:4848/source-add?source_type=c&key=SousVideEverything&name=SousVideEverything&directory=SousVideEverything" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36"

172.18.0.1 - - [18/Dec/2020:08:19:36 -0500] "GET /favicon.ico HTTP/1.1" 302 0 "http://192.168.7.238:4848/source-add" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.101 Safari/537.36"

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.

Failed to retrieve tasks. Database unreachable.`

Running v 0.3.

I looked in my config folder for a log file but didnt see one - is there a better way to grab logs than via the CLI?

meeb commented 3 years ago

Interesting, that error is caused by an OperationalError raised due to being unable to lock the SQLite database most likely. Try restarting the container. You can also start TubeSync with -e TUBESYNC_DEBUG=True which should enable Django debugging so you'll get a stack trace in the browser, but that'll just probably show the error raised by an add_task style function. But I'm pretty sure that's just an issue locking the SQLite database. Are you on an esoteric platform or did you access the SQLite DB some other way at all?

Also check your SQLite database is OK, you can just open it from your host OS with $ sqlite3 db.sqlite3 from your config dir then execute a pragma integrity_check; command.

brandonjones24 commented 3 years ago

Thanks for the feedback.

I'm wondering if this is permissions related as my config is on an NFS share. Im a rookie with these permissions so I may move the config to a local drive to rule that out.

Im running docker on a mac mini.

brandonjones24 commented 3 years ago

I think this was permissions related. Not sure why it was intermittent but I will re-open should the issue resurface.

meeb commented 3 years ago

Just to follow up, yes, running an SQLite database on an NFS share is going to cause all sorts of lock issues with even a moderate write load. See "(5) Can multiple applications or multiple instances of the same application access a single database file at the same time?" on https://www.sqlite.org/faq.html

I would strongly suggest you move the config volume to the local machine you're running the container on to avoid this.