Compiling with -DDEBUG_LOCKORDER, I found a crash-at-shutdown bug due to ThreadGetMyExternalIP calling AddLocal() after Shutdown()/global destructors.
I believe the fix is to have ThreadGetMyExternalIP be part of the network thread group, so Shutdown interrupts it and waits for it it finish.
This is hard to reproduce; I had to try several times starting up and almost immediately stopping to get a crash (stop has to happen after ThreadGetMyExternalIP is started, but before it is done).