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

Stefan Oehme commented on MNG-6720:
-----------------------------------

It should fail fast, but not at the expense of correctness. As described above, 
Maven notifies us that the build has finished, but it's actually still 
executing things, which breaks the contract of these events. It's a totally 
uncoordinated shutdown, which I don't think is a good user experience.

We could try to make it wrap up faster, e.g. by calling `shutDownNow`, which 
will interrupt the execution threads. There's no hard guarantee that all Mojos 
support interrupts, but in general it should fail faster with that. Sounds good?

As for testing, it's actually pretty hard to reproduce with a small project, 
since it's a race condition between the goal failing and the VM shutting down. 
I may have to create a pretty large number of projects to make the test 
consistently fail. I'll see if that still gives a reasonable test execution 
time.

> MultiThreadedBuilder does not wait for outstanding projects to complete
> -----------------------------------------------------------------------
>
>                 Key: MNG-6720
>                 URL: https://issues.apache.org/jira/browse/MNG-6720
>             Project: Maven
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 3.5.4, 3.6.1
>            Reporter: Stefan Oehme
>            Priority: Major
>          Time Spent: 10m
>  Remaining Estimate: 0h
>
> When a project fails using --fail-fast mode, other projects that are 
> currently running in parallel are not finished before the "session finished" 
> event is sent. This leads to issues for extensions that rely on the 
> documented order of events, which says that "session finished" is only sent 
> "after all projects have been finished/skipped".
> In our case, we close a service on "session finished", and that service is 
> needed to execute goals. The goals that were running in parallel at that time 
> then fail, saying that our service was closed, giving our users the 
> impression that there is a bug in our code.
> The relevant line is 
> [here|https://github.com/apache/maven/blob/master/maven-core/src/main/java/org/apache/maven/lifecycle/internal/builder/multithreaded/MultiThreadedBuilder.java#L179].
>  Instead of using `poll`, which simply returns when the parallel projects 
> aren't finished yet, the code should shut down the executor and wait for it 
> to complete the outstanding parallel work.



--
This message was sent by Atlassian JIRA
(v7.6.14#76016)

Reply via email to