8

I get this error sometimes on a session scoped component, still haven't figured out what is causing this to fail. Any ideas?

ERROR [Exceptions] handled and logged exception
javax.el.ELException: org.jboss.seam.core.LockTimeoutException: could not acquire lock on @Synchronized component: importUser
Joe
  • 14,513
  • 28
  • 82
  • 144

2 Answers2

17

Session scoped components are synchronized by default. That means, Seam takes care that only one request at a time may access such a component. All other requests have to wait until the first is finished. To prevent starvation, the waiting requests have a timeout (see org.jboss.seam.core.SynchronizationInterceptor for the corresponding implementation). When the waiting request does not get access to the component until the timeout is reached, the SynchronizationInterceptor throws a org.jboss.seam.core.LockTimeoutException.

Assuming to requests, A and B, need your importUser component and A is first. If A takes a long time to finish, B will end in the LockTimeoutException. To find the cause of your issue, try to find out how a request to importUser may take longer than the defined timeout.

kraftan
  • 6,272
  • 2
  • 22
  • 24
  • This doesn't happen because there is a long running command, but seems to surface when there is an Exception being thrown from this method and you are trying to re-access the same functionality. – Joe Oct 14 '10 at 03:28
4

I had a page where this would happen infrequently under heavy load. I was able to reduce the frequency of this occurring by putting this annotation on the offending Seam object class:

@Synchronized(timeout=5000)

That increases the timeout to five seconds instead of the default one second Seam gives them. It's just a band-aid, but I wasn't up for rewriting that behemoth.

iandisme
  • 6,346
  • 6
  • 44
  • 63