[issue29658] Process hangs (sometimes)

2017-02-26 Thread djstrong

New submission from djstrong:

I have this code, which sometimes hangs (1 of 5 runs):

# -*- coding: utf-8 -*-

import sys
import threading
import multiprocessing

mpl = multiprocessing.log_to_stderr()
mpl.setLevel(1)


class A(threading.Thread):
def __init__(self):
super(A, self).__init__()

def run(self):
print(self.name, 'RUN')

for line in sys.stdin: #increases probability of hanging
pass

print(self.name, 'STOP')


class B(multiprocessing.Process):
def __init__(self):
super(B, self).__init__()

def run(self):
print(self.name, 'RUN')


a = A()
a.start()

b = B()
b.start()
print('B started', b, b.is_alive(), b.pid)
print('A', a)

a.join()
b.join()

print('FINISHED')

I am running it on Ubuntu with command: echo "" | python3 time_test4.py

Output is:
Thread-1 RUN
B started  True 31439
A 
Thread-1 STOP

--
messages: 288594
nosy: djstrong
priority: normal
severity: normal
status: open
title: Process hangs (sometimes)
type: behavior
versions: Python 3.4

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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-26 Thread djstrong

Changes by djstrong :


--
title: Process hangs (sometimes) -> Combining thread and process, process hangs 
(sometimes)

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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-26 Thread djstrong

djstrong added the comment:

Sometimes the output is:
Thread-1 RUN
Thread-1 STOP
B started  True 20187
A 
[INFO/B-1] child process calling self.run()


but "print" in "run" method of process is not executed.

--

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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-26 Thread djstrong

djstrong added the comment:

It is confirmed with other hardware with Python 3.5.2. Process is forked, but 
method "run" is not executing.

--
versions: +Python 3.5 -Python 3.4

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



[issue29658] Combining thread and process, process hangs (sometimes)

2017-02-27 Thread djstrong

djstrong added the comment:

Thank you! I couldn't find information about first forking then launching 
threads.

--
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

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