aptos-core icon indicating copy to clipboard operation
aptos-core copied to clipboard

[Bug] aptos-rosetta startup behaviour is weird

Open geekflyer opened this issue 3 years ago • 2 comments

When I start aptos-rosetta with an invalid config file path it appears like one of the processes/threads crashes, but the rest continues until a timeout of 5min is reached. We should crash/exit everything immediately when the config file path or config file content is not valid.

➜  aptos-core git:(rosetta) ✗ docker run --rm -v $(pwd)/data:/opt/aptos aptos-core:rosetta-latest aptos-rosetta online --config /opt/aptos/config.yaml
thread '<unnamed>' panicked at 'Failed to load node config file! Given file path: "/opt/aptos/config.yaml". Error: IO("/opt/aptos/config.yaml", Os { code: 2, kind: NotFound, message: "No such file or directory" })', aptos-node/src/lib.rs:126:17
stack backtrace:
   0: rust_begin_unwind
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: aptos_node::AptosNodeArgs::run::{{closure}}
             at ./aptos/aptos-node/src/lib.rs:126:17
   3: core::result::Result<T,E>::unwrap_or_else
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/result.rs:1464:23
   4: aptos_node::AptosNodeArgs::run
             at ./aptos/aptos-node/src/lib.rs:125:26
   5: aptos_rosetta::main::{{closure}}::{{closure}}
             at ./aptos/crates/aptos-rosetta/src/main.rs:36:45
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.



^C^C^C^C^C^C^C^C^C^Cthread 'main' panicked at 'Node didn't start up on time after 300 seconds', crates/aptos-rosetta/src/main.rs:54:13
stack backtrace:
   0: rust_begin_unwind
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/panicking.rs:143:14
   2: aptos_rosetta::main::{{closure}}
             at ./aptos/crates/aptos-rosetta/src/main.rs:54:13
   3: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/future/mod.rs:91:19
   4: tokio::park::thread::CachedParkThread::block_on::{{closure}}
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/park/thread.rs:263:54
   5: tokio::coop::with_budget::{{closure}}
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/coop.rs:102:9
   6: std::thread::local::LocalKey<T>::try_with
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/thread/local.rs:442:16
   7: std::thread::local::LocalKey<T>::with
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/std/src/thread/local.rs:418:9
   8: tokio::coop::with_budget
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/coop.rs:95:5
   9: tokio::coop::budget
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/coop.rs:72:5
  10: tokio::park::thread::CachedParkThread::block_on
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/park/thread.rs:263:31
  11: tokio::runtime::enter::Enter::block_on
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/runtime/enter.rs:151:13
  12: tokio::runtime::thread_pool::ThreadPool::block_on
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/runtime/thread_pool/mod.rs:81:9
  13: tokio::runtime::Runtime::block_on
             at ./usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.18.2/src/runtime/mod.rs:477:43
  14: aptos_rosetta::main
             at ./aptos/crates/aptos-rosetta/src/main.rs:73:5
  15: core::ops::function::FnOnce::call_once
             at ./rustc/fe5b13d681f25ee6474be29d748c65adcd91f69e/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

geekflyer avatar Jul 15 '22 02:07 geekflyer

actually it appears that the app simply doesn't handle SIGTERM correctly. When I run aptos-rosetta I'm unable to stop it via CTRL+C.

geekflyer avatar Jul 15 '22 02:07 geekflyer

As discussed this is a strange behavior with Docker, as it does work with the binary alone

gregnazario avatar Jul 25 '22 21:07 gregnazario

fixed with #2402

geekflyer avatar Aug 02 '22 03:08 geekflyer