New submission from Stan <hexorgs...@gmail.com>:

Checking if thread.is_alive() while thread is checking on Process.is_alive() 
seemingly causes undefined behavior. 

The attached POC is expected to print "ThreadN.data == 1999" for N in range(0, 
20) with some repeats. However the integers are spread all over the place. 
Moreover sometimes one or more of the threads never terminate resulting in 
technically infinite amount of "ThreadN.data == ###" prints. 

In python2.7.15 I never observed a thread lock (only early terminations), but 
in python3.4.8 I did.

You may have to adjust max_count variable to have higher success rate of thread 
locking. I got about 40% chance of `python3 bug_test.py` never finishing on an 
Intel(R) Core(TM) i7-4610M CPU @ 3.00GHz

----------
files: bug_test.py
messages: 331106
nosy: Hexorg
priority: normal
severity: normal
status: open
title: Thread.is_alive while running Process.is_alive causes either premature 
termination or never-terminating.
type: behavior
versions: Python 2.7, Python 3.4
Added file: https://bugs.python.org/file47975/bug_test.py

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue35419>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to