classification
Title: lib2to3 generation of pickle files is racy
Type: Stage:
Components: 2to3 (2.x to 3.x conversion tool) Versions: Python 3.9, Python 3.8, Python 3.7, Python 3.6
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: barisione
Priority: normal Keywords:

Created on 2020-07-01 16:05 by barisione, last changed 2020-07-01 16:05 by barisione.

Files
File name Uploaded Description Edit
pool.py barisione, 2020-07-01 16:05 Reproducer
Messages (1)
msg372760 - (view) Author: Marco Barisione (barisione) Date: 2020-07-01 16:05
The generation of pickle files in load_grammar in lib2to3/pgen2/driver.py is racy as other processes may end up reading a half-written pickle file.

This is reproducible with the command line tool, but it's easier to reproduce by importing lib2to3. You just need different processes importing lib2to3 at the same time to make this happen, see the attached reproducer.

I tried with Python 3.9 for completeness and, while it happens there as well, it seems to be less frequent ony my computer than when using Python 3.6 (2% failure rate instead of 50% failure rate).
History
Date User Action Args
2020-07-01 16:05:44barisionecreate