Timeout trying to lock table "SYS"

25 views
Skip to first unread message

rafel

unread,
Oct 2, 2019, 10:33:36 AM10/2/19
to H2 Database
I am using h2 (1.4.199) as the basis of a "data-preparation"-tool, i.e. with a focus on creating/editing/dropping tables. I am aware that h2 (mvstore) may not have been developed for such an application.

My problem: I run into an exception on multi-threaded table editing. The attached 72-line java program starts two threads that repeatedly create/edit/drop each of them one table. After a few cycles there seems to be a deadlock that seems to be resolved after 2000 ms, one of the two threads dies (in my code), the other continues. Here is a typical output on my computer (core-i5 with 8Gbyte).


Started two threads 'AAA' and 'BBB'

thread AAA required 2021 ms at step: 39

thread BBB stopped with exception at step: 37
    msg: Timeout trying to lock table "SYS"; SQL statement:
alter table BBB add column if not exists X BIGINT as -1L [50200-199]

thread: AAA finished OK



Is there anything I could change to prevent this error ?

regards, rafel
Test.java
Reply all
Reply to author
Forward
0 new messages