Skip to content

Curious behaviour of some Drop impl or post-main tokio shutdown code

I found this bug while working on #287. My branch isn't tidy and suitable for review, but it does seem to basically work - and then somehow the tokio reactor shutdown hangs. At least, I think that's what's happening.

Steps to reproduce

Fetch https://gitlab.torproject.org/Diziet/arti/-/tree/tls and check out commitid Diziet/arti@f9361952

cargo +stable build --workspace --all-features --examples

RUST_LOG=debug target/debug/examples/hyper https://yarrg.chiark.net/

Observed behaviour

[...]
2022-02-24T19:27:17.449585Z DEBUG tor_circmgr: Checking preemptive circuit predictions.
2022-02-24T19:27:17.449823Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:17.543758Z DEBUG hyper::proto::h1::io: parsed 5 headers
2022-02-24T19:27:17.543791Z DEBUG hyper::proto::h1::conn: incoming body is content-length (342 bytes)
2022-02-24T19:27:17.543995Z DEBUG hyper::proto::h1::conn: incoming body completed
status: 302 Found
2022-02-24T19:27:17.544121Z DEBUG hyper::client::pool: pooling idle connection for ("https", yarrg.chiark.net)
body: <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="http://yarrg.chiark.net/intro">here</a>.</p>
<hr>
<address>Apache/2.4.10 (Debian) OpenSSL/1.0.1t mod_perl/2.0.9dev Perl/v5.20.2 Server at yarrg.chiark.net Port 443</address>
</body></html>

2022-02-24T19:27:17.722744Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:17.722818Z  INFO tor_circmgr::mgr: Circuit attempt 1 failed.
2022-02-24T19:27:17.722846Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:17.989841Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:17.989914Z  INFO tor_circmgr::mgr: Circuit attempt 2 failed.
2022-02-24T19:27:17.990024Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:18.271424Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:18.271499Z  INFO tor_circmgr::mgr: Circuit attempt 3 failed.
2022-02-24T19:27:18.271528Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:18.554938Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:18.555011Z  INFO tor_circmgr::mgr: Circuit attempt 4 failed.
2022-02-24T19:27:18.555039Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:18.839266Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:18.839339Z  INFO tor_circmgr::mgr: Circuit attempt 5 failed.
2022-02-24T19:27:18.839368Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:19.123024Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:19.123077Z  INFO tor_circmgr::mgr: Circuit attempt 6 failed.
2022-02-24T19:27:19.123123Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:19.439578Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:19.439658Z  INFO tor_circmgr::mgr: Circuit attempt 7 failed.
2022-02-24T19:27:19.439782Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
2022-02-24T19:27:19.742739Z  INFO tor_circmgr::mgr: While waiting on circuit: Err(Canceled) from Left
2022-02-24T19:27:19.742820Z  INFO tor_circmgr::mgr: Circuit attempt 8 failed.
2022-02-24T19:27:19.743017Z DEBUG tor_circmgr::usage: preemptive usage Preemptive { port: None, circs: 2 } matches 0 active circuits
[continues]

Expected behaviour

The program terminates.