panics on broken pipe
bestouff opened this issue · 4 comments
bestouff commented
Hi,
in mqttc-0.1.4/src/client.rs, line 690:
fn _write_packet(&mut self, packet: &Packet) {
trace!("{:?}", packet);
self.conn.write_packet(&packet).unwrap();
}
the unwrap()
panics:
thread 'main' panicked at 'called `Result::unwrap()` on an `Err` value: Io(Error { repr: Os { code: 32, message: "Broken pipe" } })', src/libcore/result.rs:799
stack backtrace:
1: 0x7f0d11cdadcf - std::sys::backtrace::tracing::imp::write::h6f1d53a70916b90d
2: 0x7f0d11cdf48d - std::panicking::default_hook::{{closure}}::h137e876f7d3b5850
3: 0x7f0d11cddfe0 - std::panicking::default_hook::h0ac3811ec7cee78c
4: 0x7f0d11cde5e8 - std::panicking::rust_panic_with_hook::hc303199e04562edf
5: 0x7f0d11cde482 - std::panicking::begin_panic::h6ed03353807cf54d
6: 0x7f0d11cde3c0 - std::panicking::begin_panic_fmt::hc321cece241bb2f5
7: 0x7f0d11cde341 - rust_begin_unwind
8: 0x7f0d11d1215f - core::panicking::panic_fmt::h27224b181f9f037f
9: 0x7f0d11ad97a2 - core::result::unwrap_failed::hf1a3b54c69e1eeef
at /build/rustc-1.13.0+dfsg1/src/libcore/macros.rs:29
10: 0x7f0d11acfad3 - <core::result::Result<T, E>>::unwrap::haa3663173b183954
at /build/rustc-1.13.0+dfsg1/src/libcore/result.rs:737
11: 0x7f0d11aeb64c - mqttc::client::Client::_write_packet::h28186173ff27678d
at /home/xav/.cargo/registry/src/github.com-1ecc6299db9ec823/mqttc-0.1.4/src/client.rs:690
12: 0x7f0d11aec2f5 - mqttc::client::Client::_publish::h83daa8036786cf37
at /home/xav/.cargo/registry/src/github.com-1ecc6299db9ec823/mqttc-0.1.4/src/client.rs:647
13: 0x7f0d11ae2bbb - <mqttc::client::Client as mqttc::PubSub>::publish::hba48b09bebf91cde
at /home/xav/.cargo/registry/src/github.com-1ecc6299db9ec823/mqttc-0.1.4/src/client.rs:215
...
Could it return something meaningful instead ?
bestouff commented
ping ?
inre commented
Let me see
bestouff commented
(FWIW I don't think using unwrap() in libraries is idiomatic in rust, because of the induced panic.)
ZaWertun commented
Got this errors when keep_alive
was set to 5 sec.
With 60 sec error rate is significantly reduced.