Hello,

According to documentation, *closing the last connection closes the 
database* (http://www.h2database.com/html/cheatSheet.html) and *when 
closing the database, the database is automatically compacted for up to 200 
milliseconds *(http://www.h2database.com/html/features.html#compacting). I 
guess these together may cause data loss & corruption when a single 
connection is repeatedly created, data altered, connection closed, new 
connection created, etc. -  eventually resulting in exception such as 
"Block not found in id [1, -128, 8, 42] [1.4.186/50]" when trying to access 
the DB. Test case here: http://www.mysticpaste.com/view/RzEhFjCXwT . 
Version 1.3.176 (last stable) works fine with this, version 1.4.186 crashes 
and corrupts data.

The behavior can be fixed by appending ";DB_CLOSE_DELAY=-1" to the DB URL, 
i.e. disabling autoclosing DB when last connection is closed. I though it 
might have had something to do with 1.4's new "FS" file locking protocol (h
ttp://www.h2database.com/html/advanced.html#file_locking_protocols), but 
changing that to old "FILE" doesn't seem to help.

Of course this is not how a DB connection is typically used - when using a 
connection pool, this would go unnoticed - and I found this purely by 
accident. But it's a bug anyway, isn't it?

Best Regards,
Joonas

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.

Reply via email to