This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author djstrong
Recipients djstrong
Date 2017-02-26.13:48:29
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1488116910.28.0.662838065018.issue29658@psf.upfronthosting.co.za>
In-reply-to
Content
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 <B(B-1, started)> True 31439
A <A(Thread-1, started 139779252864768)>
Thread-1 STOP
History
Date User Action Args
2017-02-26 13:48:30djstrongsetrecipients: + djstrong
2017-02-26 13:48:30djstrongsetmessageid: <1488116910.28.0.662838065018.issue29658@psf.upfronthosting.co.za>
2017-02-26 13:48:30djstronglinkissue29658 messages
2017-02-26 13:48:29djstrongcreate