Forums

Home » Liferay Portal » English » Liferay Legacy

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Wayne Babich
Getting database deadlocks when many people are adding portlets to pages
December 14, 2006 2:49 PM
Answer

Wayne Babich

Rank: Junior Member

Posts: 29

Join Date: January 16, 2006

Recent Posts

I hope somebody can help us.

We're seeing database deadlocks when multiple people are simultaneously doing things that update the database. For example: adding a portlet to a page, making a new page, or moving a portlet on the page.

Can anybody provide insight into the scope of a database transaction? I would have thought that it would be a very brief transaction to add a portlet to a page -- it's just a few insert and update statements. Is there some reason why the transaction would be held open for a longer time? For example, is the transaction held open while the new portlet renders itself?

We're using Derby now, if that matters. (Maybe there is a configuration parameter?)

We saw a related problem earlier with HSQL, which caused us to switch to Derby.

Thanks for your help

The message in the log is:
Servlet.service() for servlet MainServlet threw exception

com.liferay.portal.SystemException: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.liferay.counter.service.persistence.CounterHBM#com.liferay.portal.model.Resource]

at com.liferay.counter.service.persistence.CounterPersistence.increment(CounterPersistence.java:123)

at com.liferay.counter.service.persistence.CounterPersistence.increment(CounterPersistence.java:80)



etc.

Caused by: org.hibernate.exception.GenericJDBCException: could not load an entity: [com.liferay.counter.service.persistence.CounterHBM#com.liferay.portal.model.Resource]

at org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)

at org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)

at org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)

etc.

Caused by: SQL Exception: A lock could not be obtained within the time requested

at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown Source)

at org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown Source)
Mika Koivisto
RE: Getting database deadlocks when many people are adding portlets to page
December 15, 2006 1:04 AM
Answer

Mika Koivisto

LIFERAY STAFF

Rank: Liferay Legend

Posts: 1513

Join Date: August 7, 2006

Recent Posts

Embedded databases don't handle simultaneous users that well. You should try MySQL or some other real database. Embedded databases are good for development and unit testing.
Wayne Babich
RE: Getting database deadlocks when many people are adding portlets to page
December 15, 2006 10:59 AM
Answer

Wayne Babich

Rank: Junior Member

Posts: 29

Join Date: January 16, 2006

Recent Posts

We took your advice and switched to MSSQL. Same problem.
Michael Young
RE: Getting database deadlocks when many people are adding portlets to page
December 15, 2006 11:32 AM
Answer

Michael Young

LIFERAY STAFF

Rank: Liferay Master

Posts: 847

Join Date: August 4, 2004

Recent Posts

what version of liferay?
Wayne Babich
RE: Getting database deadlocks when many people are adding portlets to page
December 18, 2006 5:52 AM
Answer

Wayne Babich

Rank: Junior Member

Posts: 29

Join Date: January 16, 2006

Recent Posts

We're using 4.0

On another thread (http://www.liferay.com/web/guest/community/forums/message_boards/message/94764)
Brian tells us that this is a bug in Liferay 4.0 that is fixed in 4.1/4.2
emoticon
Michael Young
RE: Getting database deadlocks when many people are adding portlets to page
December 18, 2006 6:38 AM
Answer

Michael Young

LIFERAY STAFF

Rank: Liferay Master

Posts: 847

Join Date: August 4, 2004

Recent Posts

The most robust code for the counter was just committed last night (LEP-1820) because of some other problems we found with counter concurrency. You might consider updating from either the 4.1.x branch or the 4.2.x branch.