ICSharpCode.NRefactory exception after restarting RaventDB app pool

251 views
Skip to first unread message

Dmitry

unread,
Apr 25, 2015, 2:46:44 PM4/25/15
to rav...@googlegroups.com
I am trying to evaluate whether to use RavenDB 3.0 for a project.

About 60% of the time, when the application pool gets restarted a RavenDB query on the homepage that uses a static index gets the throws the following exception:

Could not load file or assembly 'ICSharpCode.NRefactory, Version=5.0.0.0, Culture=neutral, PublicKeyToken=d4bfe873e7598c49' or one of its dependencies. The system cannot find the file specified.
at Raven.Abstractions.Util.IndexPrettyPrinter.Format(String code)   at Raven.Client.Indexes.IndexDefinitionBuilder`2.ToIndexDefinition(DocumentConvention convention, Boolean validateMap) in c:\Builds\RavenDB-Stable-3.0\Raven.Client.Lightweight\Indexes\IndexDefinitionBuilder.cs:line 159   at Raven.Client.Indexes.AbstractMultiMapIndexCreationTask`1.CreateIndexDefinition() in c:\Builds\RavenDB-Stable-3.0\Raven.Client.Lightweight\Indexes\AbstractMultiMapIndexCreationTask.cs:line 65   at Raven.Client.Indexes.AbstractIndexCreationTask.Execute(IDatabaseCommands databaseCommands, DocumentConvention documentConvention) in c:\Builds\RavenDB-Stable-3.0\Raven.Client.Lightweight\Indexes\AbstractIndexCreationTask.cs:line 257   at Raven.Client.Indexes.IndexCreation.CreateIndexes(ExportProvider catalogToGetnIndexingTasksFrom, IDocumentStore documentStore) in c:\Builds\RavenDB-Stable-3.0\Raven.Client.Lightweight\Indexes\IndexCreation.cs:line 104   at DealManager.ReadModel.RavenSessionFactory..ctor(String connectionName) in d:\Development\.NET.4.5.2\DealManager\DealManager.ReadModel\RavenSessionFactory.cs:line 65   at lambda_method(Closure , IBuildSession , IContext )

It seems to be a race condition because if you refresh the page everything starts working fine. The server was installed using the *setup.exe file and there is nothing special about the installation. The services are using a static IDocumentStore and HTTP scoped IAsyncDocumentSession.

I have read another topic where same exception was related to NancyFX. But I am using Web API 2.

Thanks

Oren Eini (Ayende Rahien)

unread,
Apr 26, 2015, 6:10:44 AM4/26/15
to ravendb
You are using mixed dlls from multiple versions.

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+u...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Dmitry

unread,
Apr 27, 2015, 12:46:45 AM4/27/15
to rav...@googlegroups.com
I am using a single NuGet package (RavenDB client) in the project (v3.0.3660). The referenced DLLs have matching versions.

Does the RavenDB server has to be the exact same version?

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2015, 1:11:50 AM4/27/15
to ravendb
No, the server & client don't have to be the exact version.

The ICSharpCode is actually embedded inside our assembly, so it shouldn't be causing any issue.

Dmitry

unread,
Apr 27, 2015, 1:24:01 AM4/27/15
to rav...@googlegroups.com
I have 2 assemblies referenced from the NuGet package: Raven.Abstractions.dll and Raven.Client.Lightweight.dll

Using Reflector, it does not look ICSharpCode is embedded into either of them. Unless the assembly is hidden somewhere, it looks like only JSON.NET is embedded into the abstractions assembly. It does have references to the ICSharpCode.

Also, adding the NuGet package for the ICSharpCode fixes the issue, but it's an ugly package with a lot of references to depend on.


Oren Eini (Ayende Rahien)

unread,
Apr 27, 2015, 1:25:18 AM4/27/15
to ravendb
It is embedded as a resource.

Hibernating Rhinos Ltd  

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

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

 


Dmitry

unread,
Apr 27, 2015, 1:31:01 AM4/27/15
to rav...@googlegroups.com
There is got to be some race condition happening. I am not sure how to get around it without referencing the nuget package directly. The homepage needs to run a static index query.

Oren Eini (Ayende Rahien)

unread,
Apr 27, 2015, 1:36:53 AM4/27/15
to ravendb
Can you send us a way to reproduce this?

Hibernating Rhinos Ltd  

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

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

 


On Mon, Apr 27, 2015 at 8:31 AM, Dmitry <dmitry....@gmail.com> wrote:
There is got to be some race condition happening. I am not sure how to get around it without referencing the nuget package directly. The homepage needs to run a static index query.

--

Dmitry

unread,
Apr 27, 2015, 1:41:16 AM4/27/15
to rav...@googlegroups.com
I'll try to reproduce it in a separate project. It is a large application with various dependencies.

Dmitry

unread,
Apr 27, 2015, 10:03:35 PM4/27/15
to rav...@googlegroups.com
I was unable to reproduce it. But it does not seem to happen if I remove the autoStart="true" attribute from the app pool.

Sander Rijken

unread,
May 22, 2015, 5:56:34 AM5/22/15
to rav...@googlegroups.com
I'm seeing the same exception, also with autoStart="true"

Oren Eini (Ayende Rahien)

unread,
May 22, 2015, 6:07:14 AM5/22/15
to ravendb
Do you have any way to reproduce this issue?

Sander Rijken

unread,
May 22, 2015, 6:18:12 AM5/22/15
to rav...@googlegroups.com
I think so.

Stop the apppool, wait, start the apppool, wait again (so it auto-starts). Then hit the code that initializes the DocumentStore and calls InitializeIndexes; this triggers the exception.

To fix, recycle the apppool and hit it before it autostarts.

App pool settings:

Basic:
.NET4.0 and Integrated mode

Advanced: See image


Sander
2015-05-22_12-16-52.png

Oren Eini (Ayende Rahien)

unread,
May 22, 2015, 6:25:00 AM5/22/15
to ravendb
What build are you using here? Are you using nuget, if so, what exact number?

Sander Rijken

unread,
May 22, 2015, 6:26:37 AM5/22/15
to rav...@googlegroups.com
<package id="RavenDB.Client" version="3.0.3660" targetFramework="net45" />

Server is also #3660

Oren Eini (Ayende Rahien)

unread,
May 22, 2015, 6:31:57 AM5/22/15
to ravendb

Morten Brix Pedersen

unread,
May 22, 2015, 9:00:59 AM5/22/15
to rav...@googlegroups.com
For what's its worth, we also encountered this problem when using Nancy framework. You can find more detail here: https://github.com/NancyFx/Nancy/issues/1767

Paweł Pekról

unread,
May 28, 2015, 8:05:20 AM5/28/15
to rav...@googlegroups.com
Hi,

unfortunately I'm unable to reproduce your issue. Tried on 2 machines, one with Windows 8.1 x64 and SSD drive, second one with  Windows 7 x64 and HDD. This can be related to other packages that you are using as Morten suggested earlier.

Could you prepare a sample solution that causes problems for you and provide more details about your environment?

Many thanks,
P.

Sander Rijken

unread,
May 29, 2015, 3:11:50 PM5/29/15
to rav...@googlegroups.com
Hi,


First set the connectionstring in the web.config.
Publish this to a Windows Server 2012R2 (not sure if that matters) to a site with the application settings as above. Run the site, checking javascript console. "succeeded" means it's OK, "fail" means it's not. When you first run the site it will probably work.

Now go to the application pool, and recycle it. Wait 10 seconds before refreshing the page to watch it fail. When it does you've triggered the FileNotFound exception.

In contrast to what I initially thought this has nothing to do with AlwaysRunning vs OnDemand, but it is only triggered by recycling and reloading

Please let me know if you need more info.
Sander

You received this message because you are subscribed to a topic in the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ravendb/VtHoDCgweGg/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ravendb+u...@googlegroups.com.
Message has been deleted

Paweł Pekról

unread,
Jun 1, 2015, 7:10:48 AM6/1/15
to rav...@googlegroups.com
Hi Sander, thanks for sample, unfortunately I cannot reproduce this (tried on a fresh A1 and A3 instances with WS2012R2 on Azure).

1. Is there a possibility that your are missing some windows updates? Probably new instances have more updates installed than the old ones.
2. How many applications are on that AppPool?
3. Where is RavenDB located? Same IIS? Same AppPool? Remote?

Many thanks,
P.

Sander Rijken

unread,
Jun 1, 2015, 7:16:12 AM6/1/15
to rav...@googlegroups.com
Hi,

I'm not running on Azure, but on a 2012R2 server; but I'm not sure if that matters for the issue. This is the only application in the AppPool. The RavenDB server is running as a windows service on a remote server. We are up-to-date on windows updates.

Thanks,
Sander

Paweł Pekról

unread,
Jun 1, 2015, 7:32:03 AM6/1/15
to rav...@googlegroups.com
Thanks Sander,

I will try that setup also.

P.

Dmitry

unread,
Aug 22, 2015, 2:48:58 AM8/22/15
to RavenDB - 2nd generation document database
Any updates on this? I made sure the server and all the clients are updated to the latest version of RavenDB and have all the updates installed on the server. Once in a while that exception is still happening when the app pool is restarted; not as often though. Apps are using separate application pools that are running .NET 4.5.2.

I really want to use RavenDB in production but that is a show stopper.

Oren Eini (Ayende Rahien)

unread,
Aug 23, 2015, 7:38:29 AM8/23/15
to ravendb
Yes, it will be part of the next stable.
We should handle this error nicely now.

Hibernating Rhinos Ltd  

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

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

 


On Sat, Aug 22, 2015 at 9:48 AM, Dmitry <dmitry....@gmail.com> wrote:
Any updates on this? I made sure the server and all the clients are updated to the latest version of RavenDB and have all the updates installed on the server. Once in a while that exception is still happening when the app pool is restarted; not as often though. Apps are using separate application pools that are running .NET 4.5.2.

I really want to use RavenDB in production but that is a show stopper.

--
Reply all
Reply to author
Forward
0 new messages