Message254897
Looking at the code, this issue makes sense
in logging/__init__.py (+738):
def handle(self, record):
"""
Conditionally emit the specified logging record.
Emission depends on filters which may have been added to the handler.
Wrap the actual emission of the record with acquisition/release of
the I/O thread lock. Returns whether the filter passed the record for
emission.
"""
rv = self.filter(record)
if rv:
self.acquire()
try:
self.emit(record)
finally:
self.release()
return rv
Than, in the "emit()" of whatever handler used, there is first:
msg = self.format(record)
In my opinion, a possible fix would be to change this code to something like:
rv = self.filter(record)
if rv:
record.formatted_msg = self.format(record)
self.acquire()
try:
self.emit(record)
finally:
self.release()
return rv
And then, change all the "emit()" of log handlers from:
msg = self.format(record)
to
msg = record.processed_msg
By not modifying the "msg" and "args" parameters of the record, all the code that would have reimplemented the standard log handler will still be working fine (even if they will still be at risk of encountering the deadlock) |
|
Date |
User |
Action |
Args |
2015-11-19 14:29:12 | fviard | set | recipients:
+ fviard |
2015-11-19 14:29:12 | fviard | set | messageid: <1447943352.93.0.00473626885752.issue25668@psf.upfronthosting.co.za> |
2015-11-19 14:29:12 | fviard | link | issue25668 messages |
2015-11-19 14:29:12 | fviard | create | |
|