Vojtěch
Vojtěch

Reputation: 12416

Hibernate locking MySQL with one single query

I am having a strange issue with Hibernate/MySQL, where the database is locked and blocks completely all queries. show processlist says following: https://gist.github.com/knyttl/aec84d0abfc3f5fcd921

It seems to me really strange that such simple query can lock the table. Especially as the transaction is as short as this native query.

I find it especially strange that it blocks ALL other queries on ALL tables.

Upvotes: 1

Views: 429

Answers (1)

Vlad Mihalcea
Vlad Mihalcea

Reputation: 153730

If there is any locked table, you would see a Locked state in the process list.

So that simple query runs and the locks are released when its transaction ends.

In your case I suspect you don't close the database connections when you are done with them. That would explain why the database seems blocked. The database may be fine, but the connections are already allocated, so you cannot acquire new ones.

Upvotes: 1

Related Questions