You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Alexey Varlamov (JIRA)" <ji...@apache.org> on 2006/11/22 13:40:04 UTC

[jira] Created: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

[drlvm] race condition in ClassLoader::LookupLoader
---------------------------------------------------

                 Key: HARMONY-2264
                 URL: http://issues.apache.org/jira/browse/HARMONY-2264
             Project: Harmony
          Issue Type: Bug
          Components: DRLVM
            Reporter: Alexey Varlamov
            Priority: Minor


The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.

ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
{
    if( !loader ) return NULL;
    ClassLoader *cl = FindByObject( loader );
    if( cl )
        return cl;
    else
        return AddClassLoader( loader );
}

It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.

BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Resolved: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov resolved HARMONY-2264.
--------------------------------------

    Resolution: Fixed

Applied the fix at r504541

> [drlvm] race condition in ClassLoader::LookupLoader
> ---------------------------------------------------
>
>                 Key: HARMONY-2264
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2264
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>         Attachments: H2264.patch
>
>
> The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.
> ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
> {
>     if( !loader ) return NULL;
>     ClassLoader *cl = FindByObject( loader );
>     if( cl )
>         return cl;
>     else
>         return AddClassLoader( loader );
> }
> It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.
> BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

Posted by "Pavel Pervov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Pavel Pervov updated HARMONY-2264:
----------------------------------

    Attachment: H2264.patch

Here is the patch, which fixes the issue. It also removes unused function.

> [drlvm] race condition in ClassLoader::LookupLoader
> ---------------------------------------------------
>
>                 Key: HARMONY-2264
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2264
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>            Priority: Minor
>         Attachments: H2264.patch
>
>
> The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.
> ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
> {
>     if( !loader ) return NULL;
>     ClassLoader *cl = FindByObject( loader );
>     if( cl )
>         return cl;
>     else
>         return AddClassLoader( loader );
> }
> It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.
> BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Alexey Varlamov reassigned HARMONY-2264:
----------------------------------------

    Assignee: Alexey Varlamov

> [drlvm] race condition in ClassLoader::LookupLoader
> ---------------------------------------------------
>
>                 Key: HARMONY-2264
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2264
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>         Attachments: H2264.patch
>
>
> The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.
> ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
> {
>     if( !loader ) return NULL;
>     ClassLoader *cl = FindByObject( loader );
>     if( cl )
>         return cl;
>     else
>         return AddClassLoader( loader );
> }
> It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.
> BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

Posted by "Alexey Varlamov (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12470926 ] 

Alexey Varlamov commented on HARMONY-2264:
------------------------------------------

The fix is good. 
What about moving declarations to UserDefinedClassLoader class?

> [drlvm] race condition in ClassLoader::LookupLoader
> ---------------------------------------------------
>
>                 Key: HARMONY-2264
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2264
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>         Assigned To: Alexey Varlamov
>            Priority: Minor
>         Attachments: H2264.patch
>
>
> The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.
> ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
> {
>     if( !loader ) return NULL;
>     ClassLoader *cl = FindByObject( loader );
>     if( cl )
>         return cl;
>     else
>         return AddClassLoader( loader );
> }
> It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.
> BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Updated: (HARMONY-2264) [drlvm] race condition in ClassLoader::LookupLoader

Posted by "Gregory Shimansky (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-2264?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Gregory Shimansky updated HARMONY-2264:
---------------------------------------

    Patch Info: [Patch Available]

> [drlvm] race condition in ClassLoader::LookupLoader
> ---------------------------------------------------
>
>                 Key: HARMONY-2264
>                 URL: https://issues.apache.org/jira/browse/HARMONY-2264
>             Project: Harmony
>          Issue Type: Bug
>          Components: DRLVM
>            Reporter: Alexey Varlamov
>            Priority: Minor
>         Attachments: H2264.patch
>
>
> The ClassLoader::LookupLoader() can potentially create duplicate native structures for the same Java classloader instance.
> ClassLoader* ClassLoader::LookupLoader( ManagedObject* loader )
> {
>     if( !loader ) return NULL;
>     ClassLoader *cl = FindByObject( loader );
>     if( cl )
>         return cl;
>     else
>         return AddClassLoader( loader );
> }
> It is possible that concurrent threads request this method simultaneously and AddClassLoader can be called several times for the same loader instance.
> BTW, It seems more logical and clean to declare this method (and a bunch of other static methods re Java-native loaders mapping) in UserDefinedClassLoader class, rather than in common ClassLoader.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.