Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MNG-7156] Parallel build can cause issues between clean and forked g… #476

Closed
wants to merge 4 commits into from

Conversation

gnodet
Copy link
Contributor

@gnodet gnodet commented Jun 2, 2021

…oals

Following this checklist to help us incorporate your
contribution quickly and easily:

  • Make sure there is a JIRA issue filed
    for the change (usually before you start working on it). Trivial changes like typos do not
    require a JIRA issue. Your pull request should address just this issue, without
    pulling in other changes.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Format the pull request title like [MNG-XXX] - Fixes bug in ApproximateQuantiles,
    where you replace MNG-XXX with the appropriate JIRA issue. Best practice
    is to use the JIRA issue title in the pull request title and in the first line of the
    commit message.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Run mvn clean verify to make sure basic checks pass. A more thorough check will
    be performed on your pull request automatically.
  • You have run the Core IT successfully.

If your pull request is about ~20 lines of code you don't need to sign an
Individual Contributor License Agreement if you are unsure
please ask on the developers list.

To make clear that you license your contribution under
the Apache License Version 2.0, January 2004
you have to acknowledge this by using the following check-box.

@bmarwell
Copy link
Contributor

bmarwell commented Jun 2, 2021

Will this also resolve -DdeployAtEnd=true?

@gnodet
Copy link
Contributor Author

gnodet commented Jun 2, 2021

Will this also resolve -DdeployAtEnd=true?

I don't understand. This only adds a locking mechanism to avoid conflicts caused by parallel execution between the normal lifecycle and forked lifecycles, which can cause the same project to be build twice concurrently. This has nothing to do with deployAtEnd afaik.

Copy link
Contributor

@MartinKanters MartinKanters left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice proposal, I left some comments. Also, I think it's worth it to create at least an integration test. It might be annoying to build an IT, but covering this just in unit tests will be much harder.

Copy link
Member

@cstamas cstamas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cool, I think I saw some of issues while using mvnd that should be solved...

@gnodet
Copy link
Contributor Author

gnodet commented Oct 7, 2021

Cool, I think I saw some of issues while using mvnd that should be solved...

Fwiw, it's not really urgent, as it has already been integrated into mvnd ...
https://github.com/mvndaemon/mvnd/blob/master/daemon/src/main/java/org/mvndaemon/mvnd/execution/LockingEventSpy.java

@famod
Copy link
Contributor

famod commented Oct 23, 2021

Two things:

SessionData data = event.getSession().getRepositorySession().getData();
Map<MavenProject, Lock> locks = ( Map ) data.get( LOCKS_KEY );
// initialize the value if not already done (in case of a concurrent access) to the method
if ( locks == null )
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it make sense to use SessionData#computeIfAbsent() if we release Resolver and integrate?

Copy link
Member

@michael-o michael-o left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this revolves around the idea that all elements subject to a project cannot be modified while the lock is obtained, so everything else concurrently is halted?
So as far as I understand this PR is global while PR #578 is rather local?

@gnodet
Copy link
Contributor Author

gnodet commented Dec 2, 2021

So this revolves around the idea that all elements subject to a project cannot be modified while the lock is obtained, so everything else concurrently is halted?
So as far as I understand this PR is global while PR #578 is rather local?

I had a closer look at both problems and proposed solutions. They are indeed related but for two different use cases. The This one #476 address the use case for synchronising between a standard lifecycle and a forked lifecycle, while #578 synchronises between a mojo execution for a given project and a mojo execution that has the reactor flag set.
Both are related because they both address concurrency execution between projects.

I'll work on a PR that addresses both problem at the same time.

@gnodet
Copy link
Contributor Author

gnodet commented Dec 8, 2021

Superseded by #628 for 3.x and #627 for master.

@gnodet gnodet closed this Dec 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants