title: Drools worker Thread taking too much time, throwing sun.nio.fs.UnixException
body: <p>I have an application where in which I use drools workbench(KIE) for rule validations in Java.
  Now I am facing something odd with this drool worker thread which gets created while firing rules. On an average, response time for the rule execution is less than 500ms in my application. Recently, I could observe that occasionally it is taking more time to return the rules response. This is happening very rarely, but it is happening. Recently it took around 29 minutes for the expected response. This ultimately crashed my application. I need to handle this &quot;special case&quot;.</p>
  <p>Using Dynatrace application, I had inspected the processes happening in code level. I could see that</p>
  <pre><code> Asynchronous invocation
                   |
                   |___ JRE | java.util.concurrent.FutureTask
  </code></pre>
  <p>is just repeating and taking too much time in each execution. I had attached the screenshot of the same.<a href="https://i.stack.imgur.com/2rED1.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/2rED1.png" alt="enter image description here" /></a>. And I could observe few errors as well.</p>
  <blockquote>
  <p><strong>Exception</strong>: sun.nio.fs.UnixException</p>
  <p><strong>Message</strong>: No such file or directory</p>
  </blockquote>
  <blockquote>
  <p><strong>Stacktrace</strong>:
  sun.nio.fs.UnixNativeDispatcher.access0(UnixNativeDispatcher.java)
  sun.nio.fs.UnixNativeDispatcher.access(UnixNativeDispatcher.java:449)
  sun.nio.fs.UnixFileSystemProvider.checkAccess(UnixFileSystemProvider.java:306)
  java.nio.file.Files.exists(Files.java:2385)
  org.jboss.modules.PathResourceLoader.lambda$
  org.jboss.modules.PathResourceLoader$$Lambda$.run
  org.jboss.modules.PathResourceLoader.doPrivilegedIfNeeded(PathResourceLoader.java:227)
  org.jboss.modules.PathResourceLoader.getResource(PathResourceLoader.java:139)
  org.jboss.modules.ModuleClassLoader.loadResourceLocal(ModuleClassLoader.java:349)
  org.jboss.modules.ModuleClassLoader$1.loadResourceLocal(ModuleClassLoader.java:96)
  org.jboss.modules.Module.getResourceAsStream(Module.java:784)
  org.jboss.modules.ModuleClassLoader.findResourceAsStream(ModuleClassLoader.java:556)
  org.jboss.modules.ConcurrentClassLoader.getResourceAsStream(ConcurrentClassLoader.java:370)
  java.lang.Class.getResourceAsStream(Class.java:2223)
  org.drools.core.util.asm.ClassFieldInspector.(ClassFieldInspector.java:80)
  org.drools.core.util.asm.ClassFieldInspector.(ClassFieldInspector.java:72)
  org.drools.core.base.ClassFieldAccessorFactory.getClassFieldReader(ClassFieldAccessorFactory.java:107)
  org.drools.core.base.ClassFieldAccessorCache$CacheEntry.getReadAccessor(ClassFieldAccessorCache.java:166)
  org.drools.core.base.ClassFieldAccessorCache.getReadAcessor(ClassFieldAccessorCache.java:99)
  org.drools.core.base.ClassFieldAccessorStore.wire(ClassFieldAccessorStore.java:460)
  org.drools.core.base.ClassFieldAccessorStore.getReader(ClassFieldAccessorStore.java:126)
  org.drools.core.base.ClassFieldAccessorStore.getReader(ClassFieldAccessorStore.java:103)
  org.drools.compiler.rule.builder.PatternBuilder.getFieldReadAccessor(PatternBuilder.java:1677)
  org.drools.compiler.rule.builder.PatternBuilder.addConstraintToPattern(PatternBuilder.java:856)
  org.drools.compiler.rule.builder.PatternBuilder.buildRelationalExpression(PatternBuilder.java:811)
  org.drools.compiler.rule.builder.PatternBuilder.buildExpression(PatternBuilder.java:735)
  org.drools.compiler.rule.builder.PatternBuilder.buildCcdDescr(PatternBuilder.java:719)
  org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:670)
  org.drools.compiler.rule.builder.PatternBuilder.processConstraintsAndBinds(PatternBuilder.java:524)
  org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:329)
  org.drools.compiler.rule.builder.PatternBuilder.build(PatternBuilder.java:138)
  org.drools.compiler.rule.builder.GroupElementBuilder.build(GroupElementBuilder.java:66)
  org.drools.compiler.rule.builder.RuleBuilder.build(RuleBuilder.java:89)
  org.drools.compiler.builder.impl.KnowledgeBuilderImpl.addRule(KnowledgeBuilderImpl.java:1652)
  org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileRules(KnowledgeBuilderImpl.java:968)
  org.drools.compiler.builder.impl.KnowledgeBuilderImpl.compileAllRules(KnowledgeBuilderImpl.java:844)
  org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildRules(CompositeKnowledgeBuilderImpl.java:279)
  org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.buildPackages(CompositeKnowledgeBuilderImpl.java:103)
  org.drools.compiler.builder.impl.CompositeKnowledgeBuilderImpl.build(CompositeKnowledgeBuilderImpl.java:91)</p>
  </blockquote>
  <p>I think this error might be the cause for the same.</p>
  <p>In ideal case, I am not seeing</p>
  <blockquote>
  <p>Asynchronous invocation ---- &gt;JRE | java.util.concurrent.FutureTask</p>
  </blockquote>
  <p>while I am inspecting through Dynatrace and no errors as well. I had attached screenshot as well. <a href="https://i.stack.imgur.com/EIwZm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EIwZm.png" alt="enter image description here" /></a></p>
  <p>My java code which fires the rule is as follows :</p>
  <pre><code>final KieContainer kContainerTubes = loadRulesBean.getKieContainerMap().get(ConfiguratorConstants.TUBES.toUpperCase());
  final StatelessKieSession kSessionProduct = kContainerTubes.newStatelessKieSession();
  kSessionProduct .execute(products);
  </code></pre>
  <p>What worries here is the occurance of this issue.  Very rare !!.</p>