Community
Participate
Working Groups
The local Maven repository is also a p2 repository, and it caches artifacts downloaded from p2 repositories (.m2/repository/p2/...). Since 0.14 (see bug 347963), the access to the index file .m2/repository/.meta/p2-artifacts.properties is protected by a file lock, preventing corrupt index files through write access through multiple Tycho processes. However there is still the possibility that two builds corrupt each others artifacts when both processes download the same p2 artifact because they download to the same file (without any locking). Holding the index lock while downloading a file would enforce a single-threaded download across processes and is therefore not an option. Per-artifact locks would IMHO also be too complicated. Instead, we should do the following: - Download the file to a temporary file next to the target location in the local Maven repository. - Acquire the index lock - Check if another process has downloaded the same artifact in the meanwhile -> if yes, discard the own download - Otherwise, copy the temporary file to the right location, write the p2artifacts metadata and update the index - Release the index lock With this approach, the artifacts are written at most once (and never deleted), so we don't need to lock read access to the local Maven repository.
Although probably not absolutely required, we should also make the LocalArtifactRepository class thread-safe. This means that we need two locks: One for the in-memory representation of the repository index, and one for the file system (index file read/write, artifact write).
Other multi-process problem not covered by this enhancement: bug 394998.
I'm working on cleaning up the LocalArtifactRepository implementation. Cutting down the complexity as much as possible is probably a good idea before trying to make the remaining implementation thread-/process-safe.
The LocalArtifactRepository renovation is completed (see bug 393004 comment 4 for details). Now the work on thread and multi-process safety could start...
Optimizing the index update write operations (needed for bug 373175) is probably also a prerequisite for this enhancement. Marking bug 373175 as dependency.
Eclipse Tycho is moving away from this bugs.eclipse.org issue tracker to https://github.com/eclipse/tycho/issues/ instead. If this issue is relevant to you, your action is required. 0. Verify this issue is still happening with latest Tycho 2.4.0-SNAPSHOT if issue has disappeared, please change status of this issue to "CLOSED WORKFORME" with some details about your testing environment and how you did verify the issue; and you're done if issue is still present when latest release: * Create a new issue at https://github.com/eclipse/tycho/issues/ ** Use as title in GitHub the title of this Bugzilla ticket (may include the bug number or not, at your own convenience) ** In the GitHub description, start with a link to this bugzilla ticket ** Optionally add new content to the description if it can helps towards resolution ** Submit GitHub issue * Update bugzilla ticket ** Add to "See also" property (up right column) the link to the newly created GitHub issue ** Add a comment "Migrated to <link-to-newly-created-GitHub-issue>" ** Set status as CLOSED MOVED ** Submit All issues that remain open will be automatically closed next week or so. Then the Bugzilla component for Tycho will be archived and made read-only.