[jboss-jira] [JBoss JIRA] (WFCORE-1855) Possible NPE on controller service start
Brian Stansberry (JIRA)
issues at jboss.org
Wed Oct 5 10:09:00 EDT 2016
[ https://issues.jboss.org/browse/WFCORE-1855?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13302989#comment-13302989 ]
Brian Stansberry commented on WFCORE-1855:
------------------------------------------
Neither of those two approaches will work. Everything depends on the AbstractControllerService being started.
Conceivably the boot thread stuff could be refactored out into a separate service that depends on the AbstractControllerService. It would need some analysis to look into any gotchas. I believe this has been this way since quite early in AS 7.0 so I'm not sure if it's this way for a real good reason or if it was just a result of inexperience.
> Possible NPE on controller service start
> ----------------------------------------
>
> Key: WFCORE-1855
> URL: https://issues.jboss.org/browse/WFCORE-1855
> Project: WildFly Core
> Issue Type: Bug
> Reporter: David Lloyd
>
> In {{org.jboss.as.controller.AbstractControllerService}}, the {{start}} method starts up a background thread which performs a certain amount of the boot process. Before this thread is started, a volatile field {{controller}} is initialized with the controller reported by the {{start()}} method.
> Inside this thread, some work is performed, and at the end of a certain amount of work, the {{finishBoot()}} method is invoked. This method calls {{controller.finishBoot()}}, referencing the field that was set in the {{start()}} method.
> The problem arises when the service itself is stopped before the boot thread completes. This causes the {{controller}} field to be nulled out, resulting in an NPE.
> I think we need to look at:
> * Why are we using a background thread for this?
> * Why are we _not_ using the asynchronous startup feature?
> I think we must do one of these two things in order to make this code "safe".
--
This message was sent by Atlassian JIRA
(v6.4.11#64026)
More information about the jboss-jira
mailing list