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

bug: 'database is locked' error after some time without calling the API #71

Merged
merged 4 commits into from
Sep 7, 2023

Conversation

lucasmenendez
Copy link
Collaborator

@lucasmenendez lucasmenendez commented Aug 30, 2023

After a period of inactivity, the API returns an internal server error caused by a database error: error saving the census on the database error="database is locked".

After a few requests with this error, the API starts working without any issue.

At the moment we do not know how much time of inactivity is required to reproduce the error.

Original trace:

2023-08-29T10:20:00.095Z ERR api/censuses.go:188 > error saving the census on the database error="database is locked"
2023-08-29T10:20:10.521Z ERR api/censuses.go:188 > error saving the census on the database error="database is locked"
2023-08-29T10:20:17.18Z ERR api/censuses.go:188 > error saving the census on the database error="database is locked"
2023-08-29T10:23:17.608Z ERR api/censuses.go:188 > error saving the census on the database error="database is locked"

We found some references about SQLite database is locked error on the official documentation of the SQL driver that we use (mattn/go-sqlite3) and in its issues mattn/go-sqlite3#274 (comment).

@lucasmenendez lucasmenendez added the bug Something isn't working label Aug 30, 2023
@lucasmenendez lucasmenendez self-assigned this Aug 30, 2023
@lucasmenendez lucasmenendez linked an issue Aug 30, 2023 that may be closed by this pull request
@lucasmenendez lucasmenendez added this to the v0.2.0 milestone Aug 30, 2023
@lucasmenendez
Copy link
Collaborator Author

@lucasmenendez lucasmenendez marked this pull request as ready for review September 6, 2023 16:37
Copy link
Contributor

@mvdan mvdan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe squash the commits, since you ended up just copying what the indexer does

service/holder_scanner_test.go Outdated Show resolved Hide resolved
service/holder_scanner_test.go Outdated Show resolved Hide resolved
api/censuses.go Outdated Show resolved Hide resolved
@lucasmenendez lucasmenendez merged commit b63ffe8 into main Sep 7, 2023
6 checks passed
@lucasmenendez lucasmenendez deleted the bug/database_locked branch September 7, 2023 17:13
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

Successfully merging this pull request may close these issues.

bug: issue when service has not been used for a while
2 participants