I have a script that runs daily and while invoking processes, out of 100+ processes sometimes randomly 2 or 3 process do not get started and my target function is not called. This started occurring recently and before some days it was running fine. There is no pattern in its skipping processes also, it happens on random days and random no of process get failed. My implementation is as below:
class Worker:
def __init__(self, count, file):
self.file = file
self.count = count
def invoker(a):
print("Process [self.count] invoker called")
for i in range(5):
worker = Worker(i, file). # Different worker obj for every different process
process = multiprocessing.Process(target=worker.invoker, args=(a, ))
proc_list.append(process)
proc_list[-1].start()
[proc.join() for proc in proc_list]
On all successful days i am able to see below logs: Process 16 invoker called. Process 37 invoker called. Process 9 invoker called. ... Process 100 invoker called., HAVING all values from 1 to 100 in different order. BUT BUT on somedays, its like all values are there except "Process 9 invoker called." and my invoker does not do anything.
On code level it seems to me that everything is fine, but OS does not let the process spawn. Is there anything that I am missing or can check? Please help, thanks!
I tried to add logs in invoker function, and add process level details before & after start of process.