File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -232,10 +232,28 @@ static struct span *trace_span_slot(void)
232
232
233
233
/* In the unlikely case this fails, double it */
234
234
if (!s ) {
235
+ /* Adjust current and parents when we reallocate! */
236
+ size_t num_active = tal_count (active_spans );
237
+ size_t current_off COMPILER_WANTS_INIT ("11.4.0-1ubuntu1~22.04 -03" );
238
+ size_t parent_off [num_active ];
239
+ if (current )
240
+ current_off = current - active_spans ;
241
+ for (size_t i = 0 ; i < num_active ; i ++ ) {
242
+ if (!active_spans [i ].parent )
243
+ continue ;
244
+ parent_off [i ] = active_spans [i ].parent - active_spans ;
245
+ }
235
246
TRACE_DBG ("%u: out of %zu spans, doubling!\n" ,
236
247
getpid (), tal_count (active_spans ));
237
248
tal_resizez (& active_spans , tal_count (active_spans ) * 2 );
238
249
s = trace_span_find (0 );
250
+ if (current )
251
+ current = active_spans + current_off ;
252
+ for (size_t i = 0 ; i < num_active ; i ++ ) {
253
+ if (!active_spans [i ].parent )
254
+ continue ;
255
+ active_spans [i ].parent = active_spans + parent_off [i ];
256
+ }
239
257
}
240
258
assert (s -> parent == NULL );
241
259
You can’t perform that action at this time.
0 commit comments