I did not try it, because the bug occurs randomly. You should try it a lot of time to trigger it. Another possibility to increase the probability to see the bug is to run complex requests.
I agree that this looks like a classical concurrency bug, but I still have a hard time narrowing it down, as I didn't manage yet to reproduce the problem without Eclipse and without stdout. Your test looks actually pretty similar to numerous other test cases that we've been using for a long time, e.g. the following one:
https://github.com/BaseXdb/basex-tests/blob/master/src/test/java/org/basex/t...
Maybe there's a small, but important difference that I missed by comparing the approaches?
One more thought.. Have you done some testing with Java 6? I may be completely wrong, but I’m wondering if this bug is related to Java 7. We came across some other concurrency issues that did not happen with JDK/JRE 6 (some of which have already been fixed in the latest Java 7 patches).
Next, you could try to adjust the maximum number of parallel readers, and see what happens. This can be done by editing the .basex configuration file [1] and adjust the PARALLEL option [2]. If the error should persist when setting the number to "1", this could indicate that the problem is not related to our concurrency model, but the (un)locking of database files. In the past, we had similar problems with deleting and re-creating files. It may sound strange, but File.delete() won't always delete a file, even if there is no lock attached to it..
Christian
[1] http://docs.basex.org/wiki/Configuration#Configuration_Files [2] http://docs.basex.org/wiki/Options#PARALLEL
..some first feedback: your example causes no problems when being run from the command line.
However, I managed to reproduce the bug when running your example from within Eclipse. The error won’t occur when I suppress the dump to stdout, or forward it to a file.
Two questions that might help to narrow down the issue:
- did you also use for Eclipse for testing?
- do you manage to reproduce the bug when running the example outside
Eclipse?
- what happens if you suppress the text output?
Thanks, Christian ___________________________________
On Wed, Sep 26, 2012 at 3:31 PM, Samuel Lacmene samuel.lacmene@buit-solutions.com wrote:
Dear Christian,
Thank you for the answer. I have tried to reproduce the BUG with the last Snapshot, but it still persists. So, I wrote a small example based on the factbook.xml, the bug occurred in the first 2 tests and then it has disappeared (See the example in the attachment).
I have remarked that, to have more chance to see the BUG, you have to stop and start the basex-server and run the example.
Best regards Samuel
-----Ursprüngliche Nachricht----- Von: Christian Grün [mailto:christian.gruen@gmail.com] Gesendet: Montag, 24. September 2012 00:10 An: samuel.lacmene@buit-solutions.com Betreff: Re: [basex-talk] BUG# Multiple Thread try to execute some Query
Dear Samuel Lacmene ,
sorry for the delay, and thanks for the bug report. First of all, I'd be interested if the bug persists with the latest stable snapshot [1]? If that should be the case, I'be glad if you could provide us with a small example [2] that allows us to reproduce the issue.
Thanks in advance, Christian
[1] http://files.basex.org/releases/latest/ [2] http://sscce.org/
basex-talk@mailman.uni-konstanz.de