Closed GoogleCodeExporter closed 9 years ago
There is various bits of code to prevent crashes if save_response is cached
beyond
life of request, but seems I missed this one spot. :-(
In Log_dealloc(), should be checking self->expired as well as self->r before
logging.
if (self->s) {
if (self->r && !self->expired) {
Py_BEGIN_ALLOW_THREADS
ap_log_rerror(APLOG_MARK, WSGI_LOG_LEVEL(self->level),
self->r, "%s", self->s);
Py_END_ALLOW_THREADS
}
else {
...
}
...
}
Only question now is whether I log the remainder in the main server log rather
than
against the request, which may cause confusion, or simply discard the
remainder. Per
WSGI specification doing the latter is fine, as flush() has to be called to
ensure
that log messages are actually logged.
In other words, probably better to do:
if (self->s && !self->expired) {
...
}
Thanks for picking up on this one.
Original comment by Graham.Dumpleton@gmail.com
on 10 Aug 2007 at 10:30
Whoops, that latter change doesn't take into consideration freeing the
remainder and
would leak memory. Change needs to ensure that free(self->s) is performed if s
is non
null even if expired.
Original comment by Graham.Dumpleton@gmail.com
on 10 Aug 2007 at 10:44
This is has been fixed in revision 413 of subversion repository.
Took path of actually flushing log explicitly at end of the request. Any
residual
data still in log object related to a request when log object is deleted is
simply
discarded. By rights there shouldn't be any data, as application should not be
using
wsgi.errors after request has executed, response returned and any generator had
close() called on it.
Original comment by Graham.Dumpleton@gmail.com
on 12 Aug 2007 at 4:56
Original issue reported on code.google.com by
shane.ha...@gmail.com
on 10 Aug 2007 at 10:18