diff --git a/client/app_start.C b/client/app_start.C index ef87e382f8..9878c12261 100644 --- a/client/app_start.C +++ b/client/app_start.C @@ -580,9 +580,6 @@ int ACTIVE_TASK::start(bool first_time) { ); if (retval) { needs_shmem = true; - // Assume no additional shared memory is available for next 10 seconds - // (run only tasks which are already attached to shared memory). - gstate.retry_shmem_time = gstate.now + 10.0; destroy_shmem(shmem_seg_name); // Don't leave an orphan shmem segment return retval; } diff --git a/client/cpu_sched.C b/client/cpu_sched.C index e1ec09914e..4fd72bcff7 100644 --- a/client/cpu_sched.C +++ b/client/cpu_sched.C @@ -909,13 +909,20 @@ bool CLIENT_STATE::enforce_schedule() { retval = atp->resume_or_start( atp->scheduler_state == CPU_SCHED_UNINITIALIZED ); - if (retval) { - if ((retval != ERR_SHMGET) && (retval != ERR_SHMAT)) { - report_result_error( - *(atp->result), "Couldn't start or resume: %d", retval - ); - request_schedule_cpus("start failed"); + if ((retval == ERR_SHMGET) || (retval == ERR_SHMAT)) { + // Assume no additional shared memory is available for next 10 seconds + // (run only tasks which are already attached to shared memory). + if (gstate.retry_shmem_time < gstate.now) { // Do this only once + request_schedule_cpus("no more shared memory"); } + gstate.retry_shmem_time = gstate.now + 10.0; + continue; + } + if (retval) { + report_result_error( + *(atp->result), "Couldn't start or resume: %d", retval + ); + request_schedule_cpus("start failed"); continue; } atp->run_interval_start_wall_time = now;