You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by GitBox <gi...@apache.org> on 2019/07/12 21:54:21 UTC

[GitHub] [maven-wagon] erikhakansson edited a comment on issue #49: [MNG-2802] Concurrent-safe access to local Maven repository

erikhakansson edited a comment on issue #49: [MNG-2802] Concurrent-safe access to local Maven repository
URL: https://github.com/apache/maven-wagon/pull/49#issuecomment-511045549
 
 
   @michael-o, after looking at `maven-resolver` a bit, it seems that there's already file-locking in place during download (in `PartialFile`). It locks on the tempfile though, but since the tempfile is a fixed known name it seems unlikely that different Maven instances should write to different tempfiles.
   
   I.e, maven instance 2 should see the file lock from instance 1.
   
   However, there's a tiny window where instance 2 might start checking just before the target file is created but doesn't reach the actual file locking part until process 1 has already finished.
   
   However, what confuses me is that at worst case this should just trigger a re-download. The final move from tempfile to target file (in `GetTaskRunner`) is through a `new FileOutputStream(file)`, i.e. without the append-flag, so it should just overwrite. This should at worst affect the first process as the rewrite could corrupt and current reads, but at least process 2 should be fine.
   It is not, however, since the symptoms of the issue is that files are permanently corrupted.
   
   So, my simple conclusion is that I'm looking at the wrong place. Any ideas? :)

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services