lbehnke / h2database

Automatically exported from code.google.com/p/h2database
0 stars 0 forks source link

TestMvccMultiThreaded.testConcurrentUpdate might not test concurrency #166

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Running TestMvccMultiThreaded.testConcurrentUpdate

What is the expected output? What do you see instead?
Test passes but is not guaranteed to have run concurrently the threads it
created.

Please use labels and text to provide additional information.
In testConcurrentUpdate, we see a loop creating Threads and starting them
(lines 92-106). Immediately after, we wait for all threads to finish (lines
107-109). 

I see a possibility where the first thread finishes before the second is
started (ie, when starting the second thread in line 105, the first thread
may have already completed and so we are not testing concurrency).
Admittedly, this is unlikely since each thread calls its SQL 1000 times.
But I propose a patch (see attached) that guarantees at least the first SQL
call of each thread is synched. Maybe we want all iterations to be paired
with its counterpart in the other thread - I don't know.

This is low priority. 

Original issue reported on code.google.com by PhillHe...@gmail.com on 23 Feb 2010 at 12:10

Attachments:

GoogleCodeExporter commented 9 years ago
Hi,

Thanks! I will commit this patch. I will also simplify exception handing:
only catch Exception, and 'break' on exception.

Original comment by thomas.t...@gmail.com on 26 Feb 2010 at 8:55

GoogleCodeExporter commented 9 years ago
Fixed in version 1.2.130.

Original comment by thomas.t...@gmail.com on 26 Feb 2010 at 4:33