tubesync icon indicating copy to clipboard operation
tubesync copied to clipboard

Error 500 while adding sources while busy

Open azukaar opened this issue 3 years ago • 5 comments

Wihle the server is busy indexing things (see logs here) adding a new source will end up in an error 500 with no additional infos in the logs.

image

azukaar avatar Feb 11 '22 15:02 azukaar

Can you set the env var TUBESYNC_DEBUG to True, restart the container and trigger the 500 error again please? That will output the error details and trace into the browser.

meeb avatar Feb 11 '22 15:02 meeb

Are you using database locks? Because if yes you should switch to finer grained locks, that is probable the reason behind most of the 500 errors and performance issues Tubesync is experimenting

azukaar avatar Feb 18 '22 17:02 azukaar

This issue is not database locks in Django, the issue is database locks by using SQLite. You have a background worker writing to the SQLite database, as well as trying to write via the web interface. The two simultaneous writes cause the 500 error in the front end. Generally the advice is to switch to a different back-end (I would suggest Postgres) to resolve this.

meeb avatar Feb 19 '22 01:02 meeb

I wasnt suggesting the issue is table locking in DJango, but SQLite supports table locking, and with a writing queue you can achieve concurrency (rather than writting directly in a concurrent way which does not work)

azukaar avatar Feb 21 '22 15:02 azukaar

I did look into this, but it's pretty difficult to implement. The same tables need to be written to by both the front end and background worker at times and there's no built-in way to handle a write queue other than to build one manually. Fully integrating a write queue into into Django would be a significant development undertaking.

meeb avatar Feb 22 '22 02:02 meeb