Skip to content
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

Failed to begin database transaction - driver: bad connection #629

Closed
leonardo-caggianelli opened this issue Jan 11, 2022 · 1 comment
Closed
Labels
bug Something isn't working

Comments

@leonardo-caggianelli
Copy link

Describe the bug
After a long media processing operation (e.g. processing an .mp4 file for ~ 10 minutes), when the process is done and photoview attempts to perform an INSERT with the result, it will throw this error:

photoview | [mysql] 2022/01/11 09:12:54 connection.go:173: bad connection
photoview | 2022/01/11 09:12:54 ERROR: Failed to begin database transaction: failed to process photo (/photos/2017/04/30/gopro/GOPR0588.MP4): failed to insert video thumbnail image into database (GOPR0588.MP4): driver: bad connection

To Reproduce
Start a new scan with a long media processing operation, after several minutes, when the media processing is complete, photoview will attempt to perform an INSERT and will show the bad connection error.

Expected behavior
Connection shouldn't go bad or should be handled and restored.

Screenshots
Schermata 2022-01-11 alle 10 13 36

Your environment:

  • Are you using Docker? Yes
  • Database: MariaDB 10.5.13
  • Browser: Chrome
  • Version: 2.3.9
  • Hardware: Raspberry Pi 3
  • OS: Raspbian ARM64

Additional context
I found a possible fix here, which has been cherry picked from other projects as well:

go-sql-driver/mysql#934

Not sure if it is applicable since I know very little about Go. I think it might be related to the speed of the media processing, on my Raspberry Pi there are several videos which takes a while to process and that might cause an unhandled timeout in the database connection (just trying to guess).

Thank you!

@leonardo-caggianelli leonardo-caggianelli added the bug Something isn't working label Jan 11, 2022
@viktorstrate
Copy link
Member

I believe that the version of go-sql-driver/mysql used for the project contains that fix.
As they suggest in the PR you referenced, you can try to increase the wait_timeout of your database1.
I think that's the best option if possible, rather than making modifications to the codebase of Photoview.

I'll close for now, but please make a comment if you think I should reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants