This is a follow up to this question: Why doesn't vim always give me the option to delete a swap file?
My laptop died with some Vim sessions open. These were all files I had already saved, so I don't need the swap files, but the "Delete" option isn't present when I edit some of them. As described in the question above, Vim thinks the previous process is still running:
Found a swap file by the name "~/.vim/tmp//%home%dominickpastore%research%codegen%rabbitmq.c.swp"
owned by: dominickpastore dated: Tue May 12 13:56:53 2020
file name: ~dominickpastore/research/codegen/rabbitmq.c
modified: no
user name: dominickpastore host name: carbon
process ID: 8903 (still running)
While opening file "rabbitmq.c"
dated: Tue May 12 13:56:49 2020
The thing is, my laptop was fully dead, so I know for a fact that the previous process is not still running! And just to be sure, I checked if there is another process with that PID, and there is not.
Interestingly, it only did this for 2 of 5 files I had open (all in different instances of Vim). It properly recognized the other 3 as gone.
How does Vim determine if the previous process is still running? Why is it sometimes mistaken?