well I am using the latest version 9.1.2 which I downloaded a couple of days ago. I tried it both on Windows 10 and on Ubuntu 18.04, it shows the same behaviour. (sorry, I should have added these detail in the original email already...). The error first appeared way back with version 8.something, but I was unable to pinpoint it as it was very sporadic.
I attached a screenshot of how it looks like in basexgui right after step 8. I can reproduce it here anytime. I also tried creating the database via the GUI as well as using xquery, I also played with UPDINDEX and AUTOOPTIMIZE - it did not make any difference.
I also attached the broken databases, each with different indexing options as described.
From our Java application the error looks looks this, it is always at the very first query attempt after the databasse has corrupted:
Improper use? Potential bug? Your feedback is welcome:
Version: BaseX 9.1.2
Java: Oracle Corporation, 1.8.0_162
OS: Windows 10, amd64
Stack Trace:
java.lang.ArrayIndexOutOfBoundsException: 2147483647
at org.basex.io.random.TableDiskAccess.fpre(TableDiskAccess.java:502)
at org.basex.io.random.TableDiskAccess.cursor(TableDiskAccess.java:453)
at org.basex.io.random.TableDiskAccess.read1(TableDiskAccess.java:151)
at org.basex.data.Data.kind(Data.java:304)
at org.basex.query.value.node.DBNode.<init>(DBNode.java:50)
at org.basex.query.value.seq.DBNodeSeq.itemAt(DBNodeSeq.java:70)
at org.basex.query.value.seq.DBNodeSeq.itemAt(DBNodeSeq.java:1)
at org.basex.query.value.seq.Seq$1.get(Seq.java:95)
at org.basex.query.iter.BasicIter.next(BasicIter.java:38)
at org.basex.query.expr.path.CachedPath.nodeIter(CachedPath.java:42)
at org.basex.query.expr.path.AxisPath.iter(AxisPath.java:66)
at org.basex.query.expr.path.AxisPath.iter(AxisPath.java:37)
at org.basex.query.func.fn.FnCount.item(FnCount.java:25)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:48)
at org.basex.query.expr.constr.Constr.add(Constr.java:70)
at org.basex.query.expr.constr.CElem.item(CElem.java:93)
at org.basex.query.expr.constr.CElem.item(CElem.java:1)
at org.basex.query.expr.ParseExpr.iter(ParseExpr.java:48)
at org.basex.query.expr.constr.Constr.add(Constr.java:70)
at org.basex.query.expr.constr.CElem.item(CElem.java:93)
at org.basex.query.expr.constr.CElem.item(CElem.java:1)
at org.basex.query.expr.ParseExpr.value(ParseExpr.java:71)
at org.basex.query.expr.gflwor.Let$LetEval.next(Let.java:175)
at org.basex.query.expr.gflwor.GFLWOR$1.next(GFLWOR.java:88)
at org.basex.query.QueryContext.next(QueryContext.java:400)
at org.basex.query.scope.MainModule$1.next(MainModule.java:122)
at org.basex.core.cmd.AQuery.query(AQuery.java:111)
at org.basex.core.cmd.XQuery.run(XQuery.java:22)
at org.basex.core.Command.run(Command.java:257)
at org.basex.core.Command.execute(Command.java:93)
at org.basex.core.Command.execute(Command.java:116)