ZcashFoundation / zebra

Zcash - Financial Privacy in Rust 🦓
https://zfnd.org/zebra/
Apache License 2.0
408 stars 98 forks source link

Crash when starting Zebra on Testnet #8617

Open khazaddum opened 3 months ago

khazaddum commented 3 months ago

When using a cache_dir that is a symlink to a storage drive, Zebra crashed. When using the actual path to the storage drive, Zebra runs normally.

Error

Opening database "/home/rav/.zebra/state/v25/testnet" failed: Error { message: "Failed to create RocksDB directory: `Os { code: 13, kind: PermissionDenied, message: \"Permission denied\" }`." }. Hint: Check if another zebrad process is running. Try changing the state cache_dir in the Zebra config.

Metadata

key value
version 1.7.0
Zcash network Testnet
running state version 25.3.0
initial disk state version creating.new.database
features default,getblocktemplate_rpcs,howudoin,indicatif,progress_bar,release_max_level_info
target triple x86_64-unknown-linux-gnu
rust compiler 1.79.0
rust release date 2024-06-10
optimization level 3
debug checks false
location /home/pitmutt/.cargo/registry/src/index.crates.io-6f17d22bba15001f/zebra-state-1.0.0-beta.37/src/service/finalized_state/disk_db.rs:860:23
oxarbitrage commented 3 months ago

Thanks for the report. Can you show exactly what you are using in the cache_dir field of the config ?

We maybe need to use https://doc.rust-lang.org/std/fs/fn.canonicalize.html on top of the provided path or similar.

khazaddum commented 3 months ago

The line in the config is

cache_dir = "/home/rav/.zebra"
oxarbitrage commented 3 months ago

I can't reproduce it. Here is what i tried.

created a link with:

mkdir testing
ln -s /media/alfredo/stuff/chain/zebra /home/alfredo/zebra/issue8617/testing/

config:

cache_dir = "/home/alfredo/zebra/issue8617/testing/zebra"

zebrad starts normally:

$ ./target/debug/zebrad -c myconf.toml start
...
2024-06-17T20:35:06.804374Z  INFO zebra_state::service::finalized_state::disk_db: Opened Zebra state cache at /home/alfredo/zebra/issue8617/testing/zebra/state/v25/mainnet
...

Can you describe more your process? I might be doing something wrong or different. Thanks again for your help.

khazaddum commented 3 months ago

I double checked and realized there was a typo in my symlink, so Zebra was trying to start with a non-existing folder. I think that's what caused the crash.

mpguerra commented 3 months ago

We should make Zebra fail with a better error so it makes it easier to troubleshoot these sorts of crashes