How to take Thread Dump Automatically when WebSphere Hung/Stop?
Thread dump is essential for Java application troubleshooting. If you are working on performance related, memory leakage, debugging, etc. then you will often be asked to take thread and heap dump.
Usted puede take the dump manually but if you would like to do it automatically then here is how you can do it.The following demonstration is based on
La siguiente demostración se basa en WebSphere 9, pero el procedimiento sería similar a otra versión de WAS.
Realizar el volcado de subprocesos cuando JVM se detiene
Puede haber un escenario en el que le gustaría tomar la volcado de hilo cada vez que JVM se detiene. Esto será útil cuando no esté seguro de quién o cómo se detiene la JVM.
Para configurar esto;
- Inicie sesión en la consola administrativa de WebSphere
- navegarate to Servers >> Server Types >> WebSphere application servers
- Go inside the JVM and expand “Java and Process Management” under Server Infrastructure
- Haga clic Process definición
- Haga clic en "Máquina virtual Java" en Propiedades adicionales >> Propiedades personalizadas
- Haga clic en Nuevo e ingrese el Nombre como
com.ibm.ws.runtime.dumpShutdown
- Valor como verdadero
- haga clic en Aceptar
- Review and Save the configuration
Now, heap dump will be generated whenever JVM stop.
Detuve la JVM y pude ver el siguiente archivo javacore en el servidor WAS en la ruta del perfil.
-rw-r - r--. 1 raíz raíz 3179348 28 de noviembre 22:49 javacore.20161128.224916.4926.0001.txt -rw-r - r--. 1 raíz raíz 3124208 28 de noviembre 22:49 javacore.20161128.224924.4926.0002.txt
Tomar el volcado del hilo cuando está colgado
If you are having hung thread issue, and currently you take the dump manually, then you can automate esta.
By doing basic configuration, WebSphere will generate the dump whenever a thread is hung for configured timed.
- Inicie sesión en la consola WAS y acceda a la JVM respectiva
- Expanda "Administración" en Infraestructura del servidor y haga clic en Propiedades personalizadas
- Agregue las siguientes tres propiedades
com.ibm.websphere.threadmonitor.umbral – Generate dump when a thread is hung for configured time. Value is in seconds.
com.ibm.websphere.threadmonitor.intervalo - Con qué frecuencia el monitor de hilo debe comprobar si hay hilos colgados. El valor en segundos.
com.ibm.websphere.threadmonitor.dump.java – Generate dump when detected. Value is true.
Above configuration will generate dump whenever a thread is hung for 600 segundosy WebSphere supervisará el hilo cada 300 segundos.
Una vez que tenga el vertedero, puede analizar y solucionar el problema de la aplicación. Espero que esto ayude.