Commit 4c6dd80
authored
fix(node): Remove ambiguity and race conditions when matching local variables to exceptions (#13501)
Closes #13415
This PR only modifies the async version of this integration which is
used for Node > v19. I tried applying similar changes to the sync
integration and I cannot get it to work without causing memory leaks.
@Bruno-DaSilva has been helping me explore different ways to fix a few
fundamental issues with the local variables integration. Bruno found a
way to [write to the error
object](#13415 (comment))
from the debugger which removes any ambiguity over which variables go
with which exception.
This allows us to remove the stack parsing and hashing which we were
using previously to match up exceptions.
Rather than write the `objectId` to the error, I have used this to write
the entire local variables array directly to the error object. This
completely negates the need to post the local variables from the worker
thread which removes any possibility of race conditions. We then later
pull the local variables directly from
`hint.originalException.__SENTRY_ERROR_LOCAL_VARIABLES__`.1 parent 7fa366f commit 4c6dd80
File tree
5 files changed
+93
-80
lines changed- packages/node/src/integrations/local-variables
5 files changed
+93
-80
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | | - | |
3 | 2 | | |
4 | 3 | | |
5 | 4 | | |
6 | 5 | | |
7 | 6 | | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
8 | 12 | | |
9 | 13 | | |
10 | 14 | | |
| |||
55 | 59 | | |
56 | 60 | | |
57 | 61 | | |
| 62 | + | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
| |||
68 | 73 | | |
69 | 74 | | |
70 | 75 | | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | 76 | | |
94 | 77 | | |
95 | 78 | | |
| |||
Lines changed: 8 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
23 | 31 | | |
24 | 32 | | |
25 | 33 | | |
| |||
Lines changed: 26 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
| 3 | + | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
| 24 | + | |
40 | 25 | | |
41 | 26 | | |
42 | 27 | | |
| |||
45 | 30 | | |
46 | 31 | | |
47 | 32 | | |
48 | | - | |
49 | | - | |
| 33 | + | |
| 34 | + | |
50 | 35 | | |
51 | | - | |
| 36 | + | |
52 | 37 | | |
53 | 38 | | |
54 | 39 | | |
55 | 40 | | |
56 | 41 | | |
57 | 42 | | |
58 | | - | |
| 43 | + | |
59 | 44 | | |
60 | | - | |
| 45 | + | |
61 | 46 | | |
62 | | - | |
| 47 | + | |
63 | 48 | | |
64 | 49 | | |
65 | 50 | | |
66 | 51 | | |
67 | | - | |
| 52 | + | |
68 | 53 | | |
69 | 54 | | |
70 | 55 | | |
71 | | - | |
72 | | - | |
73 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
74 | 68 | | |
75 | 69 | | |
76 | 70 | | |
| |||
96 | 90 | | |
97 | 91 | | |
98 | 92 | | |
99 | | - | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | 93 | | |
104 | 94 | | |
105 | 95 | | |
| |||
139 | 129 | | |
140 | 130 | | |
141 | 131 | | |
142 | | - | |
143 | | - | |
| 132 | + | |
| 133 | + | |
144 | 134 | | |
145 | 135 | | |
146 | 136 | | |
Lines changed: 24 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
16 | 38 | | |
17 | 39 | | |
18 | 40 | | |
| |||
Lines changed: 29 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
| 3 | + | |
7 | 4 | | |
8 | | - | |
| 5 | + | |
| 6 | + | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | | - | |
13 | | - | |
14 | 10 | | |
15 | 11 | | |
16 | 12 | | |
| |||
88 | 84 | | |
89 | 85 | | |
90 | 86 | | |
91 | | - | |
92 | | - | |
93 | | - | |
| 87 | + | |
| 88 | + | |
94 | 89 | | |
95 | 90 | | |
96 | 91 | | |
97 | 92 | | |
98 | 93 | | |
99 | 94 | | |
100 | | - | |
101 | | - | |
102 | | - | |
103 | | - | |
| 95 | + | |
104 | 96 | | |
105 | 97 | | |
106 | 98 | | |
| |||
123 | 115 | | |
124 | 116 | | |
125 | 117 | | |
126 | | - | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
127 | 127 | | |
128 | 128 | | |
129 | 129 | | |
| |||
141 | 141 | | |
142 | 142 | | |
143 | 143 | | |
144 | | - | |
145 | | - | |
| 144 | + | |
| 145 | + | |
146 | 146 | | |
147 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
148 | 158 | | |
149 | 159 | | |
150 | | - | |
| 160 | + | |
151 | 161 | | |
152 | 162 | | |
153 | 163 | | |
| |||
0 commit comments