Describe the bug
# jcli rest v0 leaders logs get -h http://127.0.0.1:8443/api|less
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', src/libstd/io/stdio.rs:792:9
stack backtrace:
0: 0x56443e992601 - std::sys_common::backtrace::print::h74e8383011c48ac1
1: 0x56443e983a44 - std::panicking::default_hook::{{closure}}::hc989d29eac1bf07a
2: 0x56443e9837d3 - std::panicking::default_hook::h999474d3b9874310
3: 0x56443e984150 - std::panicking::rust_panic_with_hook::h8ac69ca134e1594e
4: 0x56443e983cd2 - std::panicking::continue_panic_fmt::ha458e61c9ee535d1
5: 0x56443e983c1f - std::panicking::begin_panic_fmt::h21166bd127fc249a
6: 0x56443e9915d5 - std::io::stdio::_print::h2d56082d59d2e96c
7: 0x56443e4ac6ec - jcli::jcli_app::rest::v0::leaders::Leaders::exec::h67d74929ace96763
8: 0x56443e52ac0d - jcli::jcli_app::rest::v0::V0::exec::hea96bd2f0572ded3
9: 0x56443e5935f8 - jcli::jcli_app::JCli::exec::h1f1831e630c4453e
10: 0x56443e52ceeb - jcli::main::h76017846829305d3
11: 0x56443e434433 - std::rt::lang_start::{{closure}}::h61b7bb1eacf86412
12: 0x56443e983b53 - std::panicking::try::do_call::h0c14233a80d9596c
13: 0x56443e99419a - __rust_maybe_catch_panic
14: 0x56443e986cb9 - std::rt::lang_start_internal::h34c921f5951345b4
15: 0x56443e5338f5 - main
16: 0x7fed4be45b8e - __libc_start_main
17: 0x56443e3cf1ba - _start
18: 0x0 - <unknown>
Mandatory Information
jcli --full-version output;jormungandr --full-version output;To Reproduce
Steps to reproduce the behavior:
Expected behavior
No panic
Looks fine for me on 0.5.5...
[mark_stopka@docker-host-01 jormungandr]$ ./jcli --full-version
jcli 0.5.5 (HEAD-aec29a1, release, linux [x86_64]) - [rustc 1.38.0 (625451e37 2019-09-23)]
[mark_stopka@docker-host-01 jormungandr]$ ./jormungandr --full-version
jormungandr 0.5.5 (HEAD-aec29a1, release, linux [x86_64]) - [rustc 1.38.0 (625451e37 2019-09-23)]
[mark_stopka@docker-host-01 jormungandr]$
[mark_stopka@docker-host-01 jormungandr]$ ./jcli rest v0 leaders logs get -h http://127.0.0.1:3101/api|less
---
[]
[mark_stopka@docker-host-01 jormungandr]$
Thank you for pointing that out - it crashes only when the leaders log is not empty, I guess it has something to do with buffer size?
[root@node1:~/nixpkgs]# jcli --full-version
jcli 0.5.5 (, release, linux [x86_64]) - [rustc 1.38.0]
[root@node1:~/nixpkgs]# jcli rest v0 leaders logs get -h http://127.0.0.1:8443/api|less
---
- created_at_time: "2019-10-02T11:35:38.248276899+00:00"
enclave_leader_id: 1
finished_at_time: ~
scheduled_at_date: "222.20095"
scheduled_at_time: "2019-10-02T19:03:24+00:00"
wake_at_time: ~
- created_at_time: "2019-10-02T11:35:38.249411296+00:00"
enclave_leader_id: 1
finished_at_time: ~
scheduled_at_date: "222.27653"
scheduled_at_time: "2019-10-02T23:15:20+00:00"
wake_at_time: ~
(...)
thread 'main' panicked at 'failed printing to stdout: Broken pipe (os error 32)', src/libstd/io/stdio.rs:792:9
stack backtrace:
0: 0x5575e8b83df1 - std::sys_common::backtrace::print::h74e8383011c48ac1
1: 0x5575e8b75234 - std::panicking::default_hook::{{closure}}::hc989d29eac1bf07a
2: 0x5575e8b74fc3 - std::panicking::default_hook::h999474d3b9874310
3: 0x5575e8b75940 - std::panicking::rust_panic_with_hook::h8ac69ca134e1594e
4: 0x5575e8b754c2 - std::panicking::continue_panic_fmt::ha458e61c9ee535d1
5: 0x5575e8b7540f - std::panicking::begin_panic_fmt::h21166bd127fc249a
6: 0x5575e8b82dc5 - std::io::stdio::_print::h2d56082d59d2e96c
7: 0x5575e869e53c - jcli::jcli_app::rest::v0::leaders::Leaders::exec::h9ff5639e635b2e72
8: 0x5575e871c8c0 - jcli::jcli_app::rest::v0::V0::exec::he6aaebbf649253b3
9: 0x5575e87851e8 - jcli::jcli_app::JCli::exec::h8d223c4656c97e9c
10: 0x5575e871eaeb - jcli::main::h1def118b359105d9
11: 0x5575e8626433 - std::rt::lang_start::{{closure}}::h10ede8e03cdb4bb0
12: 0x5575e8b75343 - std::panicking::try::do_call::h0c14233a80d9596c
13: 0x5575e8b8598a - __rust_maybe_catch_panic
14: 0x5575e8b784a9 - std::rt::lang_start_internal::h34c921f5951345b4
15: 0x5575e8725505 - main
16: 0x7fcf1311fb8e - __libc_start_main
17: 0x5575e85c11ba - _start
18: 0x0 - <unknown>
probably this https://github.com/rust-lang/rust/issues/46016
@mmahut jcli rest v0 leaders logs get -h http://127.0.0.1:8443/api | tee | less
while I do not panic even with leaders log data: jcli rest v0 leaders logs get | less
- created_at_time: "2019-10-02T13:30:00.219923665+00:00"
enclave_leader_id: 1
finished_at_time: "2019-10-02T13:33:30.004903781+00:00"
scheduled_at_date: "105633.21"
scheduled_at_time: "2019-10-02T13:33:30+00:00"
wake_at_time: "2019-10-02T13:33:30.002165354+00:00"
- created_at_time: "2019-10-02T13:40:00.220841337+00:00"
enclave_leader_id: 1
finished_at_time: "2019-10-02T13:48:00.006292681+00:00"
scheduled_at_date: "105634.48"
scheduled_at_time: "2019-10-02T13:48:00+00:00"
wake_at_time: "2019-10-02T13:48:00.003646150+00:00"
- created_at_time: "2019-10-02T13:40:00.220588960+00:00"
enclave_leader_id: 1
finished_at_time: "2019-10-02T13:40:10.006838831+00:00"
scheduled_at_date: "105634.1"
scheduled_at_time: "2019-10-02T13:40:10+00:00"
wake_at_time: "2019-10-02T13:40:10.004199653+00:00"
- created_at_time: "2019-10-02T13:23:42.809971746+00:00"
enclave_leader_id: 1
finished_at_time: "2019-10-02T13:28:50.006904945+00:00"
scheduled_at_date: "105632.53"
scheduled_at_time: "2019-10-02T13:28:50+00:00"
wake_at_time: "2019-10-02T13:28:50.002926064+00:00"
- created_at_time: "2019-10-02T13:40:00.220693739+00:00"
enclave_leader_id: 1
finished_at_time: "2019-10-02T13:44:10.004517716+00:00"
scheduled_at_date: "105634.25"
scheduled_at_time: "2019-10-02T13:44:10+00:00"
wake_at_time: "2019-10-02T13:44:10.001798764+00:00"
:
you can panic any jcli command, and probably jormungandr logging thread. Ex:
jcli --help | head -n0
thread 'main' panicked at 'Error writing Error to stdout: Os { code: 32, kind: BrokenPipe, message: "Broken pipe" }', src/libcore/result.rs:1084:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.
I've reproduced this issue on my Manjaro machine. It doesn't matter whether logs are empty or not, what matters is if they were completely read. If in less you hit ctrl+G to scroll to the end, it doesn't panic. This looks like panic from inability to flush stdout because of piped consumer being terminated. I'm not really sure how to fix that, to me this looks like a problem in stdlib.
Feel free to close this if this is a problem within rust.
Most helpful comment
Looks fine for me on 0.5.5...