vollt
vollt copied to clipboard
Too fast auto-running jobs avoid synchronized joblist.addNewJob(UWSJob)
Context
I have a overridden JobList addNewJob definition with observer to log add event into a mongo DB.
I've observed when submitted jobs are too fast, add event is not recorded. I think there's a race competition because of synchronized nature JobList.addNewJob(UWSJob)
Explanation of hypothesis
I deduce this from overridden adNewJob
KO: synchronized
This misses the ADD event
new JobList(jobListName, executionManager, destructionManager) {
@Override
public synchronized String addNewJob(UWSJob j) throws UWSException {
super.addNewJob(j);
observer.addJob(j);
return j.getJobId();
}
...
}
KO: not synchronized
This misses the ADD event
new JobList(jobListName, executionManager, destructionManager) {
@Override
public String addNewJob(UWSJob j) throws UWSException {
super.addNewJob(j);
observer.addJob(j);
return j.getJobId();
}
...
}
OK : not synchronized but reversed call sequence
This catches the ADD event
new JobList(jobListName, executionManager, destructionManager) {
@Override
public String addNewJob(UWSJob j) throws UWSException {
observer.addJob(j);
super.addNewJob(j);
return j.getJobId();
}
...
}
Suggestions
I think there's somewhere in the call stack a condition that is not successful when the job is COMPLETED to add the job to JobList.