AIOBE when running concurrent search

User 6686efeff7

09-02-2009 14:33:57

Hi








I am getting a ArrayIndexOutOfBoundsException when running concurrent search using JChemBase.








I am using JChem 5.1.2





Platform  Windows XP SP2 / Java 1.6





The code that is called concurrently by the two threads and the exception stack trace is given below.











Thanks





Wiraj





CODE:














    public int[] find( String smiles, int jChemSearchType ) throws ChemistryException


    {


        try


        {


            if ( SMILESRecognizer.canBeSMILES( smiles ))


            {


                JChemSearch searcher = new JChemSearch();


                searcher.setQueryStructure(smiles);


                searcher.setConnectionHandler(wrapper.getHandler());


                searcher.setStructureTable( DatabaseConstants.TABLE_NAME );


                JChemSearchOptions searchOptions = new JChemSearchOptions();


                searchOptions.setSearchType( jChemSearchType );


                searcher.setSearchOptions(searchOptions);


//                 searcher.setRunMode( JChemSearch.RUN_MODE_SYNCH_COMPLETE );


                runSearch( searcher );


                int ids[] = searcher.getResults();


                return ids;


            }


            return new int[0];


        }


        catch (SQLException e)


        {


            throw new ChemistryException( e );


        }


    }















    private void runSearch(JChemSearch searcher) throws ChemistryException


    {


        assert ( searcher != null );


        try


        {


            searcher.run();


        }


        catch (MolFormatException e)


        {


            throw new ChemistryException ( e );


        }


        catch (DatabaseSearchException e)


        {


            throw new ChemistryException ( e );


        }


        catch (SQLException e)


        {


            throw new ChemistryException ( e );


        }


        catch (IOException e)


        {


            throw new ChemistryException ( e );


        }


        catch (PropertyNotSetException e)


        {


            throw new ChemistryException ( e );


        }


    }















Thread 1 stack trace


java.lang.ArrayIndexOutOfBoundsException: 2


    at chemaxon.enumeration.QueryBondListEnumerator.generateOutMol(QueryBondListEnumerator.java:164)


    at chemaxon.enumeration.BondListEnumerator.nextElement0(BondListEnumerator.java:138)


    at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)


    at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)


    at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)


    at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)


    at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)


    at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)


    at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)


    at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)


    at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)


    at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)


    at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)


    at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)















Thread 2 stack trace


java.lang.ArrayIndexOutOfBoundsException: -1


    at java.util.ArrayList.remove(ArrayList.java:392)


    at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:470)


    at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)


    at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)


    at chemaxon.enumeration.CombinationEnumerator.step(CombinationEnumerator.java:478)


    at chemaxon.enumeration.CombinationEnumerator.filteredSteps(CombinationEnumerator.java:446)


    at chemaxon.enumeration.CombinationEnumerator.nextElement0(CombinationEnumerator.java:399)


    at chemaxon.enumeration.MolEnumerator.nextElement(MolEnumerator.java:560)


    at chemaxon.jchem.db.JChemSearch.enumeratedSearch(JChemSearch.java:5237)


    at chemaxon.jchem.db.JChemSearch.search1(JChemSearch.java:2524)


    at chemaxon.jchem.db.JChemSearch.search(JChemSearch.java:2336)


    at chemaxon.jchem.db.JChemSearch.setRunning(JChemSearch.java:2172)


    at chemaxon.jchem.db.JChemSearch.run(JChemSearch.java:2199)

ChemAxon a3d59b832c

09-02-2009 15:29:16

Hi Wiraj,





Do you have the query that produced this exception?

















Thanks,





Szabolcs

User 6686efeff7

09-02-2009 17:10:55

Quote:
Hi Wiraj,





Do you have the query that produced this exception?

















Thanks,





Szabolcs






The call to the find() method by both threads is identical to





find( "cccc",  SearchConstants.SUBSTRUCTURE );





I am using HSQLDB 1.8.0.10 standalone to store the data, the database contains slightly more than  6000 molecules.





Thanks





Wiraj

ChemAxon a9ded07333

11-02-2009 09:56:59

Hi Wiraj,








I could reproduce the errors in our 5.1.* series, but it does not occur in the to-be-released 5.2 version (the components throwing the errors has been extensively refactored in this new version).





Since we don't plan to release new 5.1.* versions, I offer to upgrade to 5.2 as soon as it is released. We plan to release it in some weeks.





Regards,


Tamás

User 6686efeff7

11-02-2009 13:13:28

Quote:
Hi Wiraj,








I could reproduce the errors in our 5.1.* series, but it does not occur in the to-be-released 5.2 version (the components throwing the errors has been extensively refactored in this new version).





Since we don't plan to release new 5.1.* versions, I offer to upgrade to 5.2 as soon as it is released. We plan to release it in some weeks.





Regards,


Tamás






Hi Tamás


No problem we will wait for a few weeks and upgrade to JChem 5.2*





Thanks,





Wiraj