3

In a Python program, I use np.memmaps, which make use of the /tmp directory to handle massive arrays. I make sure to clear /tmpregularly by running rm -rf /tmp/* every time I use this code. However recently, my code stopped working and threw me a "Bus error (core dumped)".

Now, even using auto-completion in the terminal results in: bash: cannot create temp file for here-document: No space left on device.

typing df -h gives me, I think, the culprit:

tmpfs            32G   32G     0 100% /tmp

However, running sudo rm -rf /tmp/* only puts me back to

tmpfs            32G   30G  1,9G  94% /tmp

Any idea what is going on and how to fix it?

2
  • 1
    rm -rf /tmp/* won't delete hidden files/dirs. What's the output of du -ah /tmp and lsof -a +L1 /tmp (as root)? Jul 24, 2020 at 16:59
  • sudo du -ah /tmp doesn't give anything interesting, lsof -a +L1 /tmp returns a bunch of heavy files (which are indeed the memmaps I use in python), for example: python3 14959 moissard 60u REG 0,44 2871607712 0 377854 /tmp/tmpsb6pyut5/Bx.dat (deleted) Jul 24, 2020 at 17:03

1 Answer 1

5

This command will let you learn the truth:

sudo lsof -n | grep /tmp |grep deleted

In Unix deleted files still exist in the filesystem and take space in it until the application using them closes the files or this application is terminated.

So, find the processes that have open deleted files and restart or terminate them.

It would be great to forcefully close the said file descriptors without terminating the apps using them but the Linux kernel doesn't support the revoke() system call: https://bugzilla.kernel.org/show_bug.cgi?id=14505

7

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .