Error during communication with the replica (os error 111)

dfx start (or start --clean) not working properly

dfx canister call hello greet everyone

An error happened during communication with the replica: error sending request for url (http://127.0.0.1:8000/api/v2/status): error trying to connect: tcp connect error: Connection refused (os error 111)

Environment:
Docker version 20.10.6, build 370c289
Distributor ID: Ubuntu
Description: Ubuntu 20.04.2 LTS
Release: 20.04
Codename: focal

Logs starting local replica:

export RUST_BACKTRACE=full

dfx startMay 30 12:26:40.540 INFO ic-starter. Configuration: ValidatedConfig { replica_path: Some("/root/.cache/dfinity/versions/0.7.0/replica"), replica_version: “0.1.0”, log_level: Warning, cargo_bin: “cargo”, cargo_opts: “”, state_dir: “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state”, http_listen_addr: V4(127.0.0.1:0), http_port_file: Some("/tmp/tmp.kVFpiY1sCm/hello/.dfx/replica-configuration/replica-1.port"), metrics_addr: None, provisional_whitelist: Some(All), artifact_pool_dir: “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/node-100/ic_consensus_pool”, artifact_backup_dir: None, crypto_root: “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/node-100/crypto”, state_manager_root: “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/node-100/state”, registry_local_store_path: “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/ic_registry_local_store”, unit_delay: None, initial_notary_delay: None, detect_consensus_starvation: None, consensus_pool_backend: Some(“rocksdb”), state_dir_holder: None }, Application: starter

May 30 12:26:40.540 INFO Use existing replica configuration “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/ic.json5”, Application: starter
May 30 12:26:40.540 INFO Executing “/root/.cache/dfinity/versions/0.7.0/replica” “–replica-version” “0.1.0” “–config-file” “/tmp/tmp.kVFpiY1sCm/hello/.dfx/state/replicated_state/ic.json5”, Application: starter
thread ‘replica-actor’ panicked at ‘called Result::unwrap() on an Err value: Cannot start the replica: Timeout’, src/dfx/src/actors/replica.rs:297:17
stack backtrace:
0: 0x563c49b36a03 - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::h8e44e3bad104136e
1: 0x563c49b8ed2d - core::fmt::write::he8cb6d64ed166147
2: 0x563c49b5f077 - std::io::Write::write_fmt::hf25ce96005919ce6
3: 0x563c49b50340 - std::panicking::default_hook::{{closure}}::hf8bcda2c877e2dcc
4: 0x563c49b50054 - std::panicking::default_hook::h0602fc6a3744f2c1
5: 0x563c49b509b7 - std::panicking::rust_panic_with_hook::h7b83b0fe7900eb7a
6: 0x563c49b505bb - rust_begin_unwind
7: 0x563c49b8ea11 - core::panicking::panic_fmt::h61e03e91a1a8868a
8: 0x563c49b8eaa3 - core::result::unwrap_failed::hfb81d2c162de1956
9: 0x563c4862e5aa - std::sys_common::backtrace::__rust_begin_short_backtrace::h94de5a14059097af
10: 0x563c487fda65 - core::ops::function::FnOnce::call_once{{vtable.shim}}::h4e69c9dcb6d30a26
11: 0x563c49b54c6a - std::sys::unix::thread::thread::new::thread_start::h2dd53bf76d714ab0
12: 0x7f403acca609 - start_thread
13: 0x7f403ae11293 - __clone
14: 0x0 -

Fortunately, there is a workaround, It works with:

dfx start --emulator

What is the difference between them?

8 Likes

thanks work for me . :grinning:

1 Like

Why does this work??

1 Like

From dfx start --help:

dfx start 
Starts the local replica and a web server for the current project
[...]
--emulator
Runs a dedicated emulator instead of the replica
1 Like

The solution works but would like to understand more about why.

What kind of performance and usability concerns might I run into doing it this way?

1 Like