Granola-Team / mina-indexer

The Mina Indexer is a re-imagined version of the software collectively called the "Mina archive node."
Apache License 2.0
16 stars 10 forks source link

Problem: cannot interrupt ingestion #1221

Open robinbb opened 1 week ago

robinbb commented 1 week ago

One cannot send a shutdown message during ingestion because there is no socket. Sending a signal does not work, either, because it is ignored or mis-handled.

jhult commented 1 week ago

Relates to #728 and #1203

trevorbernard commented 5 days ago

Some findings. The culprit for not being able to interrupt initial block ingestion is that the parsing functions for blocks and staking ledgers was using blocking I/O rather than tokio's future based I/O. Fixing this issue is relatively straight forward but we still have a chicken and egg problem with graceful shutdown. The way the indexer is coded now, a catching SIGINT during ingestion wouldn't hit any of our shutdown code because it hasn't been initialized yet.

trevorbernard commented 5 days ago

Cancelling during ingestion yields this error

Error: shutdown timed out

Stack backtrace:
   0: std::backtrace::Backtrace::capture
   1: mina_indexer::main
   2: std::sys_common::backtrace::__rust_begin_short_backtrace
   3: _main
robinbb commented 2 days ago

With the newly discussed design, this amounts to being able to interrupt the non-server command 'create-database'. May be an easier problem to solve.