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

js: msgblock close fix #2121

Merged
merged 1 commit into from
Apr 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion server/filestore.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,7 @@ type msgBlock struct {
fch chan struct{}
qch chan struct{}
lchk [8]byte
closed bool
}

// Write through caching layer that is also used on loading messages.
Expand Down Expand Up @@ -3176,9 +3177,10 @@ func (mb *msgBlock) close(sync bool) {
mb.mu.Lock()
defer mb.mu.Unlock()

if mb.qch == nil {
if mb.closed {
return
}
mb.closed = true

// Close cache
mb.clearCacheAndOffset()
Expand Down
5 changes: 3 additions & 2 deletions server/test_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -182,13 +182,14 @@ func (c *cluster) shutdown() {
return
}
for i, s := range c.servers {
sd := s.StoreDir()
s.Shutdown()
if cf := c.opts[i].ConfigFile; cf != "" {
os.RemoveAll(cf)
}
if sd := s.StoreDir(); sd != "" {
if sd != _EMPTY_ {
os.RemoveAll(sd)
}
s.Shutdown()
}
}

Expand Down