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

Question: Should treefmt specify a timeout when trying to open its boltdb cache? #408

Closed
jfly opened this issue Sep 14, 2024 · 2 comments
Closed

Comments

@jfly
Copy link
Collaborator

jfly commented Sep 14, 2024

While debugging #406, I found that if you have one treefmt process hung, the next treefmt process you start up will get hung on this call to bolt.Open. This behavior is documented by bbolt:

Please note that Bolt obtains a file lock on the data file so multiple
processes cannot open the same database at the same time. Opening an already
open Bolt database will cause it to hang until the other process closes it. To
prevent an indefinite wait you can pass a timeout option to the Open()
function:

db, err := bolt.Open("my.db", 0600, &bolt.Options{Timeout: 1 * time.Second})

Should treefmt specify a timeout here? Ideally treefmt would never hang, but it feels especially unfortunate that if it does hang, it'll cause other treefmt processes to hang.

@brianmcgee
Copy link
Member

Completely agree #409

@jfly
Copy link
Collaborator Author

jfly commented Sep 15, 2024

Closing, as @brianmcgee added a timeout in #409. Thanks!

@jfly jfly closed this as completed Sep 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants