Commit f7b6d04
committed
fix: Prevent crash when test fails on a different thread
When a test fails due to an exception thrown on a different thread,
the test class itself may not appear in the exception's stack trace.
The agent was previously unable to handle this scenario, crashing
with a `java.lang.InternalError` because it could not find a stack
frame matching the test class.
This commit introduces a more robust heuristic to find the most
likely source of the failure. If an exact match for the test class
is not found, the agent now falls back to the last seen stack frame
that does not belong to a known testing or Java framework. This
prevents the crash and correctly identifies the failure location.
A regression test has been added to simulate this cross-thread
exception scenario and verify the fix.1 parent 38e7bc7 commit f7b6d04
File tree
3 files changed
+80
-7
lines changed- agent
- src/main/java/com/appland/appmap/process/hooks/test
- test/test-frameworks
- src/test/java/org/springframework/samples/petclinic
3 files changed
+80
-7
lines changedLines changed: 41 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
66 | 90 | | |
67 | 91 | | |
68 | | - | |
| 92 | + | |
| 93 | + | |
69 | 94 | | |
70 | 95 | | |
71 | | - | |
72 | | - | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
73 | 104 | | |
74 | 105 | | |
75 | | - | |
76 | | - | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
77 | 110 | | |
78 | | - | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
79 | 114 | | |
80 | 115 | | |
81 | 116 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
| |||
104 | 104 | | |
105 | 105 | | |
106 | 106 | | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
107 | 115 | | |
Lines changed: 30 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
| 6 | + | |
| 7 | + | |
5 | 8 | | |
6 | 9 | | |
7 | 10 | | |
| |||
38 | 41 | | |
39 | 42 | | |
40 | 43 | | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
41 | 71 | | |
0 commit comments