openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian DePradine (JIRA)" <j...@apache.org>
Subject [jira] [Created] (OPENJPA-2222) Concurrency issue with JPA enhancement in Apache Open JPA
Date Thu, 28 Jun 2012 16:19:43 GMT
Brian DePradine created OPENJPA-2222:
----------------------------------------

             Summary: Concurrency issue with JPA enhancement in Apache Open JPA
                 Key: OPENJPA-2222
                 URL: https://issues.apache.org/jira/browse/OPENJPA-2222
             Project: OpenJPA
          Issue Type: Bug
          Components: Enhance
    Affects Versions: 2.2.0
            Reporter: Brian DePradine


Working Jeremy Bauer, we discovered the following issue:

I think I've figured out what is causing the transformer to return null in some (intermittent)
cases.  I'm seeing multiple threads [Blueprint Extender: # ] calling into the same PCClassFileTransformer.
 I've pasted the stack for thread 1 below.  I saw an identical instance for a thread 3 - operating
on a different persistent class at the same time.   This resulted in one of the transforms
(per transform method below) returned null.

    public byte[] transform(ClassLoader loader, String className,
        Class redef, ProtectionDomain domain, byte[] bytes)
        throws IllegalClassFormatException {
        if (loader == _tmpLoader)
            return null;

        // JDK bug -- OPENJPA-1676
        if (className == null) {
            return null;
        }
---------------------
        // prevent re-entrant calls, which can occur if the enhancing
        // loader is used to also load OpenJPA libraries; this is to prevent 
        // recursive enhancement attempts for internal openjpa libraries
        if (_transforming)
            return null;
---------------------

        _transforming = true;
        
        return transform0(className, redef, bytes);
    }

Since you use the same transformer on multiple threads we are hitting the condition where
there is a transform in progress and you are trying to do another transform on a separate
thread.

I spent some time looking at the JPA spec to determine what it says about transformer concurrency
and I can't find anything that says that you shouldn't be able to call a transformer in a
concurrent manner, hence this defect.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Mime
View raw message