[issue44399] log rotator cookbook example might waste disk space

2021-06-13 Thread mori-b


mori-b  added the comment:

Indeed this situation would rise only under misusage of the log, where multiple 
processes inherit by  mistake or by wrong design a file descriptor of a same 
log file (Regarding the threads case I unfortunately cannot reproduce).
While this kind of misusage doesn't have terrible consequences when not using 
the rotator, the growing used disk space which occurs when using the rotator is 
more serious, that's why I found appropriate to try and protect the programmer 
from his own mistake. But I understand if this is out of scope.

--

___
Python tracker 
<https://bugs.python.org/issue44399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44399] log rotator cookbook example might waste disk space

2021-06-11 Thread mori-b


mori-b  added the comment:

Additional precision : this issue can happen when the log file is shared 
between multiple threads. And naturally also between different processes, which 
is not recommended but can happen by mistake.

--

___
Python tracker 
<https://bugs.python.org/issue44399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44399] log rotator cookbook example might waste disk space

2021-06-11 Thread mori-b


mori-b  added the comment:

In 
https://docs.python.org/3/howto/logging-cookbook.html#using-a-rotator-and-namer-to-customize-log-rotation-processing,
 the log rotator example deletes the original log file after compressing it. 
However, running on Linux the command "lsof +L1" shows that the deleted 
original log file might still hold the same disk space, and keep growing.
Replacing the command "os.remove(source)" with "os.truncate(source,0)" seems to 
solve the issue by freeing the original log file disk space at each rotation.

--

___
Python tracker 
<https://bugs.python.org/issue44399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue44399] log rotator cookbook example might waste disk space

2021-06-11 Thread mori-b


New submission from mori-b :

In 
https://docs.python.org/3/howto/logging-cookbook.html#using-a-rotator-and-namer-to-customize-log-rotation-processing,
 the log rotator example deletes the original log file after compressing it. 
However, running on Linux the command "lsof +S1" shows that the deleted 
original log file might still hold the same disk space, and keep growing.
Replacing the command "os.remove(source)" with "os.truncate(source,0)" seems to 
solve the issue by freeing the original log file disk space at each rotation.

--
assignee: docs@python
components: Documentation
messages: 395658
nosy: docs@python, mori-b
priority: normal
severity: normal
status: open
title: log rotator cookbook example might waste disk space
type: resource usage

___
Python tracker 
<https://bugs.python.org/issue44399>
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com