Hi all,
I apologize for the german post on this english mailinglist...So here we go in english:
I have recently migrated my BaseX application from version 7.2 to 7.6 (and 7.6.1 Beta). The BaseX lib throws exceptions while running concurrent XQuery queries and updates (based on a threadpool), see the exceptions attached below (the specific numeric error-code changes slightly but the error occurs every time on the same line of code). The error itself seems to happen unter heavy concurrency (sequential queries have no problem) and not every time query executes.
The application code is as follows (class de.infabswissarmy.control.XMLDBManagerBaseX.query):
public ArrayList<String> query(String inQuery, String[][] inArgs){ ClientSession mySession = null; ClientQuery myQuery = null; ArrayList<String> tmpString = new ArrayList<String>(); try { mySession = getClientSession(); myQuery = mySession.query(inQuery);
// bind variable if (inArgs != null){ for (int i=0; i < inArgs.length; i++){ myQuery.bind("$" + inArgs[i][0], inArgs[i][1]); } } while (myQuery.more()){ // **exception is in this line ** tmpString.add(myQuery.next()); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } finally { if (myQuery != null){ try { myQuery.close(); } catch (BaseXException e) { // ignore } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } } } return tmpString; }
To be complete this is the used helper function:
private static ClientSession getClientSession() throws IOException { ClientSession mySession = new ClientSession("localhost", 1984, "admin", "admin"); return mySession; }
Version 7.2 is running without problems. In version 7.6 I have seen some rare Java heap space errors at the same location, and once I even saw a massive growth of the DB > 1GB (normal size would be 1MB), but this may be another error and I cannot reproduce it. I will try to deliver a selfcontained min-example, but this could be quite an effort to do (it will take some time to produce it). So I hope that you might find the problem with the delivered information.
Many thanks once again for this great XML-DB and thanks in advance for your help! Bodo
-- attached error stack with version 7.6.1 (in 7.6 the error occurs in row 79 instead of 81) org.basex.core.BaseXException: -146032 at org.basex.server.ClientQuery.cache(ClientQuery.java:81) at org.basex.server.Query.more(Query.java:74) at de.infabswissarmy.control.XMLDBManagerBaseX.query(XMLDBManagerBaseX.java:86) at de.infabswissarmy.control.XMLDBManagerBaseX.queryDoc(XMLDBManagerBaseX.java: 121) at de.infabswissarmy.control.QueryTask.httpQuery(QueryTask.java:180) at de.infabswissarmy.control.QueryTask.run(QueryTask.java:271) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) org.basex.core.BaseXException: 0 at org.basex.server.ClientQuery.cache(ClientQuery.java:81) at org.basex.server.Query.more(Query.java:74) at de.infabswissarmy.control.XMLDBManagerBaseX.query(XMLDBManagerBaseX.java:86) at de.infabswissarmy.control.XMLDBManagerBaseX.queryDoc(XMLDBManagerBaseX.java: 121) at de.infabswissarmy.control.QueryTask.httpQuery(QueryTask.java:180) at de.infabswissarmy.control.QueryTask.run(QueryTask.java:271) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source) org.basex.core.BaseXException: java.lang.ArrayIndexOutOfBoundsException at org.basex.server.ClientQuery.cache(ClientQuery.java:81) at org.basex.server.Query.more(Query.java:74) at de.infabswissarmy.control.XMLDBManagerBaseX.query(XMLDBManagerBaseX.java:86) at de.infabswissarmy.control.XMLDBManagerBaseX.queryDoc(XMLDBManagerBaseX.java: 121) at de.infabswissarmy.control.QueryTask.httpQuery(QueryTask.java:180) at de.infabswissarmy.control.QueryTask.run(QueryTask.java:271) at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) at java.lang.Thread.run(Unknown Source)