Expected behavior
DeadLockDetectorPerformanceCounter shall send some thread stack elements within message of TraceTelemetry.
Actual behavior
DeadLockDetectorPerformanceCounter only send ThreadInfo without thread stack trace in TraceTelemetry.
To Reproduce
- DeadLockDetectorPerformanceCounter enabled (default behavior)
- When a deadlock occurs or is created for test purpose
Sample Application
None
System information
Please provide the following information:
- SDK Version: applicationinsights-core-2.5.1.jar
- OS type and version: All OS
- Using spring-boot? No
- Additional relevant libraries (with version, if applicable): No
Logs
TelemetryTrace message from Application Insights:
Suspected deadlocked threads: XXX-Startup-tasks Id=171 is in WAITING on lock=java.util.concurrent.locks.ReentrantLock$NonfairSync@48ca6b79 is owned by EE-ManagedThreadFactory-default-Thread-2 Id=170 | EE-ManagedThreadFactory-default-Thread-2 Id=170 is in BLOCKED on lock=org.jboss.weld.Container@416c2a69 is owned by XXX-Startup-tasks Id=171 |
Fix idea
Use getThreadInfo(threadId, MAX_STACK_TRACE) here
|
ThreadInfo threadInfo = threadBean.getThreadInfo(threadId); |
to have at least MAX_STACK_TRACE elements.
Nice-to-Have: Make MAX_STACK_TRACE configurable using ApplicationInsights.xml
Expected behavior
DeadLockDetectorPerformanceCounter shall send some thread stack elements within message of TraceTelemetry.
Actual behavior
DeadLockDetectorPerformanceCounter only send ThreadInfo without thread stack trace in TraceTelemetry.
To Reproduce
Sample Application
None
System information
Please provide the following information:
Logs
TelemetryTrace message from Application Insights:
Suspected deadlocked threads: XXX-Startup-tasks Id=171 is in WAITING on lock=java.util.concurrent.locks.ReentrantLock$NonfairSync@48ca6b79 is owned by EE-ManagedThreadFactory-default-Thread-2 Id=170 | EE-ManagedThreadFactory-default-Thread-2 Id=170 is in BLOCKED on lock=org.jboss.weld.Container@416c2a69 is owned by XXX-Startup-tasks Id=171 |Fix idea
Use
getThreadInfo(threadId, MAX_STACK_TRACE)hereApplicationInsights-Java/core/src/main/java/com/microsoft/applicationinsights/internal/perfcounter/jvm/DeadLockDetectorPerformanceCounter.java
Line 84 in 5cddbb1
to have at least MAX_STACK_TRACE elements.
Nice-to-Have: Make MAX_STACK_TRACE configurable using ApplicationInsights.xml