Buggy code:
public class ApplyExtensionsHandler implements OperationStepHandler { public static final String OPERATION_NAME = "resolve-subsystems" ; private final Set < String > appliedExtensions = new HashSet < String > ( ) ; private final ExtensionRegistry extensionRegistry ; private final LocalHostControllerInfo localHostInfo ; private final IgnoredDomainResourceRegistry ignoredResourceRegistry ; public static final SimpleOperationDefinition DEFINITION = new SimpleOperationDefinitionBuilder ( ApplyExtensionsHandler . OPERATION_NAME , null ) . setPrivateEntry ( ) . build ( ) ; public ApplyExtensionsHandler ( ExtensionRegistry extensionRegistry , LocalHostControllerInfo localHostInfo , final IgnoredDomainResourceRegistry ignoredResourceRegistry ) { } @ Override public void execute ( OperationContext context , ModelNode operation ) throws OperationFailedException { final ModelNode domainModel = operation . get ( DOMAIN_MODEL ) ; final ModelNode startRoot = Tools . readModel ( context . readResourceFromRoot ( EMPTY_ADDRESS ) ) ; final Resource rootResource = context . readResourceForUpdate ( EMPTY_ADDRESS ) ; for ( Resource . ResourceEntry entry : rootResource . getChildren ( EXTENSION ) ) { rootResource . removeChild ( entry . getPathElement ( ) ) ; } for ( final ModelNode resourceDescription : domainModel . asList ( ) ) { final PathAddress resourceAddress = PathAddress . pathAddress ( resourceDescription . require ( "domain-resource-address" ) ) ; if ( ignoredResourceRegistry . isResourceExcluded ( resourceAddress ) ) { continue ; } final Resource resource = getResource ( resourceAddress , rootResource , context ) ; if ( ( ( resourceAddress . size ( ) ) == 1 ) && ( resourceAddress . getElement ( 0 ) . getKey ( ) . equals ( EXTENSION ) ) ) { final String module = resourceAddress . getElement ( 0 ) . getValue ( ) ; if ( ! ( appliedExtensions . contains ( module ) ) ) { appliedExtensions . add ( module ) ; initializeExtension ( module ) ; } } else { continue ; } resource . writeModel ( resourceDescription . get ( "domain-resource-model" ) ) ; } if ( ! ( context . isBooting ( ) ) ) { final Resource domainRootResource = context . readResourceForUpdate ( EMPTY_ADDRESS ) ; final ModelNode endRoot = Tools . readModel ( domainRootResource ) ; final Set < ServerIdentity > affectedServers = new HashSet < ServerIdentity > ( ) ; final ModelNode hostModel = endRoot . require ( HOST ) . asPropertyList ( ) . iterator ( ) . next ( ) . getValue ( ) ; final Map < String , ProxyController > serverProxies = DomainServerUtils . getServerProxies ( localHostInfo . getLocalHostName ( ) , domainRootResource , context . getResourceRegistration ( ) ) ; final ModelNode startExtensions = startRoot . get ( EXTENSION ) ; final ModelNode finishExtensions = endRoot . get ( EXTENSION ) ; if ( ! ( startExtensions . equals ( finishExtensions ) ) ) { affectedServers . addAll ( DomainServerUtils . getAllRunningServers ( hostModel , localHostInfo . getLocalHostName ( ) , serverProxies ) ) ; } if ( ! ( affectedServers . isEmpty ( ) ) ) { DomainControllerLogger . ROOT_LOGGER . domainModelChangedOnReConnect ( affectedServers ) ; final Set < ServerIdentity > runningServers = DomainServerUtils . getAllRunningServers ( hostModel , localHostInfo . getLocalHostName ( ) , serverProxies ) ; for ( ServerIdentity serverIdentity : affectedServers ) { if ( ! ( runningServers . contains ( serverIdentity ) ) ) { continue ; } final PathAddress serverAddress = PathAddress . pathAddress ( PathElement . pathElement ( HOST , serverIdentity . getHostName ( ) ) , PathElement . pathElement ( SERVER , serverIdentity . getServerName ( ) ) ) ; final OperationStepHandler handler = context . getResourceRegistration ( ) . getOperationHandler ( serverAddress , ServerRestartRequiredHandler . OPERATION_NAME ) ; final ModelNode op = new ModelNode ( ) ; op . get ( OP ) . set ( ServerRestartRequiredHandler . OPERATION_NAME ) ; op . get ( OP_ADDR ) . set ( serverAddress . toModelNode ( ) ) ; <START_BUG> context . addStep ( op , handler , IMMEDIATE ) ; <END_BUG> } } } context . stepCompleted ( ) ; } private Resource getResource ( PathAddress resourceAddress , Resource rootResource , OperationContext context ) { } protected void initializeExtension ( String module ) throws OperationFailedException { } }

Fix:
context . addStep ( op , handler , MODEL , true ) ;