I ran into a situation where I had to deploy a huge WAR file, but it took so long that the deployment ended up timing out. It gives this error on the JBoss console,
12:00:05,689 INFO [stdout] (ServerService Thread Pool -- 74) begin CustomContextListener.contextInitialized
12:05:05,563 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0348: Timeout after [300] seconds waiting for service container stability. Operation will roll back. Step that first updated the service container was 'deploy' at address '[("deployment" => "jboss-eap-long-deployment-time.war")]'
12:05:05,878 WARN [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 2) WFLYCTL0496: Thread dump:
*******************************************************************************
"Reference Handler" Id=9 RUNNABLE
at java.base@21.0.3/java.lang.ref.Reference.waitForReferencePendingList(Native Method)
at java.base@21.0.3/java.lang.ref.Reference.processPendingReferences(Reference.java:246)
at java.base@21.0.3/java.lang.ref.Reference$ReferenceHandler.run(Reference.java:208)
......
12:10:05,697 INFO [org.wildfly.extension.undertow] (ServerService Thread Pool -- 74) WFLYUT0022: Unregistered web context: '/' from server 'default-server'
12:10:05,717 INFO [org.jboss.as.server.deployment] (MSC service thread 1-4) WFLYSRV0028: Stopped deployment jboss-eap-long-deployment-time.war (runtime-name: jboss-eap-long-deployment-time.war) in 299823ms
It looks like there’s a hard timeout limit of 300 seconds, or 5 minutes, for deployments. The solution is to increase this timeout limit. In my case, I increased it to 15 minutes by modifying the standalone.conf.bat file:
set "JAVA_OPTS=%JAVA_OPTS% -Djboss.as.management.blocking.timeout=900"
After applying this change, here’s the result of a successful deployment:
16:14:08,138 INFO [stdout] (ServerService Thread Pool -- 74) begin CustomContextListener.contextInitialized
16:14:11,163 INFO [org.wildfly.core.installationmanager] (MSC service thread 1-8) WFLYIM0023: Installation was provisioned using the following channel versions: '[ManifestVersion{channelId='org.jboss.eap.channels:eap-8.1', description='EAP 8.1 Beta', version='1.0.0.Beta-redhat-00023'}]'
16:20:48,140 INFO [stdout] (ServerService Thread Pool -- 74) finish CustomContextListener.contextInitialized
.......
If you want to simulate a slow deployment on JBoss EAP, you can use the sample WAR file available on the below Github link,
https://github.com/edwin/jboss-eap-long-deployment-time