This is an automated email from the git hooks/post-receive script.
dgoulet pushed a commit to branch main in repository tor.
commit 03d63bc7bdd6913a365b15bbd5ad1da201a8f6f0 Author: Mike Perry mikeperry-git@torproject.org AuthorDate: Tue Jun 6 15:14:33 2023 +0000
Add a conflux helper to log conflux sets. --- src/core/or/conflux_pool.c | 45 +++++++++++++++++++++++++++++++++++++++++++++ src/core/or/conflux_pool.h | 3 +++ 2 files changed, 48 insertions(+)
diff --git a/src/core/or/conflux_pool.c b/src/core/or/conflux_pool.c index c84613503f..53985df810 100644 --- a/src/core/or/conflux_pool.c +++ b/src/core/or/conflux_pool.c @@ -2020,6 +2020,51 @@ conflux_pool_init(void) } }
+/** + * Return a description of all linked and unlinked circuits associated + * with a conflux set. + * + * For use in rare bug cases that are hard to diagnose. + */ +void +conflux_log_set(const conflux_t *cfx, bool is_client) +{ + tor_assert(cfx); + + log_warn(LD_BUG, "Conflux %s: %d linked, %d launched", + fmt_nonce(cfx->nonce), smartlist_len(cfx->legs), + cfx->num_leg_launch); + + // Log all linked legs + int legs = 0; + CONFLUX_FOR_EACH_LEG_BEGIN(cfx, leg) { + log_warn(LD_BUG, + " - Linked Leg %d purpose=%d; RTT %"PRIu64", sent: %"PRIu64 + " marked: %d", + legs, leg->circ->purpose, leg->circ_rtts_usec, + leg->linked_sent_usec, leg->circ->marked_for_close); + legs++; + } CONFLUX_FOR_EACH_LEG_END(leg); + + // Look up the nonce to see if we have any unlinked circuits. + unlinked_circuits_t *unlinked = unlinked_pool_get(cfx->nonce, is_client); + if (unlinked) { + // Log the number of legs and the is_for_linked_set status + log_warn(LD_BUG, " - Unlinked set: %d legs, for link: %d", + smartlist_len(unlinked->legs), unlinked->is_for_linked_set); + legs = 0; + SMARTLIST_FOREACH_BEGIN(unlinked->legs, leg_t *, leg) { + log_warn(LD_BUG, + " Unlinked Leg: %d purpose=%d; linked: %d, RTT %"PRIu64", " + "sent: %"PRIu64" link ptr %p, marked: %d", + legs, leg->circ->purpose, leg->linked, + leg->rtt_usec, leg->link_sent_usec, + leg->link, leg->circ->marked_for_close); + legs++; + } SMARTLIST_FOREACH_END(leg); + } +} + /** Free and clean up the conflux pool subsystem. This is called by the subsys * manager AFTER all circuits have been freed which implies that all objects in * the pools aren't referenced anymore. */ diff --git a/src/core/or/conflux_pool.h b/src/core/or/conflux_pool.h index 6bb858bb09..9a9701a484 100644 --- a/src/core/or/conflux_pool.h +++ b/src/core/or/conflux_pool.h @@ -36,6 +36,9 @@ void conflux_process_linked(circuit_t *circ, crypt_path_t *layer_hint, const cell_t *cell, const uint16_t cell_len); void conflux_process_linked_ack(circuit_t *circ);
+typedef struct conflux_t conflux_t; +void conflux_log_set(const conflux_t *cfx, bool is_client); + #ifdef TOR_UNIT_TESTS bool launch_new_set(int num_legs); digest256map_t *get_linked_pool(bool is_client);