After much more inspection, I found a solution. This is a specific OS problem. When a file is deleted on Linux (or Macintosh), it simply disables it. (I did not know about this) Therefore, if you run lsof on the machine, it still shows the file as open.
[ user@machine ]$ lsof | grep --color -i "testing.txt" python26 26495 user 8w REG 8,33 23474 671920 /home/user/temp/testing.txt (deleted)
The solution is to install the stream in python.
stat = os.fstat(fs.fileno())
This will give you the number of links that it has.
if stat.st_nlink < 1:
And you go there. Now you know whether to reboot it or not. Hope this helps someone else.
source share