Timeout trying to lock table

2,254 views
Skip to first unread message

Viji

unread,
Dec 4, 2011, 12:24:56 PM12/4/11
to H2 Database
Hi,
We are getting Timeout trying to lock table error in the h2 database.
Can anyone one please point us why it is coming ?
ts=2011-12-02T03:28:09.555Z level=Excep
class=gov.lbl.bdm.gsiftp.GsiFTPParallelBrowsing Timeout trying to lock
table "SYS"; SQL statement:

insert into status_1 (dir_id, file_name, tgt_id, endpoint_id,
size,status,statuscode,lastModificationTime,timestamp) values
(?,?,?,?,?,?,?,?,?) [50200-159]
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
org.h2.message.DbException.get(DbException.java:169)
org.h2.message.DbException.get(DbException.java:146)
org.h2.table.RegularTable.doLock(RegularTable.java:506)
org.h2.table.RegularTable.lock(RegularTable.java:440)
org.h2.engine.Database.removeMeta(Database.java:733)
org.h2.engine.Database.update(Database.java:1359)
org.h2.schema.Sequence.flush(Sequence.java:127)
org.h2.schema.Sequence.getNext(Sequence.java:92)
org.h2.expression.SequenceValue.getValue(SequenceValue.java:30)
org.h2.table.Column.validateConvertUpdateSequence(Column.java:268)
org.h2.table.Table.validateConvertUpdateSequence(Table.java:679)
org.h2.command.dml.Insert.insertRows(Insert.java:120)
org.h2.command.dml.Insert.update(Insert.java:84)
org.h2.command.CommandContainer.update(CommandContainer.java:71)
org.h2.command.Command.executeUpdate(Command.java:212)
org.h2.jdbc.JdbcPreparedStatement.executeUpdateInternal(JdbcPreparedStatement.java:
143)

Noel Grandin

unread,
Dec 5, 2011, 3:29:24 AM12/5/11
to h2-da...@googlegroups.com, Viji
Can you give the full stack-trace, that one is missing information.

Viji

unread,
Dec 5, 2011, 12:25:21 PM12/5/11
to H2 Database
Hi Noel,
Please let me what information is missing here.
The complete insert statement ?
thanks.
Viji

Thomas Mueller

unread,
Dec 5, 2011, 2:20:51 PM12/5/11
to h2-da...@googlegroups.com
Hi,

It looks like the table is still locked by some other thread (similar to a deadlock). Do you have a reproducible test case? If yes, could you post it? Maybe a full thread dump would help:

jps -l
jstack -l <pid>

Regards,
Thomas
--
You received this message because you are subscribed to the Google Groups "H2 Database" group.
To post to this group, send email to h2-da...@googlegroups.com.
To unsubscribe from this group, send email to h2-database...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/h2-database?hl=en.

vijaya natarajan

unread,
Dec 5, 2011, 4:30:33 PM12/5/11
to h2-da...@googlegroups.com
Hi Thomas,
It takes time to reproduce this error. Only when the database size is too large etc.
So, it is related to H2 ? 
Thanks.
Viji

Thomas Mueller

unread,
Dec 13, 2011, 2:08:48 AM12/13/11
to h2-da...@googlegroups.com
Hi,

Hi Thomas,
It takes time to reproduce this error. Only when the database size is too large etc.
So, it is related to H2 ? 

It's hard to tell. Maybe the default lock timeout (1 second = 1000 ms) is simply too small. Does the problem go away if you increase the lock timeout? To do that, append ;LOCK_TIMEOUT=10000 (for 10 seconds) to the database URL (see also the documentation).

If this doesn't help, I would need a reproducible test case, or at least a few full thread dumps (as described).

Regards,
Thomas

priyanka

unread,
Oct 17, 2012, 3:44:07 AM10/17/12
to h2-da...@googlegroups.com, Viji
hello sir,

When iam using remote connection using h2 database i.e server and client process..which works perfectly in h2 database but suddenly...

iam getting this exception  Timeout trying to lock table error in the h2 database

I gave all the setting then also iam getting the same

mvcc=true;lock_timeout=100000;lock_mode=0;auto_reconnect=true;auto_server=true;AUTOCOMMIT=OFF

Only one single table is getting locked..the table with huge memory...the table is unable to read and write...and getting locked.....iam sure its a deadlock...

Please help me how to avoid this exception...

Thanks in advance...

Noel Grandin

unread,
Oct 17, 2012, 5:18:18 AM10/17/12
to h2-da...@googlegroups.com, priyanka, Viji

On 2012-10-17 09:44, priyanka wrote:
>
> Only one single table is getting locked..the table with huge
> memory...the table is unable to read and write...and getting
> locked.....iam sure its a deadlock...
>

Then you need to debug the problem using something like VisualVM.

More than likely the problem is that you have a connection that is
beginning a transaction and then forgetting to call commit().

Reply all
Reply to author
Forward
0 new messages