proxy_prepare_for_restart: Assertion mp->conf_state == PT_PROTO_COMPLETED failed
When trying to debug an unrelated issue, I found this failed assertion in the logs from when I ran my webtunnel bridge for the first time:
Nov 18 00:46:19 freeman Tor[1957]: We compiled with OpenSSL 300000b0: OpenSSL 3.0.11 19 Sep 2023 and we are running with OpenSSL 300000b0: 3.0.11. These two versions should be binary compatible.
Nov 18 00:46:19 freeman Tor[1957]: Tor 0.4.8.9 running on Linux with Libevent 2.1.12-stable, OpenSSL 3.0.11, Zlib 1.2.13, Liblzma 5.4.1, Libzstd 1.5.4 and Glibc 2.36 as libc.
[...]
Nov 18 15:54:01 freeman Tor[1957]: Received reload signal (hup). Reloading config and resetting internal state.
Nov 18 15:54:01 freeman Tor[1957]: Read configuration file "/usr/share/tor/tor-service-defaults-torrc".
Nov 18 15:54:01 freeman Tor[1957]: Read configuration file "/etc/tor/torrc".
[...]
Nov 18 15:54:01 freeman Tor[1957]: You are running a new relay. Thanks for helping the Tor network! If you wish to know what will happen in the upcoming weeks regarding its usage, have a look at https://blog.torproject.org/lifecycle-of-a-new-relay
Nov 18 15:54:01 freeman Tor[1957]: It looks like I need to generate and sign a new medium-term signing key, because I don't have one. To do that, I need to load (or create) the permanent master identity key. If the master identity key was not moved or encrypted with a passphrase, this will be done automatically and no further action is required. Otherwise, provide the necessary data using 'tor --keygen' to do it manually.
Nov 18 15:54:01 freeman Tor[1957]: Your Tor server's identity key fingerprint is 'GordonFreeman -snip-'
Nov 18 15:54:01 freeman Tor[1957]: Your Tor bridge's hashed identity key fingerprint is 'GordonFreeman C7EC873896FA23974762C32A18FB45F5520A4F70'
Nov 18 15:54:01 freeman Tor[1957]: Your Tor server's identity key ed25519 fingerprint is 'GordonFreeman -snip-'
Nov 18 15:54:01 freeman Tor[1957]: You can check the status of your bridge relay at https://bridges.torproject.org/status?id=C7EC873896FA23974762C32A18FB45F5520A4F70
Nov 18 15:54:01 freeman Tor[1957]: Configured hibernation. This interval begins at 2023-11-18 00:00:00 and ends at 2023-11-19 00:00:00. We have no prior estimate for bandwidth, so we will start out awake and hibernate when we exhaust our quota.
Nov 18 15:54:01 freeman Tor[1957]: Configured to measure statistics. Look for the *-stats files that will first be written to the data directory in 24 hours from now.
Nov 18 15:54:01 freeman Tor[1957]: Not advertising Directory Service support (Reason: AccountingMax enabled)
Nov 18 15:54:01 freeman Tor[1957]: Now checking whether IPv4 ORPort -snip- is reachable... (this may take up to 20 minutes -- look for log messages indicating success)
Nov 18 15:54:01 freeman Tor[1957]: Managed proxy "/usr/local/bin/webtunnel" process terminated with status code 256
Nov 18 15:54:01 freeman Tor[1957]: tor_assertion_failed_(): Bug: ../src/feature/client/transports.c:519: proxy_prepare_for_restart: Assertion mp->conf_state == PT_PROTO_COMPLETED failed; aborting. (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: Tor 0.4.8.9: Assertion mp->conf_state == PT_PROTO_COMPLETED failed in proxy_prepare_for_restart at ../src/feature/client/transports.c:519: . Stack trace: (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(log_backtrace_impl+0x57) [0x555f172f9ea7] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(tor_assertion_failed_+0x147) [0x555f17304c57] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(+0xc7d92) [0x555f172d6d92] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(+0xc9977) [0x555f172d8977] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(process_notify_event_exit+0x49) [0x555f1730f319] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(notify_pending_waitpid_callbacks+0xf7) [0x555f17310cb7] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /lib/x86_64-linux-gnu/libevent-2.1.so.7(+0x21402) [0x7f92579a6402] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /lib/x86_64-linux-gnu/libevent-2.1.so.7(event_base_loop+0x49f) [0x7f92579a6c1f] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(do_main_loop+0xf1) [0x555f17280671] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(tor_run_main+0x1e5) [0x555f1727bfa5] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(tor_main+0x59) [0x555f17278329] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(main+0x19) [0x555f17277ee9] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /lib/x86_64-linux-gnu/libc.so.6(+0x271ca) [0x7f92570ae1ca] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0x85) [0x7f92570ae285] (on Tor 0.4.8.9 )
Nov 18 15:54:01 freeman Tor[1957]: Bug: /usr/bin/tor(_start+0x21) [0x555f17277f31] (on Tor 0.4.8.9 )
I don't quite remember what I was doing at that time. IIRC webtunnel failed to launch because I misconfigured AppArmor?
Potentially related to #31091 (closed) or #32032 (closed)?