[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread Tim Peters

Tim Peters added the comment:

Ah - good catch!  I'm closing this as a duplicate of bug18966.  The real 
mystery now is why the threads _don't_ terminate early under Windows 3.5.2 - 
heh.

--
resolution:  -> duplicate
status: open -> closed
superseder:  -> Threads within multiprocessing Process terminate early

___
Python tracker 

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



[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread R. David Murray

R. David Murray added the comment:

On my gentoo system it prints hi four times in 2.7, and 3.2 through 3.6.  I 
suspect multiprocessing is killing threads, daemon or not, when the main 
process thread ends.  I expect that's a feature, although I didn't find it 
documented.

Ah, found the explanation: issue 18966.  Antoine indicates this could indeed be 
considered a bug but is part of a larger issue.  If we aren't going to fix it, 
we should probably document it.

--
assignee:  -> docs@python
components: +Documentation -Library (Lib)
nosy: +docs@python, r.david.murray
versions: +Python 2.7, Python 3.6

___
Python tracker 

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



[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread Tim Peters

Tim Peters added the comment:

Curious:  under Python 2.7.11 on Windows, the threads also terminate early 
(they run "forever" - as intended - under 3.5.2).

--

___
Python tracker 

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



[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread Tim Peters

Changes by Tim Peters :


--
components: +Library (Lib)
type:  -> behavior

___
Python tracker 

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



[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread Tim Peters

Tim Peters added the comment:

Note:  this started on stackoverflow:

https://stackoverflow.com/questions/38356584/python-multiprocessing-threading-code-exits-early

I may be missing something obvious, but the only explanation I could think of 
for the behavior seen on Ubuntu is that the threads in the worker processes are 
being treated as daemon threads.  The program works as intended for me on 
Windows - but, of course, there's a universe of differences between spawning 
(Windows) and forking (Ubuntu) processes too.

--
nosy: +tim.peters

___
Python tracker 

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



[issue27508] process thread with implicit join is killed unexpectedly

2016-07-13 Thread JA

New submission from JA:

On Ubuntu 16.04 
python '3.5.1+ (default, Mar 30 2016, 22:46:26) \n[GCC 5.3.1 20160330]'

The following code prints "hi" 4 times: 
import multiprocessing
import time
import threading

class dumb(threading.Thread):
def __init__(self):
super(dumb, self).__init__()
def run(self):
while True:
print("hi")
time.sleep(1)

def test():
for i in range(2):
bar = dumb()
bar.start()
def main():
p = []
for i in range(2):
p.append(multiprocessing.Process(target=test))
for i in p:
i.start()
for i in p:
i.join()
if __name__ == '__main__':
main()

Note: The above code runs fine on Python 3.5.2 (64-bit) on Windows 10

Joining the threads in test fixes the problem: 
def test():
p = []
for i in range(2):
bar = dumb()
bar.start()
p.append(bar)
for i in p:
i.join()

--
messages: 270329
nosy: JA
priority: normal
severity: normal
status: open
title: process thread with implicit join is killed unexpectedly
versions: Python 3.5

___
Python tracker 

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