Can't get libra_swarm to run

I can’t seem to get libra_swarm to work. After exporting RUST_BACKTRACE=1 I get the following output on MacOS terminal:

Compiling libra_swarm v0.1.0 (/Users/adam/libra/libra_swarm)
    Finished dev [unoptimized + debuginfo] target(s) in 38.38s
     Running `target/debug/libra_swarm -s -n 2`
Faucet account created in (loaded from) file "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/keypair.dY1g72IHfyoO/temp_faucet_keys"
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpyWBSDZ" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpaEzRCV" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmppsWh7j" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpqmEO2y" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpUQ3nxS" })
thread 'main' panicked at 'Max out 5 attempts to launch swarm', libra_swarm/src/swarm.rs:247:9
stack backtrace:
   0: std::sys_common::thread_info::set
             at src/libstd/sys_common/thread_info.rs:42
   1: std::sys_common::thread::min_stack::{{closure}}
             at src/libstd/sys_common/thread.rs:22
   2: core::option::Option<T>::and_then
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/option.rs:624
   3: std::sys_common::thread::min_stack
             at src/libstd/sys_common/thread.rs:22
   4: std::sys_common::backtrace::log_enabled
             at src/libstd/sys_common/backtrace.rs:94
   5: std::panicking::default_hook
             at src/libstd/panicking.rs:172
   6: alloc::alloc::dealloc
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/liballoc/alloc.rs:103
   7: alloc::alloc::box_free
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/liballoc/alloc.rs:221
   8: core::ptr::real_drop_in_place
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/ptr/mod.rs:175
   9: core::ptr::real_drop_in_place
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/ptr/mod.rs:175
  10: core::ptr::real_drop_in_place
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/ptr/mod.rs:175
  11: std::sys_common::fs::remove_dir_all_recursive
             at src/libstd/sys_common/fs.rs:32
  12: std::sys_common::fs::remove_dir_all_recursive
             at src/libstd/sys_common/fs.rs:32
  13: libra_swarm::swarm::LibraSwarm::launch_swarm_attempt
             at libra_swarm/src/swarm.rs:322
  14: core::fmt::ArgumentV1::new
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/fmt/mod.rs:283
  15: libra_swarm::main
             at libra_swarm/src/main.rs:38
  16: <core::result::Result<T,E> as core::ops::try::Try>::into_result
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/result.rs:1304
  17: std::sys_common::fs::remove_dir_all
             at src/libstd/sys_common/fs.rs:23
  18: std::sys_common::thread_info::ThreadInfo::with::{{closure}}
             at src/libstd/sys_common/thread_info.rs:18
  19: std::thread::local::LocalKey<T>::try_with
             at src/libstd/thread/local.rs:257
  20: std::sys_common::thread_info::ThreadInfo::with
             at src/libstd/sys_common/thread_info.rs:16
  21: std::sys_common::thread_info::stack_guard
             at src/libstd/sys_common/thread_info.rs:33
  22: std::sys::unix::stack_overflow::imp::signal_handler
             at src/libstd/sys/unix/stack_overflow.rs:90
  23: core::fmt::Arguments::new_v1
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libcore/fmt/mod.rs:316
  24: std::panicking::default_hook::{{closure}}
             at src/libstd/panicking.rs:190
  25: libra_swarm::main
             at libra_swarm/src/main.rs:37
  26: std::thread::Builder::spawn_unchecked
             at /rustc/6e310f2abae97323ca1d5469657b83aa1a9407e0/src/libstd/thread/mod.rs:0

Any guidance would be appreciated. Thanks!

May I know what is the command you use ?

Did you follow the guide in https://developers.libra.org/docs/my-first-transaction ?

1 Like

Thank you @apisak!

Yes, I have run through the ‘my first transaction.’ But since then I have redownloaded and rebuilt the latest version of libra from github.

I ran the libra setup scripts, started the client and quit the client. But I didn’t generate any accounts or transactions.

Then I ran: cargo run -p libra_swarm -- -s -n 4

received:

   Compiling fs_extra v1.1.0
   Compiling nix v0.14.1
   Compiling tempdir v0.3.7
   Compiling types v0.1.0 (/Users/adam/libra/types)
   Compiling debug_interface v0.1.0 (/Users/adam/libra/common/debug_interface)
   Compiling jemalloc-sys v0.1.8
   Compiling generate_keypair v0.1.0 (/Users/adam/libra/config/generate_keypair)
warning: unused import: `crate::account_address::AccountAddress`
 --> types/src/event.rs:3:5
  |
3 | use crate::account_address::AccountAddress;
  |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |
  = note: #[warn(unused_imports)] on by default

warning: unused import: `tiny_keccak::sha3_256`
  --> types/src/event.rs:18:5
   |
18 | use tiny_keccak::sha3_256;
   |     ^^^^^^^^^^^^^^^^^^^^^

   Compiling ctrlc v3.1.3
   Compiling vm v0.1.0 (/Users/adam/libra/language/vm)
   Compiling storage_proto v0.1.0 (/Users/adam/libra/storage/storage_proto)
   Compiling state_view v0.1.0 (/Users/adam/libra/storage/state_view)
   Compiling scratchpad v0.1.0 (/Users/adam/libra/storage/scratchpad)
   Compiling config v0.1.0 (/Users/adam/libra/config)
   Compiling ir_to_bytecode_syntax v0.1.0 (/Users/adam/libra/language/compiler/ir_to_bytecode/syntax)
   Compiling libra_wallet v0.1.0 (/Users/adam/libra/client/libra_wallet)
   Compiling storage_client v0.1.0 (/Users/adam/libra/storage/storage_client)
   Compiling jemallocator v0.1.9
   Compiling vm_runtime_types v0.1.0 (/Users/adam/libra/language/vm/vm_runtime/vm_runtime_types)
   Compiling jemalloc v0.1.0 (/Users/adam/libra/common/jemalloc)
   Compiling network v0.1.0 (/Users/adam/libra/network)
   Compiling bytecode_verifier v0.1.0 (/Users/adam/libra/language/bytecode_verifier)
   Compiling vm_runtime v0.1.0 (/Users/adam/libra/language/vm/vm_runtime)
   Compiling ir_to_bytecode v0.1.0 (/Users/adam/libra/language/compiler/ir_to_bytecode)
   Compiling vm_validator v0.1.0 (/Users/adam/libra/vm_validator)
   Compiling stdlib v0.1.0 (/Users/adam/libra/language/stdlib)
   Compiling vm_genesis v0.1.0 (/Users/adam/libra/language/vm/vm_genesis)
   Compiling config_builder v0.1.0 (/Users/adam/libra/config/config_builder)
   Compiling mempool v0.1.0 (/Users/adam/libra/mempool)
   Compiling admission_control_proto v0.1.0 (/Users/adam/libra/admission_control/admission_control_proto)
   Compiling client v0.1.0 (/Users/adam/libra/client)
   Compiling libra_swarm v0.1.0 (/Users/adam/libra/libra_swarm)
    Finished dev [unoptimized + debuginfo] target(s) in 2m 34s
     Running `target/debug/libra_swarm -s -n 4`
Faucet account created in (loaded from) file "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/keypair.cTBUcCVnbL5g/temp_faucet_keys"
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpGK75yI" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpgRNwms" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpXJsGvN" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpmifkOc" })
Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpKX3Xhw" })
thread 'main' panicked at 'Max out 5 attempts to launch swarm', libra_swarm/src/swarm.rs:247:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

ran:
export RUST_BACKTRACE=1

then I ran:
cargo run -p libra_swarm -- -s -n 2

That’s what resulted in the above output. But from your reply maybe it’s because I don’t have any addresses generated? I’ll try that.

May I ask, why you need to run with “-n 4” ? and “-n 2” ?
The -n means number of node, which there is required multiple configuration and resource to run.

If you only need to learn libra commands and move, you may not really want to run multiple nodes. But if you really need to run multiple node, I would suggest to look for execute by docker instead. I wrote some docs in Thai language, I’m not sure if you can use translator to read it. Ref: https://medium.com/@srihamat.a/facebook-libra-focus-on-create-testnet-like-f448d9f19c3f

Also, I think you might need to checkout testnet branch (if not yet do for last pull code), there is many times main branch broken but testnet branch is executable.

1 Like

Thank you again!

You’re right. I don’t really need to run multiple nodes. I am on the testnet branch. I just double checked.

I ran: cargo run -p libra_swarm

and my terminal sits here:

Finished dev [unoptimized + debuginfo] target(s) in 0.82s Runningtarget/debug/libra_swarmFaucet account created in (loaded from) file "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/keypair.LOvP2CmMeOuR/temp_faucet_keys" Base directory containing logs and configs: Temporary(TempDir { path: "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpAqbbRk" })

So I took those paths and plugged it into running a client in another terminal window:

cargo run --bin client -- -a localhost -p 57149 -s "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpAqbbRk/trusted_peers.config.toml" -m "/var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/keypair.LOvP2CmMeOuR/temp_faucet_keys" Finished dev [unoptimized + debuginfo] target(s) in 0.41s Runningtarget/debug/client -a localhost -p 57149 -s /var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/.tmpAqbbRk/trusted_peers.config.toml -m /var/folders/bg/ddjlgftj4395848c0t9bl5980000gn/T/keypair.LOvP2CmMeOuR/temp_faucet_keysE0911 11:52:53.605249 4664649152 client/src/client_proxy.rs:865] Failed to get account state from validator, error: RpcFailure(RpcStatus { status: DeadlineExceeded, details: Some("Deadline Exceeded") }) Not able to connect to validator at localhost:57149, error RpcFailure(RpcStatus { status: DeadlineExceeded, details: Some("Deadline Exceeded") })

So I’m not sure if my node is actually running or if it’s stuck on some process. Or if there’s something wrong with my client command.

Well, you are currently try to connect your libra client to a libra validator node at your localhost, which error showed that libra client can not found it. Do you have admission control port listening by your validator ? Is that port 57149 ?

Last month, I draw some picture which it’s a client connect to validator (4 validators) in docker. The port number may be difference but the concept of connection should be same.
image

As I mentioned, there are many configurations required, the basic configuration is the network port and actually there are many network ports in the system configuration. Wrongly config only one of them cause system go wrong and resulting error.

My suggestion:

  1. If you only need to explore the libra commands, please connect to libra testnet (validator server host at testnet.libra.org) by using command:

$ ./scripts/cli/start_cli_testnet.sh

  1. If you are interested in learning libra behaviors related with client, admission control and some storage. You can run only one validator with automatic connect client into it by using command:

$ cargo run -p libra_swarm – -s

  1. If you interested in deep details of libra validator on consensus between multiple validators then try refer to my document I sent to you.