mirror of https://github.com/BOINC/boinc.git
server: fix race condition when creating targeted jobs.
We were creating the workunit, then updating its transitioner_flags field. If the transitioner runs inbetween, it would (incorrectly) create results for the workunit. Solution: set transitioner_flags during insert.
This commit is contained in:
parent
76267cdc7a
commit
558d76212f
|
@ -346,7 +346,7 @@ int create_work2(
|
|||
fprintf(stderr, "target_nresults > max_success_results; can't create job\n");
|
||||
return ERR_INVALID_PARAM;
|
||||
}
|
||||
if (wu.transitioner_flags & TRANSITION_NONE) {
|
||||
if (wu.transitioner_flags) {
|
||||
wu.transition_time = INT_MAX;
|
||||
} else {
|
||||
wu.transition_time = time(0);
|
||||
|
|
|
@ -434,7 +434,9 @@ int main(int argc, char** argv) {
|
|||
}
|
||||
|
||||
void JOB_DESC::create() {
|
||||
char buf[256];
|
||||
if (assign_flag) {
|
||||
wu.transitioner_flags = assign_multi?TRANSITION_NONE:TRANSITION_NO_NEW_RESULTS;
|
||||
}
|
||||
int retval = create_work2(
|
||||
wu,
|
||||
wu_template,
|
||||
|
@ -464,14 +466,6 @@ void JOB_DESC::create() {
|
|||
);
|
||||
exit(1);
|
||||
}
|
||||
sprintf(buf, "transitioner_flags=%d",
|
||||
assign_multi?TRANSITION_NONE:TRANSITION_NO_NEW_RESULTS
|
||||
);
|
||||
retval = wu.update_field(buf);
|
||||
if (retval) {
|
||||
fprintf(stderr, "wu.update() failed: %s\n", boincerror(retval));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue