RavenDB 4 on Docker - creating DBs on a mounted host volume doesn't seem to work

299 views
Skip to first unread message

Sean Duffy

unread,
Apr 26, 2017, 10:14:42 AM4/26/17
to RavenDB - 2nd generation document database
Hi there,

I'm attempting to run a RavenDB 4 a docker container.

I've mounted a volume from my Windows host machine (I'm running Docker via Quick start in a VirtualBox VM under Windows 10).

This is the image I'm using along with the command to run the image (RavenDB build 4.0-40012) and mount a folder:

docker pull pizycki/ravendb4
docker run -it -p 8080:8080 -v //c/Users/duffys:/mountdata pizycki/ravendb4

I then connect to the Raven UI and create a new database under the mounted volume, but the database fails to start. (See attached create.png for the paths I am specifying)

Here is the stack trace that shows up in the error:

{
    "httpStatus": "Internal Server Error",
    "details": "Raven.Client.Exceptions.Database.DatabaseLoadFailureException: Failed to start database test1\nAt /mountdata/test1 ---> System.InvalidOperationException: EINVAL sync dir for /mountdata/test1/Subscriptions/Raven.voron\n   at Voron.Platform.Posix.PosixHelper.ThrowLastError(Int32 lastError, String msg) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Voron\\Platform\\Posix\\PosixHelper.cs:line 49\n   at Voron.Platform.Posix.PosixMemoryMapPager..ctor(StorageEnvironmentOptions options, String file, Nullable`1 initialFileSize, Boolean usePageProtection) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Voron\\Platform\\Posix\\PosixMemoryMapPager.cs:line 61\n   at Voron.StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions.GetMemoryMapPager(StorageEnvironmentOptions options, Nullable`1 initialSize, String file, Boolean deleteOnClose, Boolean usePageProtection) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Voron\\StorageEnvironmentOptions.cs:line 552\n   at Voron.StorageEnvironmentOptions.DirectoryStorageEnvironmentOptions.<.ctor>b__4_0() in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Voron\\StorageEnvironmentOptions.cs:line 244\n   at System.Lazy`1.CreateValue()\n   at System.Lazy`1.LazyInitValue()\n   at Voron.StorageEnvironment..ctor(StorageEnvironmentOptions options) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Voron\\StorageEnvironment.cs:line 139\n   at Raven.Server.Documents.Subscriptions.SubscriptionStorage..ctor(DocumentDatabase db) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\Subscriptions\\SubscriptionStorage.cs:line 49\n   at Raven.Server.Documents.DocumentDatabase..ctor(String name, RavenConfiguration configuration, ServerStore serverStore) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\DocumentDatabase.cs:line 69\n   at Raven.Server.Documents.DatabasesLandlord.CreateDocumentsStorage(StringSegment databaseName, RavenConfiguration config) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\DatabasesLandlord.cs:line 217\n   --- End of inner exception stack trace ---\n   at Raven.Server.Documents.DatabasesLandlord.CreateDocumentsStorage(StringSegment databaseName, RavenConfiguration config) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\DatabasesLandlord.cs:line 233\n   at Raven.Server.Documents.DatabasesLandlord.ActuallyCreateDatabase(StringSegment databaseName, RavenConfiguration config) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\DatabasesLandlord.cs:line 189\n   at Raven.Server.Documents.DatabasesLandlord.<>c__DisplayClass19_0.<CreateDatabaseUnderResourceSemaphore>b__0() in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Documents\\DatabasesLandlord.cs:line 153\n   at System.Threading.Tasks.Task`1.InnerInvoke()\n   at System.Threading.Tasks.Task.Execute()\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at async Raven.Server.Routing.RouteInformation.UnlikelyWaitForDatabaseToLoad(?) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Routing\\RouteInformation.cs:line 95\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at async Raven.Server.Routing.RouteInformation.WaitForDb(?) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Routing\\RouteInformation.cs:line 124\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at async Raven.Server.Routing.RequestRouter.HandlePath(?) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\Routing\\RequestRouter.cs:line 76\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\n   at async Raven.Server.RavenServerStartup.RequestHandler(?) in C:\\Builds\\RavenDB-4.0-Alpha\\src\\Raven.Server\\RavenServerStartup.cs:line 114"
}



The actual DB folder does get created in my mounted volume on my docker host in Windows though - I can see it created with the same name I specified for the DB name, and it contains a few files and folders including Raven.voron under "Subscriptions". So it doesn't seem related to permissions as it is able to write some new files and directories.

I looked up the EINVAL error code for linux, and that is apparently "Invalid argument".

Does anyone have any ideas as to what is wrong here, or has anyone else successfully created a database on a mounted host volume for a RavenDB4 container?


create.png

Oren Eini (Ayende Rahien)

unread,
Apr 26, 2017, 10:38:45 AM4/26/17
to ravendb
Hi,
Can you use our latest?

See here:

On my machine, it worked without issue using:

docker run -it -e AllowEverybodyToAccessTheServerAsAdmin=true -p 8080:8080 -v //f/dockers/dbs:/databases ravendb/ravendb

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Grzegorz Lachowski

unread,
Apr 26, 2017, 11:22:57 AM4/26/17
to RavenDB - 2nd generation document database
As Oren pointed out you can try our official images: https://hub.docker.com/r/ravendb/ravendb/
It definitely worked for us on HyperV, however I haven't tried VirtualBox yet. I'll try that tomorrow and let you know my findings.

Grzegorz Lachowski

unread,
Apr 27, 2017, 9:36:45 AM4/27/17
to RavenDB - 2nd generation document database
Sean,

I've been working on this today and was able to reproduce the error you received, which was NFS-share related, however once I fixed that the real issue showed up, which actually prevents us from running on VBox using shared volumes: https://www.virtualbox.org/ticket/819

Unfortunately VirtualBox does not support mmap with MAP_SHARED call on shared volumes and that is something we cannot run without.

You can either run without shared volumes usage or use "Docker for Windows" on which it works fine.

Sean Duffy

unread,
Apr 27, 2017, 2:25:18 PM4/27/17
to RavenDB - 2nd generation document database
Hi Oren and Grzegorz,

Thanks so much for looking into this - much appreciated!

I had a hunch it might be something to do with the way VBox handles volume mapping, but lacked the knowledge on the underlying tech to work that one out. That is quite an old bug - 10 years old now! Docker for Windows seems to have come a long way now, so I'm going to look at removing my Vbox installation and using HyperV instead to run the docker host. I'll give it another go then, and I'm sure as you say it'll all work perfectly.

Thanks again to both of you for looking into this and figuring it out.

Sean
Reply all
Reply to author
Forward
0 new messages