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

DB.Close(): funlock error #60

Closed
kwf2030 opened this issue Oct 10, 2017 · 7 comments
Closed

DB.Close(): funlock error #60

kwf2030 opened this issue Oct 10, 2017 · 7 comments

Comments

@kwf2030
Copy link

kwf2030 commented Oct 10, 2017

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.

#35(Support no timeout locks on db files) lead to this issue

@dmoklaf
Copy link
Contributor

dmoklaf commented Oct 29, 2017

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.

@kwf2030
Copy link
Author

kwf2030 commented Oct 31, 2017

I just modified bolt_windows.go at line 65, change fd := db.file.Fd() to fd := f.Fd() and it seems fixed @rgeronimi

@dmoklaf
Copy link
Contributor

dmoklaf commented Oct 31, 2017

LGTM

@xiang90
Copy link
Contributor

xiang90 commented Oct 31, 2017

can you send a patch to fix this?

@kwf2030
Copy link
Author

kwf2030 commented Nov 1, 2017

@rgeronimi @xiang90 I have just create a pr #64

@xiang90
Copy link
Contributor

xiang90 commented Nov 1, 2017

fixed by #64

@xiang90 xiang90 closed this as completed Nov 1, 2017
@dmoklaf
Copy link
Contributor

dmoklaf commented Nov 1, 2017

Thks

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

No branches or pull requests

4 participants