trace library has a weird suspend API
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
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di ElementsProject/lightning
-
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 90/100
ElementsProject/lightning#9593 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ElementsProject/lightning#9322 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ElementsProject/lightning#9206 ·
I maintainer di solito rispondono entro 2 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
ElementsProject/lightning#9187 · 1 commento · 1 reazione ·
I maintainer di solito rispondono entro 2 giorni
-
QA
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 88/100
ElementsProject/lightning#9117 · 2 commenti ·
I maintainer di solito rispondono entro 2 giorni
Tutte le issue di ElementsProject/lightning
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
dkfans/keeperfx#5415 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ARM-software/sysarch-acs#600 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
EchoTools/nevr-runtime#117 · 2 commenti ·
I maintainer di solito rispondono entro 1 giorno