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

FileStore could panic on Close() while expiration in progress #365

Closed
kozlovic opened this issue Aug 9, 2017 · 0 comments · Fixed by #366
Closed

FileStore could panic on Close() while expiration in progress #365

kozlovic opened this issue Aug 9, 2017 · 0 comments · Fixed by #366
Assignees
Labels

Comments

@kozlovic
Copy link
Member

kozlovic commented Aug 9, 2017

Trace could look like this:

panic: failed to switch state from fileInUse to fileOpened for file "data_stores_063501733/foo/msgs.1.dat", state=5
goroutine 352 [running]:
github.com/nats-io/nats-streaming-server/stores.(*filesManager).unlockFile(0xc42016bd00, 0xc42016bec0)
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:990 +0x193
github.com/nats-io/nats-streaming-server/stores.(*FileMsgStore).doLockFiles(0xc420178b60, 0xc420082f00, 0x1, 0x0, 0xc420041d60)
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:1904 +0x304
github.com/nats-io/nats-streaming-server/stores.(*FileMsgStore).lockIndexFile(0xc420178b60, 0xc420082f00, 0xc420082f00, 0x4a190e)
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:1941 +0x48
github.com/nats-io/nats-streaming-server/stores.(*FileMsgStore).expireMsgs(0xc420178b60, 0x14d94bb50fd603cf, 0x5f5e100, 0x1)
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:2423 +0x2a1
github.com/nats-io/nats-streaming-server/stores.(*FileMsgStore).backgroundTasks(0xc420178b60)
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:2706 +0x6e4
created by github.com/nats-io/nats-streaming-server/stores.(*FileStore).newFileMsgStore
	/home/travis/gopath/src/github.com/nats-io/nats-streaming-server/stores/filestore.go:1804 +0x138f
@kozlovic kozlovic added the bug label Aug 9, 2017
@kozlovic kozlovic self-assigned this Aug 9, 2017
kozlovic added a commit that referenced this issue Aug 9, 2017
On store close, the files were closed before the expiration routine
was shutdown, which could cause that routine to still try to
open files that have been removed from the internal file manager.

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

Successfully merging a pull request may close this issue.

1 participant