There is a lock owned by a shared_ptr<dap::Socket::Shared> which seems to be never released if shared_ptr::reset is called while the lock is held.
The resets are called when bind or listen fails. I was trying to connect to an already in-use socket when this happened. Instead of ending up in the onError handler, the program became unresponsive.