问题
I have been uploaded my project in heroku, and my script create 4 threads, each thread perform specific task, but sometimes log file tells me that some threads stopped like this, (Thread 13)!
How can I solve it? this is the code!
segmentationProcess = SegmentationProcess()
dataList = request.body.decode("utf-8").split(',')
data = segmentationProcess.preProcess(dataList)
lock = multiprocessing.Lock()
thread1 = ThreadWithLogAndControls(target=segmentationProcess.searchWorkExperience, args=(data, "W", manager.result, lock))
thread2 = ThreadWithLogAndControls(target=segmentationProcess.searchEducation, args=(data, "E", manager.result, lock))
thread3 = ThreadWithLogAndControls(target=segmentationProcess.serchSkills, args=(data, "S", manager.result, lock))
thread4 = ThreadWithLogAndControls(target=segmentationProcess.searchOthers, args=(data, "O", manager.result, lock))
thread1.start()
thread2.start()
thread3.start()
thread4.start()
thread1.join()
thread2.join()
thread3.join()
thread4.join()
Am using nbmultitask library for creating threads, it's like multiprocessing. https://github.com/micahscopes/nbmultitask
来源:https://stackoverflow.com/questions/58941098/why-threads-stopped-in-heroku