ThreadPoolFullException occuring with FS Listener and many files
xibalban Oct 29, 2010 9:57 AMI have a esb service that reads thousands of files (in the worst case) from a directory and uses jbpm process to orchestrate the business logic based on the file content.
It all works well with few files but when I throw over a thousand files to it, it runs out of memory and I get this:
2010-10-28 13:54:38,601 ERROR [org.jboss.resource.adapter.jms.inflow.JmsServerSession] (Connection Consumer for dest JBossQueue[CallbackQueue] id=1) Unable to schedule workjavax.resource.spi.work.WorkRejectedException: org.jboss.util.threadpool.ThreadPoolFullException: Error scheduling work: WorkWrapper@5f42c2[workManger=org.jboss.resource.work.JBossWorkManager@370b74 work=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f state=ACCEPTED waitType=WAIT_NONE startTimeout=0 completionTimeout=-1000 elapsedTime=0 workListener=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f]at org.jboss.resource.work.WorkWrapper.rejected(WorkWrapper.java:251)at org.jboss.util.threadpool.BasicTaskWrapper.taskRejected(BasicTaskWrapper.java:326)at org.jboss.util.threadpool.BasicTaskWrapper.rejectTask(BasicTaskWrapper.java:152)at org.jboss.util.threadpool.BasicThreadPool.execute(BasicThreadPool.java:491)at org.jboss.util.threadpool.BasicThreadPool.runTaskWrapper(BasicThreadPool.java:206)at org.jboss.resource.work.JBossWorkManager.executeWork(JBossWorkManager.java:185)at org.jboss.resource.work.JBossWorkManager.scheduleWork(JBossWorkManager.java:137)at org.jboss.resource.adapter.jms.inflow.JmsServerSession.start(JmsServerSession.java:211)at org.jboss.jms.client.JBossConnectionConsumer.run(JBossConnectionConsumer.java:297)at java.lang.Thread.run(Thread.java:619)Caused by: org.jboss.util.threadpool.ThreadPoolFullException: Error scheduling work: WorkWrapper@5f42c2[workManger=org.jboss.resource.work.JBossWorkManager@370b74 work=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f state=ACCEPTED waitType=WAIT_NONE startTimeout=0 completionTimeout=-1000 elapsedTime=0 workListener=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f]... 7 moreCaused by: java.lang.OutOfMemoryError: unable to create new native threadat java.lang.Thread.start0(Native Method)at java.lang.Thread.start(Thread.java:597)at java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)at org.jboss.util.threadpool.BasicThreadPool.execute(BasicThreadPool.java:487)... 6 more2010-10-28 13:54:38,601 ERROR [org.jboss.resource.adapter.jms.inflow.JmsServerSession] (Connection Consumer for dest JBossQueue[CallbackQueue] id=1) Unable to schedule work
javax.resource.spi.work.WorkRejectedException: org.jboss.util.threadpool.ThreadPoolFullException: Error scheduling work: WorkWrapper@5f42c2[workManger=org.jboss.resource.work.JBossWorkManager@370b74 work=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f state=ACCEPTED waitType=WAIT_NONE startTimeout=0 completionTimeout=-1000 elapsedTime=0 workListener=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f]
at org.jboss.resource.work.WorkWrapper.rejected(WorkWrapper.java:251)
at org.jboss.util.threadpool.BasicTaskWrapper.taskRejected(BasicTaskWrapper.java:326)
at org.jboss.util.threadpool.BasicTaskWrapper.rejectTask(BasicTaskWrapper.java:152)
at org.jboss.util.threadpool.BasicThreadPool.execute(BasicThreadPool.java:491)
at org.jboss.util.threadpool.BasicThreadPool.runTaskWrapper(BasicThreadPool.java:206)
at org.jboss.resource.work.JBossWorkManager.executeWork(JBossWorkManager.java:185)
at org.jboss.resource.work.JBossWorkManager.scheduleWork(JBossWorkManager.java:137)
at org.jboss.resource.adapter.jms.inflow.JmsServerSession.start(JmsServerSession.java:211)
at org.jboss.jms.client.JBossConnectionConsumer.run(JBossConnectionConsumer.java:297)
at java.lang.Thread.run(Thread.java:619)
Caused by: org.jboss.util.threadpool.ThreadPoolFullException: Error scheduling work: WorkWrapper@5f42c2[workManger=org.jboss.resource.work.JBossWorkManager@370b74 work=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f state=ACCEPTED waitType=WAIT_NONE startTimeout=0 completionTimeout=-1000 elapsedTime=0 workListener=org.jboss.resource.adapter.jms.inflow.JmsServerSession@112f31f]
... 7 more
Caused by: java.lang.OutOfMemoryError: unable to create new native thread
at java.lang.Thread.start0(Native Method)
at java.lang.Thread.start(Thread.java:597)
at java.util.concurrent.ThreadPoolExecutor.addIfUnderCorePoolSize(ThreadPoolExecutor.java:703)
at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:652)
at org.jboss.util.threadpool.BasicThreadPool.execute(BasicThreadPool.java:487)
... 6 more
Is there a way to limit FS Listener to sort of slow down the processing and handle only few files at a time and then rest a while? Or should I change some configurations? The system doesn't have to be fast.
I start jboss with "-Xms1g -Xmx1g -XX:MaxPermSize=512m" and I'm using AS 5.1 and esb 4.9.