You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@archiva.apache.org by "charles kim (JIRA)" <ji...@codehaus.org> on 2012/10/20 01:46:36 UTC

[jira] (MRM-1702) Race condition caused by retrieving the same artifact from a Proxy from muliple threads

charles kim created MRM-1702:
--------------------------------

             Summary: Race condition caused by retrieving the same artifact from a Proxy from muliple threads
                 Key: MRM-1702
                 URL: https://jira.codehaus.org/browse/MRM-1702
             Project: Archiva
          Issue Type: Bug
    Affects Versions: 1.4-M1
         Environment: RHEL6
            Reporter: charles kim


When multiple requests are made for the same artifact where proxy is used (meaning there is no local file exists yet), there is a race condition.

A code block that moves the downloaded temp file to target location is in synchronized block which does prevent them from writing the same file, 

Before moving the temp file to the target location, it overwrites the existing file ( by first checking the file existence and removes it). 

By removing it (from the 2nd thread), the first thread that wrote the file and and tries to spool the file again throws  java.io.FileNotFoundException.

Please see attached patch.

Thanks

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

        

[jira] (MRM-1702) Race condition caused by retrieving the same artifact from a Proxy from muliple threads

Posted by "charles kim (JIRA)" <ji...@codehaus.org>.
    [ https://jira.codehaus.org/browse/MRM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=311886#comment-311886 ] 

charles kim commented on MRM-1702:
----------------------------------

After looking at the patch again, patch seems to solve the concurrency issue but synchronized on the filename intern does put a burden when requesting the same artifact.  May be some one else can provide more elegant solution.

                
> Race condition caused by retrieving the same artifact from a Proxy from muliple threads
> ---------------------------------------------------------------------------------------
>
>                 Key: MRM-1702
>                 URL: https://jira.codehaus.org/browse/MRM-1702
>             Project: Archiva
>          Issue Type: Bug
>    Affects Versions: 1.4-M1
>         Environment: RHEL6
>            Reporter: charles kim
>         Attachments: ArchivaDavResource_patch.txt, DefaultRepositoryProxyConnectors_patch.txt
>
>
> When multiple requests are made for the same artifact where proxy is used (meaning there is no local file exists yet), there is a race condition.
> A code block that moves the downloaded temp file to target location is in synchronized block which does prevent them from writing the same file, 
> Before moving the temp file to the target location, it overwrites the existing file ( by first checking the file existence and removes it). 
> By removing it (from the 2nd thread), the first thread that wrote the file and and tries to spool the file again throws  java.io.FileNotFoundException.
> Please see attached patch.
> Thanks

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

        

[jira] (MRM-1702) Race condition caused by retrieving the same artifact from a Proxy from muliple threads

Posted by "charles kim (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MRM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

charles kim updated MRM-1702:
-----------------------------

    Attachment: ArchivaDavResource_patch.txt
    
> Race condition caused by retrieving the same artifact from a Proxy from muliple threads
> ---------------------------------------------------------------------------------------
>
>                 Key: MRM-1702
>                 URL: https://jira.codehaus.org/browse/MRM-1702
>             Project: Archiva
>          Issue Type: Bug
>    Affects Versions: 1.4-M1
>         Environment: RHEL6
>            Reporter: charles kim
>         Attachments: ArchivaDavResource_patch.txt, DefaultRepositoryProxyConnectors_patch.txt
>
>
> When multiple requests are made for the same artifact where proxy is used (meaning there is no local file exists yet), there is a race condition.
> A code block that moves the downloaded temp file to target location is in synchronized block which does prevent them from writing the same file, 
> Before moving the temp file to the target location, it overwrites the existing file ( by first checking the file existence and removes it). 
> By removing it (from the 2nd thread), the first thread that wrote the file and and tries to spool the file again throws  java.io.FileNotFoundException.
> Please see attached patch.
> Thanks

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

        

[jira] (MRM-1702) Race condition caused by retrieving the same artifact from a Proxy from muliple threads

Posted by "charles kim (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MRM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

charles kim updated MRM-1702:
-----------------------------

    Attachment: DefaultRepositoryProxyConnectors_patch.txt
    
> Race condition caused by retrieving the same artifact from a Proxy from muliple threads
> ---------------------------------------------------------------------------------------
>
>                 Key: MRM-1702
>                 URL: https://jira.codehaus.org/browse/MRM-1702
>             Project: Archiva
>          Issue Type: Bug
>    Affects Versions: 1.4-M1
>         Environment: RHEL6
>            Reporter: charles kim
>         Attachments: ArchivaDavResource_patch.txt, DefaultRepositoryProxyConnectors_patch.txt
>
>
> When multiple requests are made for the same artifact where proxy is used (meaning there is no local file exists yet), there is a race condition.
> A code block that moves the downloaded temp file to target location is in synchronized block which does prevent them from writing the same file, 
> Before moving the temp file to the target location, it overwrites the existing file ( by first checking the file existence and removes it). 
> By removing it (from the 2nd thread), the first thread that wrote the file and and tries to spool the file again throws  java.io.FileNotFoundException.
> Please see attached patch.
> Thanks

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

        

[jira] (MRM-1702) Race condition caused by retrieving the same artifact from a Proxy from muliple threads

Posted by "Olivier Lamy (JIRA)" <ji...@codehaus.org>.
     [ https://jira.codehaus.org/browse/MRM-1702?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Olivier Lamy updated MRM-1702:
------------------------------

    Fix Version/s: 1.4-M4
    
> Race condition caused by retrieving the same artifact from a Proxy from muliple threads
> ---------------------------------------------------------------------------------------
>
>                 Key: MRM-1702
>                 URL: https://jira.codehaus.org/browse/MRM-1702
>             Project: Archiva
>          Issue Type: Bug
>    Affects Versions: 1.4-M1
>         Environment: RHEL6
>            Reporter: charles kim
>             Fix For: 1.4-M4
>
>         Attachments: ArchivaDavResource_patch.txt, DefaultRepositoryProxyConnectors_patch.txt
>
>
> When multiple requests are made for the same artifact where proxy is used (meaning there is no local file exists yet), there is a race condition.
> A code block that moves the downloaded temp file to target location is in synchronized block which does prevent them from writing the same file, 
> Before moving the temp file to the target location, it overwrites the existing file ( by first checking the file existence and removes it). 
> By removing it (from the 2nd thread), the first thread that wrote the file and and tries to spool the file again throws  java.io.FileNotFoundException.
> Please see attached patch.
> Thanks

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