brody1994 / h2database

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

closeWatcher registration is not concurency-safe #411

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Take a look at CloseWatcher line 101 (v.1.3.166). Code adds to the 
unsynchronized set new closeWatcher. That is not nice. Pls wrap static refs 
variable with synchronized set. Additionally, there is another init of refs 
which is dead code at line 99. 

Actual vs expected results should be obvious, so I will ommit. Thank you!

Here is a snippet of stack trace:

"CT8" prio=10 tid=0x00002addb0797000 nid=0x134b runnable [0x00000000469ff000]
   java.lang.Thread.State: RUNNABLE
    at java.util.HashMap.put(HashMap.java:374)
    at java.util.HashSet.add(HashSet.java:200)
    at org.h2.util.CloseWatcher.register(CloseWatcher.java:101)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:122)
    at org.h2.jdbc.JdbcConnection.<init>(JdbcConnection.java:94)
    at org.h2.Driver.connect(Driver.java:72)
    at org.h2.jdbcx.JdbcDataSource.getJdbcConnection(JdbcDataSource.java:181)
    at org.h2.jdbcx.JdbcDataSource.getConnection(JdbcDataSource.java:156)
    at com.jpmc.firmrisk.core.calc.datalayer.impl.LockForH2.createCheckedReadConnectionPool(LockForH2.java:257)

Original issue reported on code.google.com by kirilz...@gmail.com on 1 Aug 2012 at 3:28

GoogleCodeExporter commented 9 years ago
actually, I just noticed that refs variable is public, so it maybe null'ed 
somewhere else - I did not check.

Thanks again,
Kiril Zack

Original comment by kirilz...@gmail.com on 1 Aug 2012 at 3:53

GoogleCodeExporter commented 9 years ago
Fixed in the trunk

Original comment by thomas.t...@gmail.com on 30 Oct 2012 at 11:42

GoogleCodeExporter commented 9 years ago
Fixed in version 1.3.170

Original comment by thomas.t...@gmail.com on 30 Nov 2012 at 6:52