diff options
author | Valentin Bartenev <vbart@nginx.com> | 2019-11-14 17:48:48 +0300 |
---|---|---|
committer | Valentin Bartenev <vbart@nginx.com> | 2019-11-14 17:48:48 +0300 |
commit | c2976fb3378b015b7c70247e0d462c1b52214458 (patch) | |
tree | 810fc138eabf4f63d1ca0d8f5f9cd08ada544b1f /CHANGES | |
parent | 4e41d900064bcccc02ec7efd0109c190d6637028 (diff) | |
download | unit-c2976fb3378b015b7c70247e0d462c1b52214458.tar.gz unit-c2976fb3378b015b7c70247e0d462c1b52214458.tar.bz2 |
Python: avoiding buffering of exception backtraces.
A quote from the Python 3 documentation:
| When interactive, stdout and stderr streams are line-buffered.
| Otherwise, they are block-buffered like regular text files.
As a result, if an exception occurred and PyErr_Print() was called, its output
could be buffered but not printed to the log for a while (ultimately, until
the interpreter finalization). If the application process crashed shortly,
the backtrace was completely lost.
Buffering can be disabled by redefining the sys.stderr stream object.
However, interference with standard environment objects was deemed undesirable.
Instead, sys.stderr.flush() is called every time after printing exceptions.
A potential advantage here is that lines from backtraces won't be mixed
with other lines in the log.
Diffstat (limited to '')
0 files changed, 0 insertions, 0 deletions