I recently started to move a web app Ive been developing locally into
our network development environment. As part of that process Ive set
up Raven as an IIS application. When running against the IIS instance
I'm intermittently seeing the exception mentioned in the subject line.
One of my unit tests consistently sees the error.
The test is fairly straightforward:
1. Open session
a. Query for specific object
b. Assert object is null
2. Call an action on a controller which creates and persists the
object.
3. Open a new session
a. Query for specific object
b. Assert object is not null
Sessions for 1 and 3 are each in a using block. Session for 2 is
managed within the application's controller.
The test passes when connecting to my local instance of Raven.
If I run the test connecting to the IIS Raven it errors out at 3.a
with the following error.
[EsentTempPathInUseException: Temp path already used by another
database instance]
Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb
\SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:2739
Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE&
instance) in C:\Work\ravendb\SharedLibs\Sources
\managedesent-61618\EsentInterop\Api.cs:131
Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent
\TransactionalStorage.cs:207
[InvalidOperationException: Could not open transactional storage: C:
\inetpub\wwwroot\Raven\Data\Data]
Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent
\TransactionalStorage.cs:220
Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration
configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:
152
Raven.Web.ForwardToRavenRespondersFactory.Init() in c:\Builds\raven
\Raven.Web\ForwardToRavenRespondersFactory.cs:79
Raven.Web.RavenDbStartupAndShutdownModule.<Init>b__0(Object
sender, EventArgs args) in c:\Builds\raven\Raven.Web\BootStrapper.cs:
13
On Mon, Feb 27, 2012 at 9:13 PM, BAM <b...@bryanvt.net> wrote: > Hello,
> I recently started to move a web app Ive been developing locally into > our network development environment. As part of that process Ive set > up Raven as an IIS application. When running against the IIS instance > I'm intermittently seeing the exception mentioned in the subject line. > One of my unit tests consistently sees the error.
> The test is fairly straightforward: > 1. Open session > a. Query for specific object > b. Assert object is null
> 2. Call an action on a controller which creates and persists the > object.
> 3. Open a new session > a. Query for specific object > b. Assert object is not null
> Sessions for 1 and 3 are each in a using block. Session for 2 is > managed within the application's controller.
> The test passes when connecting to my local instance of Raven.
> If I run the test connecting to the IIS Raven it errors out at 3.a > with the following error.
> [EsentTempPathInUseException: Temp path already used by another > database instance] > Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb > \SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:2739 > Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& > instance) in C:\Work\ravendb\SharedLibs\Sources > \managedesent-61618\EsentInterop\Api.cs:131 > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent > \TransactionalStorage.cs:207
> [InvalidOperationException: Could not open transactional storage: C: > \inetpub\wwwroot\Raven\Data\Data] > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent > \TransactionalStorage.cs:220 > Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration > configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs: > 152 > Raven.Web.ForwardToRavenRespondersFactory.Init() in c:\Builds\raven > \Raven.Web\ForwardToRavenRespondersFactory.cs:79 > Raven.Web.RavenDbStartupAndShutdownModule.<Init>b__0(Object > sender, EventArgs args) in c:\Builds\raven\Raven.Web\BootStrapper.cs: > 13
> Do you have any way of reproducing it?
> Are you calling to a tenant database or to the master one?
> On Mon, Feb 27, 2012 at 9:13 PM, BAM <b...@bryanvt.net> wrote:
> > Hello,
> > I recently started to move a web app Ive been developing locally into
> > our network development environment. As part of that process Ive set
> > up Raven as an IIS application. When running against the IIS instance
> > I'm intermittently seeing the exception mentioned in the subject line.
> > One of my unit tests consistently sees the error.
> > The test is fairly straightforward:
> > 1. Open session
> > a. Query for specific object
> > b. Assert object is null
> > 2. Call an action on a controller which creates and persists the
> > object.
> > 3. Open a new session
> > a. Query for specific object
> > b. Assert object is not null
> > Sessions for 1 and 3 are each in a using block. Session for 2 is
> > managed within the application's controller.
> > The test passes when connecting to my local instance of Raven.
> > If I run the test connecting to the IIS Raven it errors out at 3.a
> > with the following error.
> > [EsentTempPathInUseException: Temp path already used by another
> > database instance]
> > Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb
> > \SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:2739
> > Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE&
> > instance) in C:\Work\ravendb\SharedLibs\Sources
> > \managedesent-61618\EsentInterop\Api.cs:131
> > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
> > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent
> > \TransactionalStorage.cs:207
> > [InvalidOperationException: Could not open transactional storage: C:
> > \inetpub\wwwroot\Raven\Data\Data]
> > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator
> > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent
> > \TransactionalStorage.cs:220
> > Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration
> > configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs:
> > 152
> > Raven.Web.ForwardToRavenRespondersFactory.Init() in c:\Builds\raven
> > \Raven.Web\ForwardToRavenRespondersFactory.cs:79
> > Raven.Web.RavenDbStartupAndShutdownModule.<Init>b__0(Object
> > sender, EventArgs args) in c:\Builds\raven\Raven.Web\BootStrapper.cs:
> > 13
On Mon, Feb 27, 2012 at 11:26 PM, BAM <b...@bryanvt.net> wrote: > Running the unit test I described above reliably reproduces it. Calls > involved there are to a tenant database.
> Running the application against IIS Raven I see the error > sporadically. (FYI - All calls the application makes are to tenant > DBs.)
> I never saw this error while working against a local Raven instance > using Raven.Server.exe.
> On Feb 27, 4:09 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Do you have any way of reproducing it? > > Are you calling to a tenant database or to the master one?
> > On Mon, Feb 27, 2012 at 9:13 PM, BAM <b...@bryanvt.net> wrote: > > > Hello,
> > > I recently started to move a web app Ive been developing locally into > > > our network development environment. As part of that process Ive set > > > up Raven as an IIS application. When running against the IIS instance > > > I'm intermittently seeing the exception mentioned in the subject line. > > > One of my unit tests consistently sees the error.
> > > The test is fairly straightforward: > > > 1. Open session > > > a. Query for specific object > > > b. Assert object is null
> > > 2. Call an action on a controller which creates and persists the > > > object.
> > > 3. Open a new session > > > a. Query for specific object > > > b. Assert object is not null
> > > Sessions for 1 and 3 are each in a using block. Session for 2 is > > > managed within the application's controller.
> > > The test passes when connecting to my local instance of Raven.
> > > If I run the test connecting to the IIS Raven it errors out at 3.a > > > with the following error.
> > > [EsentTempPathInUseException: Temp path already used by another > > > database instance] > > > Microsoft.Isam.Esent.Interop.Api.Check(Int32 err) in C:\Work\ravendb > > > \SharedLibs\Sources\managedesent-61618\EsentInterop\Api.cs:2739 > > > Microsoft.Isam.Esent.Interop.Api.JetInit(JET_INSTANCE& > > > instance) in C:\Work\ravendb\SharedLibs\Sources > > > \managedesent-61618\EsentInterop\Api.cs:131 > > > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator > > > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent > > > \TransactionalStorage.cs:207
> > > [InvalidOperationException: Could not open transactional storage: C: > > > \inetpub\wwwroot\Raven\Data\Data] > > > Raven.Storage.Esent.TransactionalStorage.Initialize(IUuidGenerator > > > uuidGenerator) in c:\Builds\raven\Raven.Storage.Esent > > > \TransactionalStorage.cs:220 > > > Raven.Database.DocumentDatabase..ctor(InMemoryRavenConfiguration > > > configuration) in c:\Builds\raven\Raven.Database\DocumentDatabase.cs: > > > 152 > > > Raven.Web.ForwardToRavenRespondersFactory.Init() in c:\Builds\raven > > > \Raven.Web\ForwardToRavenRespondersFactory.cs:79 > > > Raven.Web.RavenDbStartupAndShutdownModule.<Init>b__0(Object > > > sender, EventArgs args) in c:\Builds\raven\Raven.Web\BootStrapper.cs: > > > 13
On Tue, Feb 28, 2012 at 4:51 PM, BAM <b...@bryanvt.net> wrote: > Understood.
> I don't want to send my entire application.
> Will try to find some time to create a pared down version and see what > the results are.
> Thanks,
> B.
> On Feb 27, 4:29 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Can you actually send us the code to generate this error? > > The description you had allows for a lot of variations, which can be > pretty > > important.
You will probably need to run the test twice. There's a problem where
an invoke thinks the method is null the first time through. I'll need
to figure that one out...
On Feb 28, 9:52 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
> On Tue, Feb 28, 2012 at 4:51 PM, BAM <b...@bryanvt.net> wrote:
> > Understood.
> > I don't want to send my entire application.
> > Will try to find some time to create a pared down version and see what
> > the results are.
> > Thanks,
> > B.
> > On Feb 27, 4:29 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
> > wrote:
> > > Can you actually send us the code to generate this error?
> > > The description you had allows for a lot of variations, which can be
> > pretty
> > > important.
Hi, How am I supposed to be running this? I tried running the test, but it failed ( I run it 3 - 4 times, just to be sure):
Test 'Tests.TrmAdmin_CharacterizationControllerFixture.save_characterization_tes t' failed: System.Reflection.TargetInvocationException : Exception has been thrown by the target of an invocation. ----> System.NullReferenceException : Object reference not set to an instance of an object. at System.RuntimeMethodHandle._InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(IRuntimeMethodInfo method, Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeType typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters) Config.cs(155,0): at Tests.Config.RavenControllerOnActionExecuting(RavenController controller) TrmAdmin_CharacterizationControllerFixture.cs(52,0): at Tests.TrmAdmin_CharacterizationControllerFixture.save_characterization_test () --NullReferenceException at Temp.TrmAppHelper.GetRequestedDb(RouteValueDictionary routeValueDictionary) at Temp.TrmAppHelper.GetCoreData(ControllerContext context) at Temp.Controllers.RavenController.OnActionExecuting(ActionExecutingContext filterContext)
> You will probably need to run the test twice. There's a problem where > an invoke thinks the method is null the first time through. I'll need > to figure that one out...
> On Feb 28, 9:52 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Thanks
> > On Tue, Feb 28, 2012 at 4:51 PM, BAM <b...@bryanvt.net> wrote: > > > Understood.
> > > I don't want to send my entire application.
> > > Will try to find some time to create a pared down version and see what > > > the results are.
> > > Thanks,
> > > B.
> > > On Feb 27, 4:29 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > > > wrote: > > > > Can you actually send us the code to generate this error? > > > > The description you had allows for a lot of variations, which can be > > > pretty > > > > important.
First my apologies. I was going through the code I'd provided you. I
realized there was just too much going on. I need to re-factor and
simplify things. Then I'll see whether the error occurs any more.
That was one conclusion I came to. I also began to be more convinced
that the Esent error is caused, at root, by something I'm doing or not
in my code. The thing is I'm not sure what sort of thing I'm looking
for. So a couple questions:
1. What is your hunch about what might cause that error to occur?
e.g. Nested OpenSession calls (not that I think I'm doing that), or
some other bad thing?
2. When I go into Raven studio there are no log entries. Do I need to
do something to enable logging?
Again sorry to have brought you along on my snipe hunt.
B.
On Feb 28, 6:54 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
On Wed, Feb 29, 2012 at 5:35 PM, BAM <b...@bryanvt.net> wrote: > Oren,
> First my apologies. I was going through the code I'd provided you. I > realized there was just too much going on. I need to re-factor and > simplify things. Then I'll see whether the error occurs any more.
> That was one conclusion I came to. I also began to be more convinced > that the Esent error is caused, at root, by something I'm doing or not > in my code. The thing is I'm not sure what sort of thing I'm looking > for. So a couple questions:
> 1. What is your hunch about what might cause that error to occur? > e.g. Nested OpenSession calls (not that I think I'm doing that), or > some other bad thing? > 2. When I go into Raven studio there are no log entries. Do I need to > do something to enable logging?
> Again sorry to have brought you along on my snipe hunt.
> B.
> On Feb 28, 6:54 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Hi, > > How am I supposed to be running this? > > I tried running the test, but it failed ( I run it 3 - 4 times, just to > be > > sure):
> The most likely cause is that you are trying to open EmbeddedDocumentStore
> more than once.
> On Wed, Feb 29, 2012 at 5:35 PM, BAM <b...@bryanvt.net> wrote:
> > Oren,
> > First my apologies. I was going through the code I'd provided you. I
> > realized there was just too much going on. I need to re-factor and
> > simplify things. Then I'll see whether the error occurs any more.
> > That was one conclusion I came to. I also began to be more convinced
> > that the Esent error is caused, at root, by something I'm doing or not
> > in my code. The thing is I'm not sure what sort of thing I'm looking
> > for. So a couple questions:
> > 1. What is your hunch about what might cause that error to occur?
> > e.g. Nested OpenSession calls (not that I think I'm doing that), or
> > some other bad thing?
> > 2. When I go into Raven studio there are no log entries. Do I need to
> > do something to enable logging?
> > Again sorry to have brought you along on my snipe hunt.
> > B.
> > On Feb 28, 6:54 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
> > wrote:
> > > Hi,
> > > How am I supposed to be running this?
> > > I tried running the test, but it failed ( I run it 3 - 4 times, just to
> > be
> > > sure):
On Wed, Feb 29, 2012 at 6:01 PM, BAM <b...@bryanvt.net> wrote: > Thanks. That's not impossible in the test units. I've seen the error > when running the app as well, and it is not using embedded.
> What would be the most likely cause that doesn't involve embedded?
> On Feb 29, 10:36 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > The most likely cause is that you are trying to open > EmbeddedDocumentStore > > more than once.
> > On Wed, Feb 29, 2012 at 5:35 PM, BAM <b...@bryanvt.net> wrote: > > > Oren,
> > > First my apologies. I was going through the code I'd provided you. I > > > realized there was just too much going on. I need to re-factor and > > > simplify things. Then I'll see whether the error occurs any more.
> > > That was one conclusion I came to. I also began to be more convinced > > > that the Esent error is caused, at root, by something I'm doing or not > > > in my code. The thing is I'm not sure what sort of thing I'm looking > > > for. So a couple questions:
> > > 1. What is your hunch about what might cause that error to occur? > > > e.g. Nested OpenSession calls (not that I think I'm doing that), or > > > some other bad thing? > > > 2. When I go into Raven studio there are no log entries. Do I need to > > > do something to enable logging?
> > > Again sorry to have brought you along on my snipe hunt.
> > > B.
> > > On Feb 28, 6:54 pm, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > > > wrote: > > > > Hi, > > > > How am I supposed to be running this? > > > > I tried running the test, but it failed ( I run it 3 - 4 times, just > to > > > be > > > > sure):
It's a multi-tenant application that connects to an IIS instance of
RavenDB. The IIS server is a development box within our network. I
have never had a problem establishing the connection.
DocumentStore instantiating code follows:
public static IDocumentStore GetDocumentStore(IContext
context)
{
lock (typeof(MvcApplication))
{
if (_documentStore == null)
{
_documentStore = new DocumentStore
{ ConnectionStringName = "RavenDB" };
_documentStore.Conventions.IdentityPartsSeparator
= "-";
_documentStore.Initialize();
}
}
return _documentStore;
}
Does that answer your question?
The error is intermittent and not predictable.
On Feb 29, 11:42 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
On Fri, Mar 2, 2012 at 8:39 PM, BAM <b...@bryanvt.net> wrote: > It's a multi-tenant application that connects to an IIS instance of > RavenDB. The IIS server is a development box within our network. I > have never had a problem establishing the connection.
> Hm,
> No idea then. If you can find a way to reproduce this, I would be most
> grateful.
> I went over the code a couple of times, and it looks fine.
Just an idea.
When IIS recycles app pool it does not kill previous worker process
before new worker process is created.
It seems that for some time there are two phisical processes that
access to the same database directory.
You can disable this by Disable Overlapped Recycle in App Pool
Advanced Settings.
On 4 Бер, 12:57, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
> Hm,
> No idea then. If you can find a way to reproduce this, I would be most
> grateful.
> I went over the code a couple of times, and it looks fine.
> On Fri, Mar 2, 2012 at 11:06 PM, BAM <b...@bryanvt.net> wrote:
> > The config settings? No. This is copied straight from the server:
On Sun, Mar 4, 2012 at 11:48 PM, Mike Chaliy <m...@chaliy.name> wrote: > Just an idea. > When IIS recycles app pool it does not kill previous worker process > before new worker process is created. > It seems that for some time there are two phisical processes that > access to the same database directory. > You can disable this by Disable Overlapped Recycle in App Pool > Advanced Settings.
> On 4 Бер, 12:57, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Hm, > > No idea then. If you can find a way to reproduce this, I would be most > > grateful. > > I went over the code a couple of times, and it looks fine.
> > On Fri, Mar 2, 2012 at 11:06 PM, BAM <b...@bryanvt.net> wrote: > > > The config settings? No. This is copied straight from the server:
Thanks for the idea. I've set up an App Pool with overlap disabled. So
far so good. I hesitate to jump to certainty, but it seems like you've
put your finger on the problem.
B.
On Mar 4, 4:48 pm, Mike Chaliy <m...@chaliy.name> wrote:
> Just an idea.
> When IIS recycles app pool it does not kill previous worker process
> before new worker process is created.
> It seems that for some time there are two phisical processes that
> access to the same database directory.
> You can disable this by Disable Overlapped Recycle in App Pool
> Advanced Settings.
> > Hm,
> > No idea then. If you can find a way to reproduce this, I would be most
> > grateful.
> > I went over the code a couple of times, and it looks fine.
Just wanted to close this thread. It's been a couple of days since I
implemented Mike's suggestion. Since that time I have not seen the
error once. I feel confident that pool recycling was the root cause.
On a related note, before changing the recycling setting I regularly
would see errors in Studio. As it recovered after I closed the message
and wasn't affecting my application I did not take the time to
investigate. Since disabling recycling I have seen a significant
reduction (essentially eliminated) in the number of errors.
I would suggest y'all consider adding this as a recommendation for
configuration of IIS in your instructions, at the very least for multi-
tenant situations.
Thanks for all the help.
B.
On Mar 5, 3:43 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com>
wrote:
On Thu, Mar 8, 2012 at 6:02 PM, BAM <b...@bryanvt.net> wrote:
> All,
> Just wanted to close this thread. It's been a couple of days since I > implemented Mike's suggestion. Since that time I have not seen the > error once. I feel confident that pool recycling was the root cause.
> On a related note, before changing the recycling setting I regularly > would see errors in Studio. As it recovered after I closed the message > and wasn't affecting my application I did not take the time to > investigate. Since disabling recycling I have seen a significant > reduction (essentially eliminated) in the number of errors.
> I would suggest y'all consider adding this as a recommendation for > configuration of IIS in your instructions, at the very least for multi- > tenant situations.
> Thanks for all the help.
> B.
> On Mar 5, 3:43 am, "Oren Eini (Ayende Rahien)" <aye...@ayende.com> > wrote: > > Haven't thought of that, yes. > > That might very well be a reason for that.