Skip to content

Conversation

@cjjdespres
Copy link
Member

Explain your changes:

The total_currency computation that is run in display_attached_mask here will foldi over a mask to compute the total balance of the default token. This causes every account in the ledger represented by that mask to be read; since most of those will be in the ledger database on disk, this is essentially equivalent to a full database read. This full read can take a few seconds to complete (for current devnet and depending on hardware).

This problem is compounded by the fact that display_attached_mask will be run for every mask in the frontier when computing its visualization. For a daemon synced to a network, that's at least 290 iterations of this function, and likely more. This endeds up causing the daemon to "hang" during shutdown if stopped with ctrl-c on the command line; what it's really doing is slowly going through the ledger over and over again to compute this total currency value in order to save the transition frontier visualization to disk.

The change here eliminates this particular shutdown bug by temporarily disabling this part of the visualization. If we really need this debug info then we might consider addressing #18196, or being a bit more clever about how we compute this total_currency value.

Explain how you tested your changes:

I synced a daemon to devnet with this change, and then stopped it with ^C. Instead of freezing after the message "Successfully wrote the visualization..." as in #17501, it instead shut down promptly and saved the registered masks to .mina-config/registered_masks.dot as expected. Granted, that's with all the total_currency values being zero in the visualization, but I think that's better than not finishing the visualization at all.

Closes: #17501

The total_currency computation that is run in display_attached_mask here
will foldi over a mask to compute the total balance of the default
token. This causes every account in the ledger represented by that mask
to be read; since most of those will be in the ledger database on disk,
this is essentially equivalent to a full database read. This full read
can take a few seconds to complete (for current devnet and depending on
hardware).

This problem is compounded by the fact that display_attached_mask will
be run for every mask in the frontier when computing its visualization.
For a daemon synced to a network, that's at least 290 iterations of this
function, and likely more. This endeds up causing the daemon to "hang"
during shutdown if stopped with ctrl-c on the command line; what it's
really doing is slowly going through the ledger over and over again to
compute this total currency value in order to save the transition
frontier visualization to disk.

The change here eliminates this particular shutdown bug by temporarily
disabling this part of the visualization.
@cjjdespres cjjdespres requested a review from a team as a code owner December 4, 2025 21:08
@cjjdespres
Copy link
Member Author

!ci-build-me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mina daemon hangs during Graphviz generation at shutdown

2 participants