Changeset: 4329f0fd3d32 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB/rev/4329f0fd3d32
Modified Files:
monetdb5/mal/mal_dataflow.c
Branch: Dec2025
Log Message:
Fix a race condition.
If a dataflow worker is waiting for new work (flag==WAITING, waiting on
sema down), and then the system is stopped (stopMALdataflow()), the flag
is set to FINISHING and the semaphore is "upped". The worker then first
set the flag to RUNNING and then checked whether it was time to exit,
making the cleanup code do the wrong thing (based on the flag).
Instead, the worker needs to first check whether it needs to exit
(leaving the flag unchanged) and if not, set the flag to RUNNING. Then
the cleanup code should do the right thing.
diffs (15 lines):
diff --git a/monetdb5/mal/mal_dataflow.c b/monetdb5/mal/mal_dataflow.c
--- a/monetdb5/mal/mal_dataflow.c
+++ b/monetdb5/mal/mal_dataflow.c
@@ -265,10 +265,10 @@ DFLOWworker(void *T)
if (t->flag == WAITING) {
/* wait until we are allowed to start working */
MT_sema_down(&t->s);
- t->flag = RUNNING;
if (ATOMIC_GET(&exiting)) {
break;
}
+ t->flag = RUNNING;
}
assert(t->flag == RUNNING);
cntxt = ATOMIC_PTR_GET(&t->cntxt);
_______________________________________________
checkin-list mailing list -- [email protected]
To unsubscribe send an email to [email protected]