tor-chanmgr: Panic when bootstrapping in a censored environment
See onionmasq#110
When we run arti in censored environment1, it will periodically spam stderr with the following:
thread 'tokio-runtime-worker' panicked at /Users/cve/.cargo/git/checkouts/arti-ad20a813413c4843/2ccad1b/crates/tor-chanmgr/src/mgr/state.rs:616:13:
Dropped the 'PendingChannelHandle' without removing the channel
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
thread 'tokio-runtime-worker' panicked at /Users/cve/.cargo/git/checkouts/arti-ad20a813413c4843/2ccad1b/crates/tor-chanmgr/src/mgr/state.rs:616:13:
Dropped the 'PendingChannelHandle' without removing the channel
thread 'tokio-runtime-worker' panicked at /Users/cve/.cargo/git/checkouts/arti-ad20a813413c4843/2ccad1b/crates/tor-chanmgr/src/mgr/state.rs:616:13:
Dropped the 'PendingChannelHandle' without removing the channel
thread 'tokio-runtime-worker' panicked at /Users/cve/.cargo/git/checkouts/arti-ad20a813413c4843/2ccad1b/crates/tor-chanmgr/src/mgr/state.rs:616:13:
Dropped the 'PendingChannelHandle' without removing the channel
Personally, I think that a panic is sort of harsh for such a condition, as running Tor in a blocked environment is anything but an edge case.
I have run this on macOS Sequoia on Apple Silicon. The code I have used is the following (ignore the unused imports, I stripped out the irrelevant parts of a larger piece of code):
use std::time::Duration;
use anyhow::Result;
use arti_client::{TorClient, TorClientConfig};
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio_stream::StreamExt;
use tor_chanmgr::ConnStatusEvents;
#[tokio::main]
async fn main() -> Result<()> {
let cfg = TorClientConfig::default();
let tor_client = TorClient::create_bootstrapped(cfg).await?;
tokio::time::sleep(Duration::from_secs(30)).await;
Ok(())
}
-
I blocked all IPv4 and IPv6 addresses from the consensus on firewall level ↩