The TaskExecutorCursor destructor calls _pcteToken.reset() before the killCursors callback and PCTE destruction is complete. If shutdownPinnedExecutors runs after the token is reset but while the PCTE still has in-flight networking, it won't find the PCTE.
Move _pcteToken into the killCursors callback lambda (as a shared_ptr) so the PCTE stays registered in the shutdown registry until it is fully destroyed. This closes the race window where shutdownPinnedExecutors could miss the PCTE during concurrent cursor teardown and server shutdown.