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] prest crashes if user set a cache directory that does not exists in filesystem #858

Closed
moinologics opened this issue Dec 28, 2023 · 2 comments · Fixed by #860
Closed

Comments

@moinologics
Copy link

moinologics commented Dec 28, 2023

steps to reproduce

  • pull the latest docker image
  • enable cache & set some cache directory (which not exists in filesystem, for example /some/non-existing/path) in prest.toml
  • start the server
  • hit the http endpoint (first time it will show error)

you will see like this in response

PANIC: runtime error: invalid memory address or nil pointer dereference
goroutine 33 [running]:
github.com/urfave/negroni/v3.(*Recovery).ServeHTTP.func1()
	/home/runner/go/pkg/mod/github.com/urfave/negroni/v3@v3.0.0/recovery.go:168 +0x140
panic({0x51c020, 0x9c3c10})
	/opt/hostedtoolcache/go/1.20.8/x64/src/runtime/panic.go:884 +0x1f4
github.com/tidwall/buntdb.(*Tx).lock(0x400022a440?)
	/home/runner/go/pkg/mod/github.com/tidwall/buntdb@v1.3.0/buntdb.go:1140 +0x24

when you hit url second time, it will not crash but will create cache files in /app instead of creating cache path setted by user in prest.toml file

@arxdsilva
Copy link
Member

@moinologics I've raised a PR for a potential solution, but could you also provide the full stack trace of the panic error?

Thanks

@arxdsilva
Copy link
Member

arxdsilva commented Jan 1, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants