Skip to content

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

@leonardo-caggianelli

Description

@leonardo-caggianelli

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions