JBoss EAP 6 stalls recursively scanning exploded deployment during startup
Environment
- JBoss Enterprise Application Platform (EAP) 6
Issue
We are deploying an application that has a symlink to NFS share with a very large number of files. JBoss hangs when starting the server.
In thread dumps, we see:
"DeploymentScanner-threads - 1" prio=10 tid=0x00007f0ad80e2800 nid=0x253e runnable [0x00007f0b18961000]
java.lang.Thread.State: RUNNABLE
at java.io.UnixFileSystem.list(Native Method)
at java.io.File.list(File.java:973)
at java.io.File.listFiles(File.java:1051)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.getDeploymentTimestamp(FileSystemDeploymentService.java:770)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.getDeploymentTimestamp(FileSystemDeploymentService.java:771)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.getDeploymentTimestamp(FileSystemDeploymentService.java:771)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.scanDirectory(FileSystemDeploymentService.java:567)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.scan(FileSystemDeploymentService.java:360)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.oneOffScan(FileSystemDeploymentService.java:335)
at org.jboss.as.server.deployment.scanner.DeploymentScannerAdd$2.run(DeploymentScannerAdd.java:161)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:439)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:98)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:206)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:895)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:918)
at java.lang.Thread.run(Thread.java:662)
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
Resolution
If you need to include a very large number of static content files, consider using a web overlay.
In WEB-INF/jboss-web.xml
<jboss-web version="7.0"
xmlns:jboss="http://www.jboss.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.jboss.com/xml/ns/javaee jboss-web_7_0.xsd">
...
<overlay>/path/to/contents/</overlay>
...
</jboss-web>
Root Cause
For exploded deployments, JBoss computes the "deployment timestamp" as the newest modification time of any file under the deployment directory. This requires recursively scanning that directory.
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.