[jboss-jira] [JBoss JIRA] (WFLY-11601) Weld vs Undertow bootstrap: Race condition

Matěj Novotný (Jira) issues at jboss.org
Wed Jun 5 07:18:01 EDT 2019


    [ https://issues.jboss.org/browse/WFLY-11601?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13742721#comment-13742721 ] 

Matěj Novotný edited comment on WFLY-11601 at 6/5/19 7:17 AM:
--------------------------------------------------------------

bq. If the flag is false, we catch the ServletContext and fire the event as soon as endInitialization completes - just like it is done for non-web modules.

Non-web modules are handled differently because Weld alone knows when to fire that event. In order to know when do it for web modules, we need the mechanism that we use now - for undertow to tell us basically.

bq. I had no time to investigate it myself but why is the BeanDeploymentModules.processBeanDeployments executed after the cleanup code?

Not sure from the top of my head, playing with it yesterday I tried swapping the two and it still worked. That's why i suggested splitting the two in separate invocations.
But I assume some other events (in EE server bootstrap) might be waiting on that and Weld doesn't want to look fully booted when it is effectively not since the cleanup wasn't performed.

bq.  Does it require a spec change?

Spec doesn't do any of the optimizations we have here. Also, going that way drastically delays any actual solution so I'd say we first seek a solution to a Weld-specific bootstrap which, after all, is what all integrators rely on anyway.


was (Author: manovotn):
bq. If the flag is false, we catch the ServletContext and fire the event as soon as endInitialization completes - just like it is done for non-web modules.

Non-web modules are handled differently because Weld alone knows when to fire that event. In order to know when do it for web modules, we need the mechanism that we use now - for undertow to tell us basically.

bq . I had no time to investigate it myself but why is the BeanDeploymentModules.processBeanDeployments executed after the cleanup code?

Not sure from the top of my head, playing with it yesterday I tried swapping the two and it still worked. That's why i suggested splitting the two in separate invocations.
But I assume some other events (in EE server bootstrap) might be waiting on that and Weld doesn't want to look fully booted when it is effectively not since the cleanup wasn't performed.

bq.  Does it require a spec change?

Spec doesn't do any of the optimizations we have here. Also, going that way drastically delays any actual solution so I'd say we first seek a solution to a Weld-specific bootstrap which, after all, is what all integrators rely on anyway.

> Weld vs Undertow bootstrap: Race condition
> ------------------------------------------
>
>                 Key: WFLY-11601
>                 URL: https://issues.jboss.org/browse/WFLY-11601
>             Project: WildFly
>          Issue Type: Bug
>          Components: CDI / Weld, Web (Undertow)
>    Affects Versions: 15.0.1.Final
>            Reporter: Stefan Gr
>            Assignee: Matěj Novotný
>            Priority: Major
>         Attachments: TestApp.zip, TestLib.zip, changes.diff, deploy-failed.txt, deploy-mixed-success.txt, deploy-success.txt, test-app-1.0.0.war, weld-core-impl-3.0.5.Final.jar, weld-core-impl-3.0.5.Final.jar
>
>
> WFLY-9732 / WFLY-10784 moves the completion of WELD from the WeldStartService to WeldStartCompetionService. This causes a race condition with the UndertowDeploymentService which executes the servlet listeners for context-initialized which again fires ApplicationScope-initialized events in CDI.
> You can find more in [WELD-2557|https://issues.jboss.org/browse/WELD-2557?focusedCommentId=13682848&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-13682848].
> In short: WeldStartCompletionService and UndertowDeploymentService pushes the logic to the executor service. It may happen, that the logik of undertow runs before the weld completion. Events fired in the servlet listeners won't find all event observers.
> A possible solution would bo to set the WeldStartCompletionService as a dependency of the UndertowDeploymentService



--
This message was sent by Atlassian Jira
(v7.12.1#712002)



More information about the jboss-jira mailing list