]
Brian Stansberry commented on WFCORE-1855:
------------------------------------------
is WIP on this. Kind of a
workaround. I opened up a PR for it but I think I'll withdraw it for now as it's a
bit out of date and I don't feel urgency to get this particular solution in.
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
Assignee: Brian Stansberry
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".