Skip to content

Instantly share code, notes, and snippets.

@w0rm
Last active December 10, 2015 06:48
Show Gist options
  • Save w0rm/4396367 to your computer and use it in GitHub Desktop.
Save w0rm/4396367 to your computer and use it in GitHub Desktop.
Sometimes stack trace generated by web.emailerrors is so huge that it breaks server memory limits. This happens for example when files are opened. In my case I didn't even do anything myself, but the server's filesystem went read-only, so this error caused very large email message that was turned down by gmail:
d = web.input(page_id=None, sizes=[])
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 637, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmpO9xmUd'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 608, in processor
return handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 295, in djangoerror
return t(exception_type, exception_value, frames)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 808, in __call__
return self.t(*a, **kw)
File "/home/edzohogusava/lib/python2.7/web/debugerror.pyo", line 193, in __template__
<h3 id="meta-info">META</h3>
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 632, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmpDUaNFR'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 608, in processor
return handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 295, in djangoerror
return t(exception_type, exception_value, frames)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 808, in __call__
return self.t(*a, **kw)
File "/home/edzohogusava/lib/python2.7/web/debugerror.pyo", line 193, in __template__
<h3 id="meta-info">META</h3>
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 632, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmp6hMai3'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 608, in processor
return handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 295, in djangoerror
return t(exception_type, exception_value, frames)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 808, in __call__
return self.t(*a, **kw)
File "/home/edzohogusava/lib/python2.7/web/debugerror.pyo", line 193, in __template__
<h3 id="meta-info">META</h3>
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 632, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmpf0MQqI'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/session.py", line 88, in _processor
return handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 295, in djangoerror
return t(exception_type, exception_value, frames)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 808, in __call__
return self.t(*a, **kw)
File "/home/edzohogusava/lib/python2.7/web/debugerror.pyo", line 193, in __template__
<h3 id="meta-info">META</h3>
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 632, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmp20AZP2'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 623, in processor
result = handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 295, in djangoerror
return t(exception_type, exception_value, frames)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 881, in __call__
return BaseTemplate.__call__(self, *a, **kw)
File "/home/edzohogusava/lib/python2.7/web/template.py", line 808, in __call__
return self.t(*a, **kw)
File "/home/edzohogusava/lib/python2.7/web/debugerror.pyo", line 193, in __template__
<h3 id="meta-info">META</h3>
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 330, in input
out = rawinput(_method)
File "/home/edzohogusava/lib/python2.7/web/webapi.py", line 303, in rawinput
a = cgi.FieldStorage(fp=fp, environ=e, keep_blank_values=1)
File "/usr/local/lib/python2.7/cgi.py", line 508, in __init__
self.read_multi(environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 632, in read_multi
environ, keep_blank_values, strict_parsing)
File "/usr/local/lib/python2.7/cgi.py", line 510, in __init__
self.read_single()
File "/usr/local/lib/python2.7/cgi.py", line 647, in read_single
self.read_lines()
File "/usr/local/lib/python2.7/cgi.py", line 669, in read_lines
self.read_lines_to_outerboundary()
File "/usr/local/lib/python2.7/cgi.py", line 720, in read_lines_to_outerboundary
self.__write(odelim + line)
File "/usr/local/lib/python2.7/cgi.py", line 676, in __write
self.file = self.make_file('')
File "/usr/local/lib/python2.7/cgi.py", line 768, in make_file
return tempfile.TemporaryFile("w+b")
File "/usr/local/lib/python2.7/tempfile.py", line 485, in TemporaryFile
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
File "/usr/local/lib/python2.7/tempfile.py", line 235, in _mkstemp_inner
fd = _os.open(file, flags, 0600)
OSError: [Errno 30] Read-only file system: '/tmp/tmpzUFf8K'
Traceback (most recent call last):
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in process
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 608, in processor
return handler()
File "/home/edzohogusava/lib/python2.7/web/application.py", line 237, in <lambda>
return p(lambda: process(processors))
File "/home/edzohogusava/lib/python2.7/web/application.py", line 246, in process
raise self.internalerror()
File "/home/edzohogusava/lib/python2.7/web/debugerror.py", line 335, in emailerrors_internal
dict(filename="bug.html", content=safestr(djangoerror()))
File "/home/edzohogusava/lib/python2.7/web/utils.py", line 1380, in sendmail
mail.send()
File "/home/edzohogusava/lib/python2.7/web/utils.py", line 1489, in send
smtpserver.sendmail(self.from_address, self.recipients, message_text)
File "/usr/local/lib/python2.7/smtplib.py", line 722, in sendmail
raise SMTPSenderRefused(code, resp, from_addr)
SMTPSenderRefused: (552, "5.2.3 Your message exceeded Google's message size limits. Please visit\\n5.2.3 http://support.google.com/mail/bin/answer.py?answer=8770 to review\\n5.2.3 our size guidelines. s16sm54583247wii.0"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment