You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[MNG-7402] BuildListCalculator never detaches the classloader #9167
This is all derived by code-review and I think its quite hard to reproduce / check this as a lot of tccl-action haven within maven so it might even be irrelevant here, but the general pattern should be as you have described that the original TCC is restored after a certain action has taken place to not leak classloaders if the thread is reused.
In this example, the current TCC wil be the one of the last Maven project after this method is called, this does not seem correct to me as the order of projects should not influence classlaoding.
Maybe in BuildListCalculatorTest.testCalculateProjectBuilds() one could add a check that the original classlaoder is restored afterwards.... Also LifecycleTaskSegmentCalculatorImplTest.testCalculateProjectBuilds() call the method and could be a place to check that the TCC is restored correctly.
Beside that the code is called in org.apache.maven.lifecycle.internal.LifecycleStarter.execute(MavenSession) where after the call the current TCC is passed to another call as the "original" classlaoder.
Activity
jira-importer commentedon Feb 19, 2022
Michael Osipov commented
Like this?
jira-importer commentedon Feb 20, 2022
Christoph Läubrich commented
yes, even though the reset of the Threads CCL could be moved outside of the loop
jira-importer commentedon Feb 20, 2022
Michael Osipov commented
Can you think of an IT which can depict the faulty behavior. I am not a CL expert to make proper judgement.
gnodet, Robert Scholte, any opinions applying such a patch on 3.8+?
jira-importer commentedon Feb 20, 2022
Christoph Läubrich commented
This is all derived by code-review and I think its quite hard to reproduce / check this as a lot of tccl-action haven within maven so it might even be irrelevant here, but the general pattern should be as you have described that the original TCC is restored after a certain action has taken place to not leak classloaders if the thread is reused.
In this example, the current TCC wil be the one of the last Maven project after this method is called, this does not seem correct to me as the order of projects should not influence classlaoding.
jira-importer commentedon Feb 20, 2022
Christoph Läubrich commented
Maybe in BuildListCalculatorTest.testCalculateProjectBuilds() one could add a check that the original classlaoder is restored afterwards.... Also LifecycleTaskSegmentCalculatorImplTest.testCalculateProjectBuilds() call the method and could be a place to check that the TCC is restored correctly.
Beside that the code is called in org.apache.maven.lifecycle.internal.LifecycleStarter.execute(MavenSession) where after the call the current TCC is passed to another call as the "original" classlaoder.
jira-importer commentedon Feb 21, 2022
Michael Osipov commented
Please propose a PR if you want to have it in 3.8.5.
jira-importer commentedon Feb 26, 2022
Michael Osipov commented
Fixed with e327be3d85918a23a5ba48d752143a6dbf8b83f7 and with d29af9018b5c80177102aaab96bd37ed5fedf26c for
maven-3.8.xbranch.