"Instantly" makes sense. [Maybe everyone knows this.] If a process creates
a file, and that file is deleted (either by the original process or by some
other process), that file still exists and can be written to by that
process until it is closed, and it takes up space on the file system. (I'm
not sure if any other process would be able to access the file, but you
certainly wouldn't see it with ls.) You can see the effect by running
something like
#----------
import sys
import os
import subprocess
import time

subprocess.call('df')
outfile = open('space', 'w')
 for n in xrange(100000000):
    outfile.write("blah")
subprocess.call('df')
os.remove('space')
time.sleep(1)
subprocess.call('df')
 outfile.close()
time.sleep(1)
subprocess.call('df')
#----------

Perhaps neither call to time.sleep() should not be necessary, but the
second can change the output on my system, which probably comes down to
some multiprocess race conditions, and the first is there to make sure that
the OS has actually had time to delete the file. Also, you could actually
move the os.remove() to right after the open(). (I think some parts of this
might work differently on windows, though.)

The output I get is:

bober@pafnuty:~/test$ python blah.py | grep sda
/dev/sda5            1179091124 726301120 392895580  65% /    <---- before
writing
 /dev/sda5            1179091124 726692892 392503808  65% /    <---- after
writing, before deleting
/dev/sda5            1179091124 726692892 392503808  65% /    <---- after
deleting, before closing
/dev/sda5            1179091124 726301116 392895584  65% /    <---- after
closing

So what is happening is that something, either in the doctesting system
itself, or in some part of sage that is tested, is creating and deleting
some files, but then the processes using those files are hanging, and the
files are never being closed, so the space is never being freed by the OS.
This would happen if, for example, the doctesting system used
tempfile.TemporaryFile() to create files which hold the output of child
processes, and then never closed those files, and then it hung at some
point. Or it could happen if a doctest did a similar thing, and then hung
and was never killed. (I'm not completely sure what will happen if a child
process creates a temporary file and then is killed, but I'm pretty sure
that the space will immediately be freed.)

I don't think this is from core dumps, as suggested on sage-devel, unless
they were specifically enabled, since they are disabled by default on
sage.math. Also, I don't think they would have this kind of behavior.

Anyway, I'm ccing sage-devel, since that is probably where any further
discussion of patchbot problems belongs.

On Tue, Jan 31, 2012 at 1:21 AM, Jeroen Demeyer <jdeme...@cage.ugent.be>wrote:

> On 2012-01-31 07:06, William Stein wrote:
> > then manually "kill -9"'d all of the robertwb jobs there, and
> > instantly got all of /tmp back.
> You literally mean "instantly" (as opposed to after some minutes/hours)?
>

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to