Hi!
From time to time I see the following error:
java.io.IOException: Stream Closed at java.io.RandomAccessFile.seek0(Native Method) at java.io.RandomAccessFile.seek(RandomAccessFile.java:557) at org.basex.io.random.TableDiskAccess.readBlock(TableDiskAccess.java:520) at org.basex.io.random.TableDiskAccess.readPage(TableDiskAccess.java:485) at org.basex.io.random.TableDiskAccess.cursor(TableDiskAccess.java:464) at org.basex.io.random.TableDiskAccess.read1(TableDiskAccess.java:148) at org.basex.data.Data.kind(Data.java:307) at org.basex.query.value.node.DBNode$4.next(DBNode.java:349) at org.basex.query.expr.path.IterStep$1.next(IterStep.java:38) at org.basex.query.expr.path.IterStep$1.next(IterStep.java:32) at org.basex.query.expr.path.IterPath$1.next(IterPath.java:58) at org.basex.query.expr.path.IterPath$1.next(IterPath.java:36) at org.basex.query.expr.gflwor.For$1.next(For.java:79) at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:95) at org.basex.query.MainModule$1.next(MainModule.java:114) at org.basex.server.ServerQuery.execute(ServerQuery.java:130) at org.basex.api.client.LocalQuery.cache(LocalQuery.java:48) at org.basex.api.client.Query.more(Query.java:76)
An example of how I query and iterate: DBResult dbResult = null; LocalQuery results = null; try { xPath = xPath.indexOf("/") == -1 ? "/" + xPath : xPath; String myQuery = "for $doc in (" + getContentCollectionQuery(PPSCONTENT_DATABASE_NAME) + " ) " + xPath + createNameCondition(name, PPSCONTENT_DATABASE_NAME) + createDateCondition(version) + " " + " return (data($doc/topic/@id))"; dbResult = runQuery(myQuery); results = dbResult.getXmlResults(); String topic = null; if (results.more()) { topic = results.next(); } return topic; } catch (QueryException e) { PPLogger.getInstance().error("Error in getTopicForDocWithName: " + e.getMessage()); return null; } catch (IOException e) { PPLogger.getInstance().error("Error in getTopicForDocWithName: " + e.getMessage()); return null; } finally { if (results != null) results.close(); if (dbResult != null) dbResult.close(); }
The error occurs randomly, but is always "triggered" by "results.more()" and I am not able to reproduce it at will. Is there something wrong or missing in how I iterate the results? I am using BaseX8.2.1 on windows 7.
Kind regards Ketill Fenne