-
Notifications
You must be signed in to change notification settings - Fork 992
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clean-up work when process quit #2364
Comments
While server dropping, there is still impl Drop for Server {
fn drop(&mut self) {
warn!("Dropping Server");
warn!("strong {:?}", Arc::strong_count(&self.chain));
warn!("weak {:?}", Arc::weak_count(&self.chain));
}
}
BTW, If user use the |
@RyanKung We already do some level of cleanup/rewinding on restart, based on existing state of the various MMR files. You can see some of this in |
Hi @antiochp , I just checked On chain::init() if stop_lock.is_stopped() {
return Err(ErrorKind::Stopped.into());
} On Server::new let shared_chain = Arc::new(chain::Chain::init(
config.db_root.clone(),
db_env,
chain_adapter.clone(),
genesis.clone(),
pow::verify_size,
verifier_cache.clone(),
archive_mode,
stop_state.clone(),
)?); On Server::start:
And in servers::Server::start(config, |serv: Arc<servers::Server>| {
let running = Arc::new(AtomicBool::new(true));
let r = running.clone();
ctrlc::set_handler(move || {
r.store(false, Ordering::SeqCst);
})
.expect("Error setting handler for both SIGINT (Ctrl+C) and SIGTERM (kill)");
while running.load(Ordering::SeqCst) {
thread::sleep(Duration::from_secs(1));
}
warn!("Received SIGINT (Ctrl+C) or SIGTERM (kill).");
serv.stop();
})
.unwrap(); It's simply unwrap() and will |
Graceful shutdown is added at #2812. I think we can close this issue now. |
Recap the Gitter discussion here: https://gitter.im/grin_community/dev?at=5c3b123d95e17b45254415c3
I create this issue to remind us there's a clean-up (on process exit) issue to be fixed.
The text was updated successfully, but these errors were encountered: