Jboss แก้ปัญหา Thread เต็ม JBWEB003008 Maximum number of threads
ลอง Run ไปนานๆ แล้วเกิดปัญหาว่า
Jboss Thread เต็ม จนค้างไปเลย
ด้วย Error นี้
JBWEB003008: Maximum number of threads (1024) created for connector with address /localhost and port 8080
15:51:35,864 ERROR [stderr] (Thread-61) Exception in thread "Thread-61" java.lang.OutOfMemoryError: unable to create new native thread
15:51:35,865 ERROR [stderr] (Thread-61) at java.lang.Thread.start0(Native Method)
15:51:35,865 ERROR [stderr] (Thread-61) at java.lang.Thread.start(Thread.java:714)
15:51:35,865 ERROR [stderr] (Thread-61) at org.jboss.threads.JBossThread.start(JBossThread.java:144)
15:51:35,865 ERROR [stderr] (Thread-61) at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:949)
15:51:35,866 ERROR [stderr] (Thread-61) at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1371)
15:51:35,866 ERROR [stderr] (Thread-61) at org.jboss.sun.net.httpserver.ServerImpl$Dispatcher.handle(ServerImpl.java:468)
15:51:35,866 ERROR [stderr] (Thread-61) at org.jboss.sun.net.httpserver.ServerImpl$Dispatcher.run(ServerImpl.java:433)
15:51:35,866 ERROR [stderr] (Thread-61) at java.lang.Thread.run(Thread.java:745)
แนวทางแก้คือเพิ่ม config ยกตัวอย่างที่ standalone.xml
ใน Path : /app/jboss-eap-6.3/standalone/configuration
เพิ่มตามคำสั่งนี้
<subsystem xmlns="urn:jboss:domain:threads:1.1">
<thread-factory name="http-connector-factory" thread-name-pattern="HTTP-%t" priority="9" group-name="uq-thread-pool"/>
<unbounded-queue-thread-pool name="uq-thread-pool">
<thread-factory name="http-connector-factory" />
<max-threads count="1000" />
<keepalive-time time="30" unit="seconds" />
</unbounded-queue-thread-pool>
</subsystem>