3 Replies Latest reply on Jul 3, 2012 7:09 PM by bradleydouglas

    Deadlocks with AS 6.1

    bradleydouglas

      Hi,

       

      We were running on AS 4.2.3 and have run into memory leaks so we've been forced to migrate to 6.1 but now we're running into a problem where under load  the application locks up and starts generating "ConcurrentAccessTimeoutException ... could not obtain lock within 5MINUTES" error messages.  I initially throught the problem was with AS 6.1 and created this discussion in the AS forums: https://community.jboss.org/thread/200503 however I now think Seam is the culprit.

       

      I know AS 5 is the last vetted version for Seam 2.2, but I've seen that 2.3 is aiming to run on AS 7 (and I presume 6.1 as well given the EJB locking changes would appear to be common).  I've migrated the changes I've noticed in existing (fixed) sychronisaction problems into a patched 2.2.2 build:  JBSEAM-4943 (Patch seam to not use the synchronisation interceptor for stateful session beans).  This has not fixed the problem.

       

      I've used jstack to get a dump of the threads stack traces and confirm there is a deadlock occuring between the AS 6.1 EJB3 synchronisation and Seams in Component.getInstanceFromFactory().  I've attached the full jstack dump as stack1.log.

       

      It appears to me that  there are two locks at play creating the deadlock:

      • Thread http-0.0.0.0-8080-2 has acquired the Seam lock (in Component.getInstanceFromFactory) and is blocking trying to obtain the EJB lock.  The line that thread is blocked on is a simple call from a named SFSB (conversation scoped) to a SLSB:

        documentGenerationTransmissionFormatEnumValues = (OutputFormat[])

                    docService.deriveOutputFormatsFromDocumentList(user, em, Document.Category.RESERVATION);

      • Thread http-0.0.0.0-8080-1 has acquired the EJB lock and is blocked trying to get the Seam lock.  The line that thread is blocked on is the same SFSB (though it should be a different instance as this is a different conversation) is simply resolving a component:

        final List<ServiceFeeSelectionHelper> serviceFeeHelpers =
                    (List<ServiceFeeSelectionHelper>) Component.getInstance("dpabServiceFeeList");

       

      The dpabServiceFeeList is obtained via a factory:

      @Factory("dpabServiceFeeList")

          public List<ServiceFeeSelectionHelper> getServiceFees() {

       

      Can anyone help me with this? Any advice or approaches we could take to resolve this would be greatly appreciated.

       

      Thanks,

      Brad