lucene-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Mastroianni <MMastroia...@glgroup.com>
Subject RE: kamikaze
Date Thu, 30 Apr 2009 18:34:05 GMT
Hi-- Using the 1.0.7 jar file, I am having problems with occasional
ArrayIndexOutOfBoundsExceptions and StackOverFlowErrors when trying to
do a find in a P4DocIdSet. Here is a unit test that I can reliably get
to generate a StackOverFlowError. Have you seen this before? Since I'm
using the jar file, I can't really do much debugging of this one.

regards,
Michael


    public void testForOutOfBounds()
    {
        Random rand = new Random(System.currentTimeMillis());
        int maxDoc = 350000;
        ArrayList<Integer> nums = new ArrayList<Integer>();
        HashSet<Integer> seen = new HashSet<Integer>();
        for(int i=0; i < 68; ++i)
        {
            int nextDoc = rand.nextInt(maxDoc);
            if(seen.contains(nextDoc))
            {
                while(seen.contains(nextDoc))
                {
                    nextDoc = rand.nextInt(maxDoc);
                }
            }
            nums.add(nextDoc);
            seen.add(nextDoc);
        }
        Collections.sort(nums);
        DocSet docs = new P4DDocIdSet();
        for (Integer integer : nums) 
        {
            docs.addDoc(integer);
        }
        boolean got = docs.find(403);
    }

-----Original Message-----
From: molz [mailto:anmol.bhasin@gmail.com] 
Sent: Wednesday, April 29, 2009 10:58 PM
To: java-user@lucene.apache.org
Subject: RE: kamikaze


  
Hi Michael,

2 Questions. 

1. What version of Kamikaze are you running with?
2. Can you try the snippet below and let me know if it fails ? I ran it
20
times and it did not fail. Maybe there is some difference in the
utitlity
methods you have ? I am still trying to track down if anything is off at
my
end but does not seem to be.

    public void testMultipleIntersections() 
    { 
            ArrayList<OpenBitSet> obs = new ArrayList<OpenBitSet>(); 
            ArrayList<DocIdSet> docs = new ArrayList<DocIdSet>(); 
        Random rand = new Random(System.currentTimeMillis()); 
            int maxDoc = 350000; 
            for(int i=0; i < 3; ++i) 
            { 
                    int numdocs = rand.nextInt(maxDoc); 
                    ArrayList<Integer> nums = new 
ArrayList<Integer>(); 
                    HashSet<Integer> seen = new HashSet<Integer>(); 
                    for (int j = 0; j < numdocs; j++) 
                { 
                            int nextDoc = rand.nextInt(maxDoc); 
                            if(seen.contains(nextDoc)) 
                            { 
                                    while(seen.contains(nextDoc)) 
                                    { 
                                            nextDoc = 
rand.nextInt(maxDoc); 
                                    } 
                            } 
                            nums.add(nextDoc); 
                            seen.add(nextDoc); 
                } 
                    Collections.sort(nums); 
                    obs.add(createObs(nums, maxDoc)); 
                    docs.add(createDocSet(nums)); 
            } 
            OpenBitSet base = obs.get(0); 
            for(int i = 1; i < obs.size(); ++i) 
            { 
                    base.intersect(obs.get(i)); 
            } 
            
            AndDocIdSet ands = new AndDocIdSet(docs); 
            long card1 = base.cardinality(); 
            long card2 = ands.size(); 
            System.out.println(card1+":"+card2);
            assertEquals(card1, card2); 
    } 


    private OpenBitSet createObs(ArrayList<Integer> nums, int maxDoc) {
      OpenBitSet bitSet = new OpenBitSet(maxDoc);
      for(int num:nums)
        bitSet.set(num);
      return bitSet;
    }
    
    private DocIdSet createDocSet(ArrayList<Integer> nums) {
      DocSet p4d = DocSetFactory.getDocSetInstance(0, 35000000, 200000,
          DocSetFactory.FOCUS.OPTIMAL);
      for(int num:nums)
       p4d.addDoc(num);
      return p4d;
    }

I even tried with the following 

  private DocIdSet createDocSet(ArrayList<Integer> nums) {
      P4DDocIdSet p4d = new P4DDocIdSet();
      for(int num:nums)
       p4d.addDoc(num);
      return p4d;
    }


 The NPE you mention in the previous emails has been identified as a bug
and
will be fixed in the next release (in a day or two). 

Thanks,
Anmol


-- 
View this message in context:
http://www.nabble.com/kamikaze-tp23224760p23307098.html
Sent from the Lucene - Java Users mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org



This e-mail message, and any attachments, is intended only for the use of the individual or
entity identified in the alias address of this message and may contain information that is
confidential, privileged and subject to legal restrictions and penalties regarding its unauthorized
disclosure and use. Any unauthorized review, copying, disclosure, use or distribution is strictly
prohibited. If you have received this e-mail message in error, please notify the sender immediately
by reply e-mail and delete this message, and any attachments, from your system. Thank you.



---------------------------------------------------------------------
To unsubscribe, e-mail: java-user-unsubscribe@lucene.apache.org
For additional commands, e-mail: java-user-help@lucene.apache.org


Mime
View raw message