Raccoonblog exception: The type initializer for 'Occur' threw an exception

97 views
Skip to first unread message

Stijn Volders (ONE75)

unread,
Aug 20, 2012, 10:40:13 AM8/20/12
to rav...@googlegroups.com
Hi,
 
I've installed Raccoon Blog on a machine at work. It used to work, but now I get an exception " The type initializer for 'Occur' threw an exception". I've copied the database to my local machine and tested it with visual studio but there is no exception there.
 
Any idea what could be the cause of this?
 
Stacktrace below:
 
[InvalidOperationException: Url: "/indexes/dynamic/Posts?query=PublishAt%253A%257B*%2520TO%252020120820143400000%257D%2520AND%2520(%2520*%253A*%2520-IsDeleted%253Atrue)&start=0&pageSize=25&aggregation=None&sort=-PublishAt&include=AuthorId&operationHeadersHash=-1195744532"

System.TypeInitializationException: The type initializer for 'Occur' threw an exception. ---> System.NullReferenceException: Object reference not set to an instance of an object.
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at Lucene.Net.Util.Parameter..ctor(String name) in z:\Libs\lucene.net\src\core\Util\Parameter.cs:line 46
   at Lucene.Net.Search.BooleanClause.Occur..ctor(String name) in z:\Libs\lucene.net\src\core\Search\BooleanClause.cs:line 35
   at Lucene.Net.Search.BooleanClause.Occur..cctor() in z:\Libs\lucene.net\src\core\Search\BooleanClause.cs:line 49
   --- End of inner exception stack trace ---
   at Lucene.Net.QueryParsers.QueryParser.AddClause(IList clauses, Int32 conj, Int32 mods, Query q) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 602
   at Lucene.Net.QueryParsers.QueryParser.Query(String field) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 1492
   at Lucene.Net.QueryParsers.QueryParser.Parse(String query) in z:\Libs\lucene.net\src\core\QueryParser\QueryParser.cs:line 231
   at Raven.Database.Indexing.QueryBuilder.BuildQuery(String query, String defaultField, PerFieldAnalyzerWrapper analyzer) in c:\Builds\RavenDB-Stable\Raven.Database\Indexing\QueryBuilder.cs:line 35
   at Raven.Database.Indexing.Index.IndexQueryOperation.GetLuceneQuery(String query, String defaultField) in c:\Builds\RavenDB-Stable\Raven.Database\Indexing\Index.cs:line 881
   at Raven.Database.Indexing.Index.IndexQueryOperation.GetLuceneQuery() in c:\Builds\RavenDB-Stable\Raven.Database\Indexing\Index.cs:line 841
   at Raven.Database.Indexing.Index.IndexQueryOperation.<Query>d__2e.MoveNext() in c:\Builds\RavenDB-Stable\Raven.Database\Indexing\Index.cs:line 639
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()
   at System.Collections.Generic.List`1.InsertRange(Int32 index, IEnumerable`1 collection)
   at System.Collections.Generic.List`1.AddRange(IEnumerable`1 collection)
   at Raven.Database.DocumentDatabase.<>c__DisplayClass82.<Query>b__78(IStorageActionsAccessor actions) in c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs:line 838
   at Raven.Storage.Esent.TransactionalStorage.ExecuteBatch(Action`1 action) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:line 376
   at Raven.Storage.Esent.TransactionalStorage.Batch(Action`1 action) in c:\Builds\RavenDB-Stable\Raven.Storage.Esent\TransactionalStorage.cs:line 337
   at Raven.Database.DocumentDatabase.Query(String index, IndexQuery query) in c:\Builds\RavenDB-Stable\Raven.Database\DocumentDatabase.cs:line 781
   at Raven.Database.Queries.DynamicQueryRunner.ExecuteActualQuery(IndexQuery query, DynamicQueryMapping map, Tuple`2 touchTemporaryIndexResult, String realQuery) in c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryRunner.cs:line 81
   at Raven.Database.Queries.DynamicQueryRunner.ExecuteDynamicQuery(String entityName, IndexQuery query) in c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryRunner.cs:line 48
   at Raven.Database.Queries.DynamicQueryExtensions.ExecuteDynamicQuery(DocumentDatabase self, String entityName, IndexQuery indexQuery) in c:\Builds\RavenDB-Stable\Raven.Database\Queries\DynamicQueryExtensions.cs:line 17
   at Raven.Database.Server.Responders.Index.PerformQueryAgainstDynamicIndex(IHttpContext context, String index, IndexQuery indexQuery, Guid& indexEtag) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs:line 238
   at Raven.Database.Server.Responders.Index.ExecuteQuery(IHttpContext context, String index, Guid& indexEtag) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs:line 179
   at Raven.Database.Server.Responders.Index.GetIndexQueryRessult(IHttpContext context, String index) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs:line 119
   at Raven.Database.Server.Responders.Index.OnGet(IHttpContext context, String index) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs:line 91
   at Raven.Database.Server.Responders.Index.Respond(IHttpContext context) in c:\Builds\RavenDB-Stable\Raven.Database\Server\Responders\Index.cs:line 46
   at Raven.Database.Server.HttpServer.DispatchRequest(IHttpContext ctx) in c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs:line 550
   at Raven.Database.Server.HttpServer.HandleActualRequest(IHttpContext ctx) in c:\Builds\RavenDB-Stable\Raven.Database\Server\HttpServer.cs:line 316
]
 
Thanks
 
Stijn
 
 

Itamar Syn-Hershko

unread,
Aug 20, 2012, 10:50:31 AM8/20/12
to rav...@googlegroups.com
What RavenDB build is it using?

Do you have a way to reproduce this?

I'm looking at the Lucene sources, this exception is practically impossible to reach.

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2012, 2:12:23 PM8/20/12
to rav...@googlegroups.com
Actually, it is fairly easy to understand what is going on there.
You have non thread safe access to Parameter.allParameters
All you need is two different threads accessing two different classes that inherit from Parameter, and you get this.

Itamar Syn-Hershko

unread,
Aug 20, 2012, 6:10:57 PM8/20/12
to rav...@googlegroups.com
That's the only explanation that will make sense, yes, although the NRE still doesn't make much sense to me also after dotPeeking into mscorlib 

There is only one class inheriting from Parameter, but I guess this could still happen by some weird race condition. My quickfix was to wrap it with a lock, although this doesn't entirely solve the problem (an ArgumentException could still be thrown).

Pushed to Lucene.Net, will update RavenDB with the 3.0.3 version momentarily

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2012, 6:14:55 PM8/20/12
to rav...@googlegroups.com
Before you update RavenDB, can you show the actual change you made?

Itamar Syn-Hershko

unread,
Aug 20, 2012, 6:20:13 PM8/20/12
to rav...@googlegroups.com

Oren Eini (Ayende Rahien)

unread,
Aug 20, 2012, 6:21:55 PM8/20/12
to rav...@googlegroups.com
See my comments on the lucene mailing list.

Stijn Volders (ONE75)

unread,
Aug 21, 2012, 4:42:25 PM8/21/12
to rav...@googlegroups.com
I'm using build 960. I have no idea how I can reproduce this...

I've exported the database. Deleted the database (folder) and imported it again and the problem is gone. Stopped RavenDB service and did an IIS reset before but that didn't help...

Thanks

Stijn

Oren Eini (Ayende Rahien)

unread,
Aug 22, 2012, 2:44:16 AM8/22/12
to rav...@googlegroups.com
It is a race condition inside Lucene.
That is fixed already by Itamar and will be in one of the next builds for RavenDB.

Stijn Volders (ONE75)

unread,
Aug 22, 2012, 3:41:35 AM8/22/12
to rav...@googlegroups.com
thanks
Reply all
Reply to author
Forward
0 new messages