WSVR0605W: Thread <threadname> has been active for <time> and may be hung. There are <totalthreads> in total in the server that may be hung.
พอดีไปเจอปัญหาเรื่อง Threads ค้างจนเต็มลิมิต ทำให้ Server ค้างจนเดี้ยง โดยปกติตัว Container มันจะ Handle Threads hung ได้ 100 Threads ครับ เริ่มจาก 1 … ไปจนถึง 100 ครบร้อยเมื่อไหร่ ต้อง kill java process ทิ้งสถาณเดียว ซึ่งตอนแรกนั้นผมนึกว่าปัญหามันเกิดมาจากเรา allocate Heap size ให้กับตัว Server น้อยเกินไป
แต่เอาเข้าจริงๆแล้วมันเป็นน่าจะเป็นที่ตัวโปรแกรมมีจุดที่ทำให้ Memory Leak แน่ๆ ซึ่งการที่จะหาสาเหตุนั้นก็ทำได้ 2 อย่างคือเอา Profiler จับ และ เอา Core Dump มา Analyst ด้วย Tool พวก JCA เป็นต้น
โดยผมจะใช้วิธีืที่ 2 แทนแต่โดยปกติแล้วตัว WebSphere จะไม่เปิด feature สำหรับพ่น dump file เราจึงต้องเข้าไปเปิด โดยการเพิ่ม custom properties ให้ตัว App Server ดังนี้ครับ
Resolving the problem
Set the com.ibm.websphere.threadmonitor.dump.java property to true:
- From the administrative console, click Servers > Application Servers > server_name.
- Under Server Infrastructure, click Administration > Custom Properties.
- Click New.
- Add the following property:
Name: com.ibm.websphere.threadmonitor.dump.java
Value: true - Click Apply.
- Click OK and save the configuration changes.
- Restart the Application Server for the changes to take effect.