Dfinity internet computer - error during communication with the replica

1.7k Views Asked by At

I'm following the quickstart local development setup on an Ubuntu v20 machine I'm getting the following error on dfx deploy:

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)

I'm struggling to interpret this error.

  1. What is "the replica"?
  2. What is a typical cause of the above error?

Is there a high level description of what should be happening? E.g dfx start creates a local server, dfx deploy connects to it...

EDIT:

Here is the error message I get when starting a canister (dfx start):

Starting webserver for /_/
binding to: 127.0.0.1:39075
thread 'replica-actor' panicked at 'Could not start replica.: Os { code: 2, kind: NotFound, message: "No such file or directory" }', src/dfx/src/actors/replica.rs:270:41
stack backtrace:
   0:     0x55b33e8c1c9c - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hc7188311863b0a19
   1:     0x55b33e915c9f - core::fmt::write::h1307f2f9840d31ee
   2:     0x55b33e8c08d6 - std::io::Write::write_fmt::h532114cf70864559
   3:     0x55b33e891fb5 - std::panicking::default_hook::{{closure}}::h93cbb62df5d5a099
   4:     0x55b33e891b85 - std::panicking::default_hook::he8b45a702a668bc8
   5:     0x55b33e892573 - std::panicking::rust_panic_with_hook::h6bea14b72fcfecfa
   6:     0x55b33e8c29d7 - std::panicking::begin_panic_handler::{{closure}}::h7f75d52845ef501f
   7:     0x55b33e8c1ddc - std::sys_common::backtrace::__rust_end_short_backtrace::h22ba316cf03ea695
   8:     0x55b33e892162 - rust_begin_unwind
   9:     0x55b33d32b2d1 - core::panicking::panic_fmt::h9bdcdb491a1e0164
  10:     0x55b33d32b6f3 - core::result::unwrap_failed::hf33778b32d467866
  11:     0x55b33d50b6ab - std::sys_common::backtrace::__rust_begin_short_backtrace::hd6fd0b117aef8154
  12:     0x55b33d5843f7 - core::ops::function::FnOnce::call_once{{vtable.shim}}::hba2d7669c4d85358
  13:     0x55b33e8babf8 - std::sys::unix::Thread::thread_start::h8e496d3e84bbb47f
  14:     0x7f5e64069609 - start_thread
  15:     0x7f5e641da293 - clone
  16:                0x0 - <unknown>

Does anyone have any ideas for next steps I could take?

EDIT 2:

I got this working in the end by running the uninstall.sh script and reinstalling, it then worked... Incidentally, the second time installed v0.8.1 (the first was 0.8.2) Also, just to note that I upgraded ubunutu from v18 to v20 after an initial failed install (related to GLIBC version error). So perhaps the above error is related to this..

3

There are 3 best solutions below

0
On

I solved these problems by checking dfx --help, where I found dfx upgrade. After running

dfx upgrade

I no longer received the replica error and the npm start error anymore. Then the app runs on my local machine.

1
On

In general, if you get a replica issue, I recommend you try to restart a new one and deploy everything again. Use dfx start --clean first then dfx deploy.

0
On
  1. killall dfx replica
  2. dfx start
  3. dfx deploy (if you have new changes)
  4. npm start (if you are using npm)