Disable total currency in frontier visualization
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 https://github.com/MinaProtocol/mina/issues/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 https://github.com/MinaProtocol/mina/issues/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: https://github.com/MinaProtocol/mina/issues/17501
!ci-build-me
On ca1a7cf11f in compatible: node hangs when you're Ctrl+Cing in the terminal when it's synced
On 023d218904d43166a6a03948b962208dbbd3eba1 in cjjdespres/fix-visualization-hang: exits fast.
^C2025-12-07 06:32:39 UTC [Info] Mina process was interrupted by "sigint"
2025-12-07 06:32:39 UTC [Info] Running async shutdown handler: "Close transition frontier, if exists"
2025-12-07 06:32:39 UTC [Info] Running async shutdown handler: "Remove daemon lockfile"
2025-12-07 06:32:40 UTC [Fatal] Prover terminated due to signal, terminating daemon
2025-12-07 06:32:40 UTC [Warn] unhandled exception from daemon-side prover server: $exn
exn: {
"sexp": [
"monitor.ml.Error",
[
"shutdown with inconsistent status",
[ "status", "1" ],
[ "status'", "130" ]
],
[
"Raised at Base__Error.raise in file \"src/error.ml\" (inlined), line 8, characters 14-30",
"Called from Base__Error.raise_s in file \"src/error.ml\", line 9, characters 19-40",
"Called from Async_unix__Shutdown.exit in file \"src/shutdown.ml\" (inlined), line 106, characters 2-24",
"Called from Prover.create.(fun) in file \"src/lib/prover/prover.ml\", line 475, characters 8-20",
"Called from Async_kernel__Deferred0.bind.(fun) in file \"src/deferred0.ml\", line 54, characters 64-69",
"Called from Async_kernel__Job_queue.run_job in file \"src/job_queue.ml\" (inlined), line 128, characters 2-5",
"Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 169, characters 6-47",
"Caught by monitor at file \"src/lib/mina_lib/mina_lib.ml\", line 1807, characters 35-35"
]
],
"backtrace": [
"Raised at Base__Error.raise in file \"src/error.ml\" (inlined), line 8, characters 14-30",
"Called from Base__Error.raise_s in file \"src/error.ml\", line 9, characters 19-40",
"Called from Async_unix__Shutdown.exit in file \"src/shutdown.ml\" (inlined), line 106, characters 2-24",
"Called from Prover.create.(fun) in file \"src/lib/prover/prover.ml\", line 475, characters 8-20",
"Called from Async_kernel__Deferred0.bind.(fun) in file \"src/deferred0.ml\", line 54, characters 64-69",
"Called from Async_kernel__Job_queue.run_job in file \"src/job_queue.ml\" (inlined), line 128, characters 2-5",
"Called from Async_kernel__Job_queue.run_jobs in file \"src/job_queue.ml\", line 169, characters 6-47"
]
}
2025-12-07 06:32:40 UTC [Error] verifier terminated unexpectedly
2025-12-07 06:32:40 UTC [Info] Starting a new verifier process
2025-12-07 06:32:40 UTC [Info] verifier successfully stopped