Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

"Thread 'main' panicked at 'Logger is initialized only once" when writing to non-existent directory #10420

Closed
HCastano opened this issue Feb 25, 2019 · 0 comments · Fixed by #10424
Assignees
Labels
F1-panic 🔨 The client panics and exits without proper error handling. M4-io 💾 Interaction with filesystem/databases.
Milestone

Comments

@HCastano
Copy link
Contributor

Before filing a new issue, please provide the following information.

  • Parity Ethereum version: 2.3.2
  • Operating system: MacOS
  • Installation: Built from source
  • Fully synchronized: N/A
  • Network: N/A
  • Restarted: N/A

Your issue description goes here below. Try to include actual vs. expected behavior and steps to reproduce the issue.

I was running a local POA node and I was getting some logs out of it. I started my node and set the log-file path to logs/folder_that_exists/node0.log. It happily wrote logs into that file. I then stopped my node and decided I should put the new logs elsewhere. I changed the path to logs/doesnt_exist/node0.log and ran into the following issue:

$ ./parity --config config/node0.toml --logging debug --log-file logs/doesnt_exist/node0.log
Loading config file from config/node0.toml

====================

stack backtrace:
0: 0x10bbc6144 - backtrace::backtrace::trace::h8a7c402ded9ee5da
at /Users/hcastano/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/backtrace/mod.rs:42
1: 0x10bbc0fdc - backtrace::capture::Backtrace::new_unresolved::h172ea2b7372feda8
at /Users/hcastano/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:88
2: 0x10bbc0f3e - backtrace::capture::Backtrace::new::h0e09f610eea36e0a
at /Users/hcastano/.cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.9/src/capture.rs:63
3: 0x10bbc0580 - panic_hook::gen_panic_msg::h7bed3e835d5c96fa
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/util/panic-hook/src/lib.rs:72
4: 0x10bbbe80c - panic_hook::set_with::{{closure}}::h47633d3618dc6899
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/util/panic-hook/src/lib.rs:45
5: 0x10bdbb4f1 - std::panicking::rust_panic_with_hook::h3fe6a67edb032589
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:495
6: 0x10bdbaf3c - std::panicking::continue_panic_fmt::hf7169aba6b1afe9c
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:398
7: 0x10bdbae28 - _rust_begin_unwind
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:325
8: 0x10bdd6bd1 - core::panicking::panic_fmt::hf684b13de6e3dd2d
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/panicking.rs:95
9: 0x109a7fd6f - core::result::unwrap_failed::hd97cb065d984bbdb
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/macros.rs:26
10: 0x107b92046 - <core::result::Result<T, E>>::expect::h045a7b44bfa043db
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libcore/result.rs:835
11: 0x1079e2194 - parity_ethereum::execute::h27a4db55968639fa
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/parity/lib.rs:188
12: 0x1079e18de - parity_ethereum::start::h240b65b3bbf6882a
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/parity/lib.rs:232
13: 0x107b5de91 - parity::main_direct::h82784f577ab41b38
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/parity/main.rs:209
14: 0x107b60621 - parity::main::hfca727d4644e1715
at /Users/hcastano/Workspace/parity-tech/parity-ethereum/parity/main.rs:399
15: 0x107ac4871 - std::rt::lang_start::{{closure}}::h62b4623999ea3301
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
16: 0x10bdbada7 - std::panicking::try::do_call::hb3270f6ae846849d
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/panicking.rs:310
17: 0x10bdd024e - ___rust_maybe_catch_panic
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libpanic_unwind/lib.rs:102
18: 0x10bdbb7fa - std::rt::lang_start_internal::ha07e743882e341f3
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:58
19: 0x107ac4851 - std::rt::lang_start::hda9e4015f720b8e8
at /rustc/9fda7c2237db910e41d6a712e9a2139b352e558b/src/libstd/rt.rs:74
20: 0x107b60b11 - _main

Thread 'main' panicked at 'Logger is initialized only once; qed: "Cannot write to log file given: logs/doesnt_exist/node0.log"', src/libcore/result.rs:1009

This is a bug. Please report it at:

https://github.com/paritytech/parity-ethereum/issues/new

[1] 10949 abort ./parity --config config/node0.toml --logging debug --log-file

If I make a new folder and set the log path to logs/does_exist/node0.log there are no issues. I don't think that we should be panicking in the case where a folder doesn't exist. We should either be making a new folder, or at least giving the user a nicer message.

@HCastano HCastano added F1-panic 🔨 The client panics and exits without proper error handling. M4-io 💾 Interaction with filesystem/databases. labels Feb 25, 2019
@debris debris self-assigned this Feb 26, 2019
@soc1c soc1c added this to the 2.5 milestone Feb 27, 2019
HCastano added a commit that referenced this issue Feb 27, 2019
* revert some changes, could be buggy (#10399)

* ci: clean up gitlab-ci.yml leftovers from previous merge (#10429)

* 10000 > 5000 (#10422)

addresses #10418

* fix underflow in pip, closes #10419 (#10423)

* fix panic when logging directory does not exist, closes #10420 (#10424)

* Update hardcoded headers for Foundation, Ropsten, Kovan and Classic (#10417)

* update foundation to #7262209

* update kovan to #10434561

* update ropsten to #5027841

* update classic to #7555073

* Update Ropsten headers to #5101569
HCastano added a commit that referenced this issue Feb 27, 2019
* revert some changes, could be buggy (#10399)

* 10000 > 5000 (#10422)

addresses #10418

* fix panic when logging directory does not exist, closes #10420 (#10424)

* fix underflow in pip, closes #10419 (#10423)

* ci: clean up gitlab-ci.yml leftovers from previous merge (#10429)

* Update hardcoded headers for Foundation, Ropsten, Kovan and Classic (#10417)

* update foundation to #7262209

* update kovan to #10434561

* update ropsten to #5027841

* update classic to #7555073

* Update Ropsten headers to #5101569
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
F1-panic 🔨 The client panics and exits without proper error handling. M4-io 💾 Interaction with filesystem/databases.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants