Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-6251

Add configuration to disable systematic file watch in ServletResourceManager

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Done
    • Icon: Major Major
    • 11.0.0.Alpha1
    • 10.0.0.Final
    • Web (Undertow)
    • None

      Our application is deployed multiple time in production as an exploded war.

      Eventually we are running into "User limit of inotify watches reached":

      ERROR [io.undertow] (MSC service thread 1-6) UT005024: Could not register resource change listener for caching resource manager, automatic invalidation of cached resource will not work: java.lang.RuntimeException: java.io.IOException: User limit of inotify watches reached
      	at org.xnio.nio.WatchServiceFileSystemWatcher.watchPath(WatchServiceFileSystemWatcher.java:179)
      	at io.undertow.server.handlers.resource.FileResourceManager.registerResourceChangeListener(FileResourceManager.java:161) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at org.wildfly.extension.undertow.deployment.ServletResourceManager.registerResourceChangeListener(ServletResourceManager.java:80)
      	at io.undertow.server.handlers.resource.CachingResourceManager.<init>(CachingResourceManager.java:64) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.createServletConfig(UndertowDeploymentInfoService.java:525)
      	at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService.start(UndertowDeploymentInfoService.java:256)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948)
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881)
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_45]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_45]
      	at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_45]
      Caused by: java.io.IOException: User limit of inotify watches reached
      	at sun.nio.fs.LinuxWatchService$Poller.implRegister(LinuxWatchService.java:264) [rt.jar:1.8.0_45]
      	at sun.nio.fs.AbstractPoller.processRequests(AbstractPoller.java:260) [rt.jar:1.8.0_45]
      	at sun.nio.fs.LinuxWatchService$Poller.run(LinuxWatchService.java:329) [rt.jar:1.8.0_45]
      	... 1 more
      

      From what I'm seeing in:
      https://github.com/wildfly/wildfly/blob/master/undertow/src/main/java/org/wildfly/extension/undertow/deployment/ServletResourceManager.java
      https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/resource/PathResourceManager.java
      https://github.com/undertow-io/undertow/blob/master/core/src/main/java/io/undertow/server/handlers/resource/CachingResourceManager.java

      there's no way to disable the file resource watch at the sole exception of using non-exploded war deployment.

      We will eventually switch to a non-exploded war but I think having a configuration (either within the standalone.xml or via system property) to completly turn off that feature would be a nice addition / improvement.

      In the meanwhile, as a workaround we have increased the inotify watch on the OS and will most likely patch either undertow and/or wildfly-undertow to not add any watch at all.

      Thanks

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              mathieu@mathieulachance.com Mathieu Lachance (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved: