DB.Close(): funlock error
windows 10 x64 golang 1.9.1 and 1.8.4 bbolt v1.3.1-coreos.2(no problem with v1.3.1-coreos.1)
error when calling bolt.DB.Close(): 2017/10/10 11:05:57 bolt.Close(): funlock error: The segment is already unlocked.
coreos/bbolt#35(Support no timeout locks on db files) lead to this issue
It looks like this patch (my mistake) locked the wrong file descriptor.
Before the patch the file descriptor used was based on db.lockfile:
err := lockFileEx(syscall.Handle(db.lockfile.Fd()), flag, 0, 1, 0, &syscall.Overlapped{})
The patch factored it out of the loop, but based on db.file:
fd := db.file.Fd()
...
err := lockFileEx(syscall.Handle(fd), flag, 0, 1, 0, &syscall.Overlapped{})
The file vs. lockfile subtlety seems to exist only on Windows, as the db struct definition tells.
I could happily patch it but I don't have anymore (and won't have for the coming months) a Windows platform to test it. But if you have one, let me know and we can do it together.
I just modified bolt_windows.go at line 65, change fd := db.file.Fd() to fd := f.Fd() and it seems fixed @rgeronimi
LGTM
can you send a patch to fix this?
@rgeronimi @xiang90 I have just create a pr #64
fixed by #64
Thks