shard_accumulator only keeps a weak_ptr to the stream, but setup() passed
it a temporary from shared_from_this(). setup() runs on the network
thread, so if the main thread drops its reference meanwhile (e.g. while
shutting down after XR_ERROR_INSTANCE_LOST), that temporary is the last
one and ~stream runs on the network thread. It then joins
network_thread from itself: std::system_error (EDEADLK) and
std::terminate.
Pass weak_from_this() instead so no strong reference is created.