GitHub user laimis opened a pull request:

    https://github.com/apache/lucenenet/pull/126

    fix Bits2words logic

    TestOpenBitSet.TestSmall test was failing with out of memory exception 
which you can see here: 
http://teamcity.codebetter.com/viewLog.html?buildId=185366&tab=buildResultsDiv&buildTypeId=LuceneNet_Core#testNameId-1093084322476268678).
 Trying to run it locally with timeout restriction removed resulted in the test 
process using 4 or more GB of RAM within seconds. After looking into it more, 
narrowed down what was triggering the condition: bug in Bits2words logic which 
would get triggered when numBits parameter was set to 0.
    
    To reproduce and observe the results, run TestOpenBitSet.TestSmall test and 
put a breakpoint here 
https://github.com/apache/lucenenet/blob/master/src/Lucene.Net.Tests/core/Util/TestOpenBitSet.cs#L174
 with condition of sz == 0 so that it triggers when random int generation 
returns 0. You will see then that OpenBitSet constructor instead of 
initializing bits array of 0 length will initialize it to 67108864 and then it 
is all downhill from there.
    
    Verified the fix by running Lucene Java tests and made sure the math came 
out the same for 0 input, where the result is 0 instead of 67108864.
    
    Here is Java version: 
    
    
https://github.com/apache/lucene-solr/blob/lucene_solr_4_8_0/lucene/core/src/java/org/apache/lucene/util/OpenBitSet.java#L854

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/laimis/lucenenet openbitset_fix

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/lucenenet/pull/126.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #126
    
----
commit 8223d5498231cff7034d5034bda8d2e2adfd1205
Author: Laimonas Simutis <[email protected]>
Date:   2015-03-08T01:59:16Z

    fix Bits2words logic

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to