Build/Test Issues

Compatibility issue with RavenDB 3.0 [Solved]

Started by yanglee on 7,079 views

Hello, I upgraded RavenDB from version 2.5 to 3.0. I can compile and run my software without problem. But I get lots of exceptions with my tests under NCrunch.

I set both "Allow parallel test execution" and "Allow tests to run in parallel with themselves" of the solution to "False", and executed "Resynchronize, rebuild and run all tests" command (also tried restart Visual Studio), but same issue.

Any ideas?

SetUp : System.IO.IOException : The process cannot access the file 'M:\NCrunch\Workspace\8828\54\_ncrunchreferences\Assemblies\Lucene.Net.dll' because it is being used by another process.
   at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
   at System.IO.File.InternalDelete(String path, Boolean checkHost)
   at System.IO.File.Delete(String path)
   at Raven.Database.Server.AssemblyExtractor.Extract(Assembly assemblyToExtractFrom, IEnumerable`1 assembliesToExtract, String location) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\AssemblyExtractor.cs:line 89
   at Raven.Database.Server.AssemblyExtractor.ExtractEmbeddedAssemblies() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\AssemblyExtractor.cs:line 37
   at Owin.AppBuilderExtensions.UseRavenDB(IAppBuilder app, RavenDBOptions options) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\AppBuilderExtensions.cs:line 70
   at Raven.Database.Server.OwinHttpServer.<.ctor>b__0(IAppBuilder app) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\OwinHttpServer.cs:line 26
   at Microsoft.Owin.Hosting.Engine.HostingEngine.ResolveApp(StartContext context)
   at Microsoft.Owin.Hosting.Engine.HostingEngine.Start(StartContext context)
   at Raven.Database.Embedded.OwinEmbeddedHost.Configure(Action`1 startup, StartOptions options) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Embedded\OwinEmbeddedHost.cs:line 65
   at Raven.Database.Server.OwinHttpServer..ctor(InMemoryRavenConfiguration config, DocumentDatabase db, Boolean useHttpServer, Action`1 configure) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\OwinHttpServer.cs:line 26
   at Raven.Server.RavenDbServer.Initialize(Action`1 configure) in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Server\RavenDbServer.cs:line 106
   at Raven.Database.Client.EmbeddedDocumentStore.Initialize() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Client\EmbeddedDocumentStore.cs:line 225
   at Raven.Client.Embedded.EmbeddableDocumentStore.Initialize() in c:\Builds\RavenDB-Stable-3.0\Raven.Database\Client\EmbeddableDocumentStore.cs:line 134

Edited

Hi, thanks for sharing this issue.

There's likely to be a lot going on here, so I'm afraid that I'm reduced to blind guessing on this one. The first thing that gets my attention is the directory the file is located in:

M:\NCrunch\Workspace\8828\54\_ncrunchreferences\Assemblies

NCrunch doesn't usually copy referenced assemblies into an 'Assemblies' directory - they are normally directly under _ncrunchreferences. This suggests to me that the file lock is probably being held by the test code (or production code it is calling into). Is it possible that RavenDB is trying to initialise itself multiple times in the same location without a cleanup step? The difference here between NCrunch and another test runner could be that NCrunch can call multiple times into the test process while other test runners will only call into the test process once.

I would suggest trying to find out where the lock on this file is being established and see whether this is in an AssemblyInitialize method of some kind or code that is likely to be repeatedly called by NCrunch in a re-used test process.
I tried again, and found actually setting "Allow parallel test execution" to False solved the issue. It didn't work previously probably because I set Engine Mode to "Run impacted tests automatically, others manually", and somehow the settings were not updated.

I tried adding "IsolatedAttribute" to all theses tests but still same issue (when "Allow parallel test execution" is True). I can get all tests past by executing "Run all tests visible here" multiple times.

Thanks for the suggestion, will report back when I find something new.

Edited

Thanks - I guess the DB doesn't work well with the parallelisation .. Do also let me know if you find a way to reproduce the issue where changing this setting didn't take affect, as this does also sound like a problem to me.
Updating RavenDB from version 3.0.3528 to the latest version 3.0.3599 solved the issue :)

Post a reply

Log in to reply.