For seemingly no reason today, I started getting crashes on exit in CleanupProcessSpecificTempDirectory when I ran certain tests. I determined this wasn't related to a code change, and when I looked in my temp lldb directory, I had close to 1500 process specific temp directories that had never been cleaned up, some dating back over 1 year ago.
Best I can figure out is that in the case of running the test suite, we've installed an atexit handler for the python executable itself. Which means it will call this atexit handler after it has already (presumably) unloaded our extension module, leading to undefined behavior.
Whatever the cause, atexit handlers are dangerous because of the restrictions on what kind of code you can run in them. I moved this to an explicit cleanup on Terminate, and verified that there are no more crashes on exit, and additionally the process specific temp directory is now correctly cleaned up after every test.
I don't know how (or even if) this was ever working on other platforms besides Windows, but you guys should check your temp/lldb directory and see if there are thousands of directories in there.