简体   繁体   中英

Python multiprocess does not work or throw exception

I have a class and in constructor i am creating objects of Process class as below

self.child = multiprocessing.Process(target = self.load_paths,args = (self.paths,self.queue,))
self.child.daemon = True

In a separate function i try to start the process like

def start_child(self):
    self.child.start()
    print 'child started'

now whenever i call the function start_child() 3rd time or n+2th time, the child is started but message is never printed and call is not returned.

Edit: The process which is starting the new children is also a child process started by some other process.

This does not return any exception and works exactly as expected in windows(python 2.7.8). The problem arises in Ubuntu with python 2.7.6

How can i mitigate it provided the task manager does not show any anomaly in windows for this code?

我通过从multiprocessing.Process继承目标类并覆盖run函数来解决此问题。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM