[New-bugs-announce] [issue37729] gc: stats from multi process are mixed up

Inada Naoki report at bugs.python.org
Wed Jul 31 05:35:28 EDT 2019


New submission from Inada Naoki <songofacandy at gmail.com>:

gc used several PySys_WriteStderr() calls to write stats.
This caused stats mixed up when stderr is shared by multiple
threads or processes.

Attached file (t.py) demonstrates it.
Sometimes stats from two processes are mixed up like this:

```
gc: collecting generation 0...
gc: objects in each generation: 782 0 7759
gc: objects in permanent generation: 0gc: collecting generation 0...

gc: objects in each generation: 782 0 7764
gc: objects in permanent generation: 0gc: done, 781 unreachable, 0 uncollectable, 0.0001s elapsed

gc: done, 781 unreachable, 0 uncollectable, 0.0000s elapsed
```

Writing one stat by one PySys_WriteStderr() reduces this.

----------
components: Interpreter Core
files: t.py
messages: 348795
nosy: inada.naoki
priority: normal
severity: normal
status: open
title: gc: stats from multi process are mixed up
versions: Python 3.7, Python 3.8, Python 3.9
Added file: https://bugs.python.org/file48523/t.py

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue37729>
_______________________________________


More information about the New-bugs-announce mailing list