Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
None
-
None
-
None
Description
Hi,
The bug appears clearly when two queries race to print their output using AObjectPrinter singleton in the same DataFormat.
public void print(byte[] b, int start, int l, PrintStream ps) throws AlgebricksException { try { listAccessor.set(b, start, l); arg.first = ps; listAccessor.accept(printVisitor, arg); } catch (Exception ioe) { throw new AlgebricksException(ioe); } }
Since there's only one instance of AObjectPrinter, this will be a critical section and things will lose track (such as ps and listAccessor).
I think new printer should be instantiated for each query.
To produce the problem:
Running the query in two clients:
//As in runtimets/queries/open-closed/query-issue55.3.query.aql for $x in [[1,3],[4,5,2],[-1,-3,0],["a"]] return $x
interchange the execution sequence in the two threads such as:
Thread 1 run: listAccessor.set(b, start, l);
Thread 2 run: listAccessor.set(b, start, l);
Thread 1 resume running.
Thread 2 resume running.