[Python-bugs-list] [ python-Bugs-449880 ] File size limit exceeded causes ABEND
noreply@sourceforge.net
noreply@sourceforge.net
Thu, 16 Aug 2001 08:12:56 -0700
Bugs item #449880, was opened at 2001-08-10 11:28
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=449880&group_id=5470
Category: Python Interpreter Core
Group: None
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
Assigned to: Guido van Rossum (gvanrossum)
Summary: File size limit exceeded causes ABEND
Initial Comment:
The following code will never run to completion on
systems with a 2GB file size limit. The interpreter
exits as soon as it exceeds the file size limit.
Create a file called "testfile" that is 2GB - 1 in
size. Run the following program to observe behaviour.
#!/usr/bin/env python2
#
# Create a file called "testfile" that is 2147483647
bytes in size. Then
# run this application. The python interpreter prints
the message "File
# size limit exceeded" and exits, rather than raising
an exception.
#
# Tested with Python-2.1.1 on Red Hat 7.2 beta (Roswell)
fp = open('testfile', 'a')
try:
fp.write('foo')
fp.flush()
fp.close()
except OSError, e:
print e
print "done"
----------------------------------------------------------------------
>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-16 08:12
Message:
Logged In: YES
user_id=6380
I've got no feedback. I'm just assuming it works.
Fixed in CVS: pythonrun.c:2.145.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-10 12:04
Message:
Logged In: YES
user_id=6380
Please try this patch.
----------------------------------------------------------------------
Comment By: Guido van Rossum (gvanrossum)
Date: 2001-08-10 12:01
Message:
Logged In: YES
user_id=6380
Yes, this is a bug.
It happens in the fp.flush() call. This does a write() that
would cause the file size to exceed the limit, and such a
write receives a SIGXFSZ signal - a signal similar to
SIGPIPE.
A workaround is to do this before writing such a large file:
import signal
signal.signal(signal.SIGXFSZ, signal.SIG_IGN)
Python should ignore the SIGXFSZ signal, if it exists, just
like it ignores SIGPIPE.
I wonder, are there any other signals that we would want to
ignore like this?
----------------------------------------------------------------------
You can respond by visiting:
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=449880&group_id=5470