I'm using the C# driver. but still, it doesn't look like a high level problem. neither a query problem. thats why I didn't post some code snippets. To make sure, I just tried to execute the INSPECT command in the CLI. same exception. Also the db:optimize fails with the same exception, although with a different stacktrace, which I will post below.
Altough the race condition point of two processes interfering is a good point, I'm currently having trouble to do anything useful with a session from which a race condition would matter. If, then it must have happened while the import was running along with the other, non-importing process.
As I mentioned in the first post, while the import process was still ongoing, the other process already started to have the exception at a very late progress of the import. After the import was done, I was still able to operate on the db as normal, but only with the session in the process which did the long-run import.
To restore the second process its session state to normal, I restarted the webapplication, which closes both sessions. After that, I'm no longer to operate on the db. Not even directly from the CLI.
Seems it is a sort of a persisted data state which the low level basex code can't handle when trying to reread it into to the memory.
I 've already googled around for the same exception in BaseX, seems it was an issue in some older versions too.
here the stacktrace when running db:optimize:
Improper use? Potential bug? Your feedback is welcome:
Contact:
basex-talk@mailman.uni-konstanz.deVersion: BaseX 9.0.2 beta
Java: Oracle Corporation, 1.8.0_151
OS: Linux, amd64
Stack Trace:
java.lang.ArrayIndexOutOfBoundsException: 52
at org.basex.util.hash.TokenSet.key(TokenSet.java:128)
at
org.basex.data.Data.name(Data.java:388)
at org.basex.io.serial.Serializer.node(Serializer.java:414)
at org.basex.io.serial.Serializer.node(Serializer.java:158)
at org.basex.io.serial.Serializer.node(Serializer.java:345)
at org.basex.io.serial.Serializer.node(Serializer.java:158)
at org.basex.io.serial.Serializer.serialize(Serializer.java:109)
at org.basex.core.cmd.OptimizeAll$DBParser.parse(OptimizeAll.java:200)
at org.basex.build.Builder.parse(Builder.java:77)
at org.basex.build.DiskBuilder.build(DiskBuilder.java:77)
at org.basex.core.cmd.OptimizeAll.optimizeAll(OptimizeAll.java:122)
at org.basex.query.up.primitives.db.DBOptimize.apply(DBOptimize.java:124)
at org.basex.query.up.DataUpdates.apply(DataUpdates.java:175)
at org.basex.query.up.ContextModifier.apply(ContextModifier.java:120)
at org.basex.query.up.Updates.apply(Updates.java:157)
at org.basex.query.QueryContext.iter(QueryContext.java:341)
at org.basex.query.QueryProcessor.iter(QueryProcessor.java:90)
at org.basex.core.cmd.AQuery.query(AQuery.java:92)
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.server.ClientListener.run(ClientListener.java:140)