[ 
https://issues.apache.org/jira/browse/MRESOLVER-412?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17776304#comment-17776304
 ] 

Tamas Cservenak commented on MRESOLVER-412:
-------------------------------------------

It seems my suspicion was right: this is ModelBuilder issue, BF collector is to 
"blame" only for invoking ModelBuilder on several threads :)

Locally was able to "fix" this issue by synchronizing the two method:
* org.apache.maven.model.building.DefaultModelBuilder#readRawModel
* org.apache.maven.model.building.DefaultModelBuilder#readFileModel

My guess is that what happens is that two competing threads both get {{null}} 
from cache, then they both go to load/parse same (parent) POM, and finally both 
put it into cache...

> BF collector causes same model to be loaded up multiple times
> -------------------------------------------------------------
>
>                 Key: MRESOLVER-412
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-412
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Priority: Major
>             Fix For: 2.0.0
>
>
> This bug probably affects all released versions of new BF collector.
> Symptom is that Maven with BF collector fails MavenITmng5669ReadPomsOnce both 
> test methods. The IT verifies that POM XMLs are _read only once_ with and 
> without "consumer POM" feature enabled. Both IT methods fail (so failure is 
> irrelevant of consumer POM feature being enabled). Error consistently happens 
> on each subsequent IT invokcation, whether empty or prepopulated local repo.
> Most probably cause: old DF was single threaded, while BF uses internally 
> thread pool, that seemingly causes that same POM XML is loaded up multiple 
> times as ModelBuilder is being asked multi threaded for different models by 
> BF collector.
> Reproduce: either run MavenITmng5669ReadPomsOnce but modify the IT to enable 
> DF (if using Maven w/ resolver 1.x) or build Maven 4 w/ Resolver 2 (default 
> is BF).



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to