-
Notifications
You must be signed in to change notification settings - Fork 1.5k
"invalid argument" when opening db #272
Comments
I can't dupe this. What's your OS version? Can you step into it with gdb? Looking at the implementation of Open (https://github.com/boltdb/bolt/blob/master/db.go#L97), if you're seeing the file get created then it's possible the flock or mmap calls are failing. |
So the problem was indeed my mistake. I should have mentioned the way I ran the docker container was by mounting my files (first from Windows to VM, then) from VM to the docker container (basically I'm running docker on a virtual machine, just like boot2docker does it also)
Here's what went down when compiling main.go according to strace if it tells anyone anything: http://pastebin.com/raw.php?i=CKWuMSHL I guess bolt couldn't deal with the Windows file system as it was running on some form of Linux. So I mounted to volume to another path, copied them over to gopath and things worked great. |
@ktmn Awesome! I'm glad to hear it worked out. As for the |
This also happens when trying to open a database on a shared vagrant folder, with a Windows host. |
Using Vagrant on a Mac host with a linux virtual, I experienced the same issue. I found that using nfs for the synched folders worked well.
|
BTW I ran into this issue on vagrant with bolt. The problem is that a mmap'ed file can not be run out of a shared folder when the options to mmap are set to MAP_SHARED. strace reports the following:
See here: http://man7.org/linux/man-pages/man2/mmap.2.html and here: http://stackoverflow.com/questions/18420473/invalid-argument-for-read-write-mmap and here: https://www.virtualbox.org/ticket/819 Basically you can't run a boltdb file out of a shared folder in Virtualbox, especially if your on a mac. |
I was getting this on Mac using Docker with a mounted volume (docker-machine), so I just downloaded the Docker for Mac Beta and it fixed it. https://www.docker.com/products/docker#/mac |
I got a new docker container "google/golang"
gopath/src/test contains this file, main.go:
I do a
and then in the gopath/src/test directory I run
Result:
A 16kb data.db file is created.
go version go1.3.1 linux/amd64
Probably some rookie mistake. But it works on my Windows. So what am I missing?
The text was updated successfully, but these errors were encountered: