Skip to content

Commit ba1b894

Browse files
committed
BF: CS-1225: Client requests are rejected by qmaster because listener accept them before secodnary DS are initialized
1 parent 10339e8 commit ba1b894

File tree

1 file changed

+14
-16
lines changed

1 file changed

+14
-16
lines changed

source/libs/mir/ocs_MirrorDataStore.cc

Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -133,21 +133,21 @@ ocs::MirrorDataStore::event_mirror_update_func([[maybe_unused]] u_long32 ec_id,
133133
}
134134

135135
/** @brief Block executing thread till initial events are handled.
136-
* Recheck every 100ms.
137136
*/
138137
void
139138
ocs::MirrorDataStore::block_till_initial_events_handled() {
140139
DENTER(TOP_LAYER);
141140
volatile bool wait = true;
142141

143142
do {
144-
if (wait) {
145-
sge_usleep(25000);
146-
}
147-
DPRINTF("still waiting for initial events to be handled\n");
148143
sge_mutex_lock(mutex_name.c_str(), __func__, __LINE__, &mutex);
149144
wait = !did_handle_initial_events;
150145
sge_mutex_unlock(mutex_name.c_str(), __func__, __LINE__, &mutex);
146+
147+
if (wait) {
148+
DPRINTF("still waiting for initial events to be handled\n");
149+
sge_usleep(25000);
150+
}
151151
} while (wait);
152152
DRETURN_VOID;
153153
}
@@ -332,8 +332,7 @@ ocs::MirrorDataStore::main([[maybe_unused]] void *arg) {
332332
lList *event_list = nullptr;
333333

334334
// wait for new events
335-
MONITOR_IDLE_TIME(wait_for_event(&event_list), (&monitor),
336-
mconf_get_monitoring_options());
335+
MONITOR_IDLE_TIME(wait_for_event(&event_list), (&monitor), mconf_get_monitoring_options());
337336

338337
// if we lost connection we have to register again
339338
if (evc->ec_need_new_registration(evc)) {
@@ -388,24 +387,23 @@ ocs::MirrorDataStore::main([[maybe_unused]] void *arg) {
388387

389388
// process the events
390389
sge_mirror_error mirror_ret = sge_mirror_process_event_list(evc, event_list);
391-
#if 0
392-
DPRINTF("processed events\n");
393-
#endif
394-
lFreeList(&event_list);
395390
if (mirror_ret == SGE_EM_OK) {
396-
did_handle_initial_events = true;
391+
// the first handling of non-empty event_list (== the initial list events)
392+
// will cause the data store to be ready for other threads (listener, reader, scheduler, ...)
393+
if (event_list != nullptr) {
394+
did_handle_initial_events = true;
395+
}
396+
397397
did_handle_events = true;
398398

399399
// update the sessions about the last event that we processed so that waiting requests can continue
400400
if (found_last_event) {
401401
update_sessions_and_move_requests(last_unique_id);
402-
#if 0
403-
DPRINTF("updates sessions and moved requests\n");
404-
#endif
405402
}
406403
} else {
407404
DPRINTF("error during event processing\n");
408405
}
406+
lFreeList(&event_list);
409407

410408
// Unlock the data store
411409
unlock();
@@ -423,7 +421,7 @@ ocs::MirrorDataStore::main([[maybe_unused]] void *arg) {
423421

424422
// actions if events where processed
425423
if (did_handle_events) {
426-
thread_output_profiling("scheduler thread profiling summary:\n", &next_prof_output);
424+
thread_output_profiling("thread profiling summary:\n", &next_prof_output);
427425
sge_monitor_output(&monitor);
428426
}
429427
}

0 commit comments

Comments
 (0)