Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

trace library has a weird suspend API

Aperta
#9,364 1 commento 0 reazioni 1 assegnatario Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@Lagrang3 ci sta già lavorando.

Dal 29/7/2026.

Valutazione

Questa issue non è ancora stata valutata.

Descrizione

The trace library (common/trace.h) has a weird suspend API.

Starting from a clean context every newly created span is added to a current stack of spans.
Closing the top span removes it from the stack.
Then there is also a suspend function that removes the top element from the stack but it doesn't close it, allowing
to track concurrent spans with a shared parent.

This API is awkward to use with trace spans in plugins that live beyond one iteration of the io loop.
See for example #9137: adding traces to xpay we had to suspend the entire trace stack before handing control back
to the io loop and when we needed to modify the stack we had to bring it back entirely again element by element.

For example to add a new stack element on top of the payment span:

// global current trace is assumed to be NULL
// we get control back from the io loop, we resume the current payment
+       trace_span_resume(attempt->payment); // payment is the parent span
// start a new sub-trace for the rpc
+       trace_span_start("xpay/injectpaymentonion", attempt);
// before we hand control back to the io loop, we unwind the trace stack
+       trace_span_suspend(attempt);
+       trace_span_suspend(attempt->payment);
// global current trace is back to NULL

and to remove one

// global current trace is assumed to be NULL
// we get control back from the io loop, we resume the current payment
+       trace_span_resume(attempt->payment);
// also resume the trace of the RPC call
+       trace_span_resume(attempt);
// end the RPC trace
+       trace_span_end(attempt);
// again unwind the rest of the trace stack with only one element
+       trace_span_suspend(attempt->payment);
// global current trace is back to NULL

There are many footguns here.

I think it would be better if "suspend" would suspend the entire stack and we had a "suspend one" function for the top element alone.
While "resume x" brings back the entire stack with x on top.

The current suspend semantics was probably introduced in #8223

Lingua principale
C
Stelle
3.1k
Fork
1k
Merge medio
3g 10h
PR unite (30g)
40

Preparare l'ambiente

  • Include un Dockerfile o un file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ElementsProject/lightning

Tutte le issue di ElementsProject/lightning

Issue simili

Altre issue su C

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.