[ 
https://issues.apache.org/jira/browse/LUCENENET-554?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14604736#comment-14604736
 ] 

Thomas D edited comment on LUCENENET-554 at 6/28/15 11:25 PM:
--------------------------------------------------------------

I'm making a bit of headway: I put the source of Lucene.Net (3.0.3RC2) in my 
project.

I looked up the function that I can't call:

{code:java}
public virtual TopFieldDocs Search(Query query, Filter filter, int n, Sort sort)
{code}

I wanted to check if the function I called is from the base class or had been 
overridden, so I did the following test:

{code:java}
var ClassType = typeof(IndexSearcher);
var Method = ClassType.GetMethod("Search", new[] {typeof(Query), 
typeof(Filter), typeof(int), typeof(Sort)});
var IsOverridden = Method.DeclaringType != typeof(Searcher);
{code}

And it turns out that the code used is the one from the base class, so I did 
comment out the 'virtual' keyword to see what happens:

{code:java}
public /*virtual*/ TopFieldDocs Search(Query query, Filter filter, int n, Sort 
sort)
{code}

And... *it works!*

So, now we have confirmation that the problem is tied to the virtual function 
table, as outlined by the disassembly above.
It looks like the .net code is auto generated from Java and this is not 
something I'm familiar with; I am not sure if you have any ideas where the 
issue could come from?

As we know the code is not overriding the method, the pointer should point to 
the base class, but somehow it doesn't..


was (Author: thomasd3):
I'm making a bit of headway: I put the source of Lucene.Net (3.0.3RC2) in my 
project.

I looked up the function that I can't call:

{code:java}
public virtual TopFieldDocs Search(Query query, Filter filter, int n, Sort sort)
{code}

I wanted to check if the function I called is from the base class or had been 
overridden, so I did the following test:

{code:java}
var ClassType = typeof(IndexSearcher);
var Method = ClassType.GetMethod("Search", new[] {typeof(Query), 
typeof(Filter), typeof(int), typeof(Sort)});
var IsOverridden = Method.DeclaringType != typeof(Searcher);
{code}

And it turns out that the code used is the one form the base class, so I did 
comment out the 'virtual' keyword to see what happens:

{code:java}
public /*virtual*/ TopFieldDocs Search(Query query, Filter filter, int n, Sort 
sort)
{code}

And... *it works!*

So, now we have confirmation that the problem is tied to the virtual function 
table, as outlined by the disassembly above.
It looks like the .net code is auto generated from Java and this is not 
something I'm familiar with; I am not sure if you have any ideas where the 
issue could come from?

As we know the code is not overriding the method, the pointer should point to 
the base class, but somehow it doesn't..

> Crash using the search function 
> --------------------------------
>
>                 Key: LUCENENET-554
>                 URL: https://issues.apache.org/jira/browse/LUCENENET-554
>             Project: Lucene.Net
>          Issue Type: Bug
>          Components: .NET API, Lucene.Net Core
>    Affects Versions: Lucene.Net 3.0.3
>         Environment: .NET 4.5.3
>            Reporter: Thomas D
>            Priority: Critical
>              Labels: Crash
>
> I can repeat the crash with with the following code:
> {code:java}
> Document.Add(new NumericField("TimeStamp", Field.Store.YES, 
> true).SetLongValue(Data.TimeStamp.ToBinary()));
> {code}
>  
> And I have the following query:
> {code:java}
> var Sort = new Sort(new SortField("TimeStamp", SortField.LONG, true));
>         var ParsedQuery = ParseQuery(_Parser, SearchQuery);
>         var Filter = new QueryWrapperFilter(ParsedQuery);
>         var Hits = _Searcher.Search(ParsedQuery, Filter, Skip + Limit, Sort);
> {code}
>  
> But it crashes when executing the search method with the following:
> {noformat}
> A first chance exception of type 
> 'Lucene.Net.QueryParsers.QueryParser.LookaheadSuccess' occurred in 
> Lucene.Net.dll
> A first chance exception of type 'System.IO.IOException' occurred in 
> Lucene.Net.dll
> A first chance exception of type 'System.IO.IOException' occurred in 
> Lucene.Net.dll
> A first chance exception of type 'System.AccessViolationException' occurred 
> in HDIndexing.dll
> Additional information: Attempted to read or write protected memory. This is 
> often an indication that other memory is corrupt.
> {noformat}
> The weird thing is that when executing this code:
> {code:java}
> var Hits = _Searcher.Search(ParsedQuery, null, Skip + Limit, Sort.RELEVANCE);
> var SortSetting = Sort.RELEVANCE;
> var Hits0 = _Searcher.Search(ParsedQuery, null, Skip + Limit, SortSetting);
> {code}
> The first call doesn't crash, but the second one does.
> When looking at the disassembly, the crash happens when calling the search 
> method (http://imgur.com/MFmAwzC).
> I made a video illustrating the problem: http://imgur.com/NGyFRdS



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to