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-7220] Fix threadLocalArtifactsHolder leaking into cloned project #535

Closed
wants to merge 1 commit into from

Conversation

famod
Copy link
Contributor

@famod famod commented Sep 12, 2021

Just like #527 but for master.

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.

@famod
Copy link
Contributor Author

famod commented Sep 12, 2021

/cc @michael-o

@rmannibucau
Copy link
Contributor

This broke 3.8.2 so would be great to invest in another working solution IMHO.

@olamy
Copy link
Member

olamy commented Sep 13, 2021

why InheritableThreadLocal cannot be a good solution? what are the cons using InheritableThreadLocal?

@rmannibucau
Copy link
Contributor

It mainly leaks and threads it is propagated to are uncontrolled so behavior is.
Guess a reference counting (per module) or alike solution is maybe closer to something portable, and enabling it only in concurrent builds is saner and limit the impacts a lot.

@famod
Copy link
Contributor Author

famod commented Sep 13, 2021

My 2 cents:
In mid or long term there should be a better solution for this and the band-aid TL should be dropped.
But so far nobody has come up with a non-api-breaking solution to fix the initial problem. Just reverting the TL re-introduces a nasty concurrency issue, so IMO this is not a good option.
So, since 3.8.2 is out there and introduces some regressions, let's get the two fixes for that merged and release 3.8.3 ASAP.

@rmannibucau
Copy link
Contributor

@famod so minimum is to disable the TL when concurrency = 1 which leads to 0 issues for everyone - even if build is slower. Guess it is acceptable until somebody wants to implement a ref counting or alike solution.

@michael-o
Copy link
Member

@famod so minimum is to disable the TL when concurrency = 1 which leads to 0 issues for everyone - even if build is slower. Guess it is acceptable until somebody wants to implement a ref counting or alike solution.

If we can access concurrency information at that point actually...

@michael-o
Copy link
Member

Will also test in the next couple of days and merge.

@famod
Copy link
Contributor Author

famod commented Sep 14, 2021

@famod so minimum is to disable the TL when concurrency = 1 which leads to 0 issues for everyone - even if build is slower. Guess it is acceptable until somebody wants to implement a ref counting or alike solution.

If we can access concurrency information at that point actually...

I don't see how, unfortunately. (not without adding new public methods to MavenProject that have to be called from...somewhere)

@rmannibucau
Copy link
Contributor

The concurrency is in the session (session.getRequest().getDegreeOfConcurrency(); or something like that) so I guess it is more a matter of wrapper the project injected in mojo instead of changing maven project itself. So maven project would stay untouched and a ConcurrentMavenProject would use a thread local if getDegreeOfConcurrency() > 1.
Had sometihng along those lines in mind but I wouldn't change MavenProject at all.

@asfgit asfgit closed this in a6e462b Sep 14, 2021
@michael-o
Copy link
Member

The concurrency is in the session (session.getRequest().getDegreeOfConcurrency(); or something like that) so I guess it is more a matter of wrapper the project injected in mojo instead of changing maven project itself. So maven project would stay untouched and a ConcurrentMavenProject would use a thread local if getDegreeOfConcurrency() > 1.
Had sometihng along those lines in mind but I wouldn't change MavenProject at all.

This makes sense and should be evaluated in a separate issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants