radicle-dev / radicle-upstream

Desktop client for Radicle.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Panic when Upstream is terminated via ctrl + c

rudolfs opened this issue · comments

When the packaged app is run from the terminal and then terminated by pressing ctrl+c, we get a panic:

^C2022-04-18T08:42:38.756931Z  INFO upstream_proxy::process: shutting down. send SIGINT or SIGTERM again in 5 seconds to force shutdown
2022-04-18T08:42:38.757474Z  INFO upstream_proxy::daemon::peer: network endpoint shut down
2022-04-18T08:42:38.758688Z  WARN upstream_proxy::git_fetch: failed to fetch project with git errs=[failed to fetch project from seed https://willow.radicle.garden/

Caused by:
    0: failed to fetch remotes
    1:

Stack backtrace:
   0: std::backtrace_rs::backtrace::libunwind::trace
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/std/src/../../backtrace/src/backtrace/libunwind.rs:93:5
   1: std::backtrace_rs::backtrace::trace_unsynchronized
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2: std::backtrace::Backtrace::create
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/std/src/backtrace.rs:328:13
   3: anyhow::error::<impl anyhow::Error>::new
   4: rad_common::git::git
   5: rad_common::seed::fetch_remotes
   6: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
   7: async_task::raw::RawTask<F,T,S>::run
   8: blocking::Executor::main_loop
   9: std::sys_common::backtrace::__rust_begin_short_backtrace
  10: core::ops::function::FnOnce::call_once{{vtable.shim}}
  11: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/alloc/src/boxed.rs:1853:9
  12: <alloc::boxed::Box<F,A> as core::ops::function::FnOnce<Args>>::call_once
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/alloc/src/boxed.rs:1853:9
  13: std::sys::unix::thread::Thread::new::thread_start
             at /rustc/c84f39e6c08397d4ab9b51b472002a8bfc3b5b59/library/std/src/sys/unix/thread.rs:108:17
  14: __pthread_deallocate] identity=Oid(1b450c1754d74782380c765f35360c0765994ac6)
2022-04-18T08:42:38.790134Z  INFO upstream_proxy::process: reloading
2022-04-18T08:42:38.790149Z  INFO upstream_proxy::process: process has shut down

I expected it to just shut down cleanly, as it does when the app is terminated via +q:

2022-04-18T08:42:06.084751Z  INFO upstream_proxy::process: shutting down. send SIGINT or SIGTERM again in 5 seconds to force shutdown
2022-04-18T08:42:06.084861Z  INFO upstream_proxy::daemon::peer: network endpoint shut down
2022-04-18T08:42:06.106297Z  INFO upstream_proxy::process: reloading
2022-04-18T08:42:06.106309Z  INFO upstream_proxy::process: process has shut down

This error occurs because pressing ctrl+c on the terminal will deliver SIGINT to any of git processes spawned by the git fetcher. This means the process will exit unsuccessfully and the git_fetch task will error.

This will only happen when ctrl+c is pressed while a sync is in progress. This also does not cause any known issues at the moment. I suggest we put this into the icebox and not act on it.

I wouldn't mind closing the issue if it's not causing any problems.