If our sched_priv/holidays file is incorrect, the scheduler may behave abnormally (infinite loop).
== Example of wrong settings ==
(snip)
*
YEAR 2018
*
* Prime/Nonprime Table
*
* Prime Non-Prime
* Day Start Start
*
weekday all all
saturday all all
sunday all all
*
* Day of Calendar Company
(snip)
== End of example settings. ==
Then, we find the following scheduler logs:
01/10/2019 14:41:52;0400;pbs_sched;Job;non-prime time;Simulation: Policy change [Thu Jan 10 14:41:20 2019]
01/10/2019 14:41:52;0400;pbs_sched;Job;prime time;Simulation: Policy change [Thu Jan 10 14:41:20 2019]
01/10/2019 14:41:52;0400;pbs_sched;Job;non-prime time;Simulation: Policy change [Thu Jan 10 14:41:20 2019]
01/10/2019 14:41:52;0400;pbs_sched;Job;prime time;Simulation: Policy change [Thu Jan 10 14:41:20 2019]
01/10/2019 14:41:52;0400;pbs_sched;Job;non-prime time;Simulation: Policy change [Thu Jan 10 14:41:20 2019]
It may be infinite loop!
Could you fix this ?
We use version 18 (revision 9ad06407424b16c0f097f56df11fd309f39d52d50).
but, suppose that the file/line in bellow is based on
revision 2950f3399aa36c35b975d5ba9eb93722f1bee1df.
We think the infinite loop is
src/scheduler/siumulate.c: 196-208, in simulate_events.
This infinite loop is caused by end_prime_status returns same value with its argument.
We propose that
- reject an invalid setings of holidays file.
or - fix end_prime_status.
or, I think you have better ideas than mine.
(Sample patch for 1)
diff --git a/src/scheduler/prime.c b/src/scheduler/prime.c
--- a/src/scheduler/prime.c
+++ b/src/scheduler/prime.c
@@ -438,6 +438,51 @@ parse_holidays(char *fname)
}
error = 0;
}
+
+ // Invalidate wrong settings.
+ if ( (conf.prime[WEEKDAY][PRIME].all == TRUE)
+ && (conf.prime[WEEKDAY][NON_PRIME].all == TRUE) )
+ {
+ conf.prime[WEEKDAY][NON_PRIME].all = FALSE;
+ conf.prime[WEEKDAY][NON_PRIME].none = FALSE;
+ }
+ if ( (conf.prime[SATURDAY][PRIME].all == TRUE)
+ && (conf.prime[SATURDAY][NON_PRIME].all == TRUE) )
+ {
+ conf.prime[SATURDAY][NON_PRIME].all = FALSE;
+ conf.prime[SATURDAY][NON_PRIME].none = FALSE;
+ }
+ if ( (conf.prime[SUNDAY][PRIME].all == TRUE)
+ && (conf.prime[SUNDAY][NON_PRIME].all == TRUE) )
+ {
+ conf.prime[SUNDAY][NON_PRIME].all = FALSE;
+ conf.prime[SUNDAY][NON_PRIME].none = FALSE;
+ }
(...snip...)
+ if ( (conf.prime[FRIDAY][PRIME].all == TRUE)
+ && (conf.prime[FRIDAY][NON_PRIME].all == TRUE) )
+ {
+ conf.prime[FRIDAY][NON_PRIME].all = FALSE;
+ conf.prime[FRIDAY][NON_PRIME].none = FALSE;
+ }
+
conf.num_holidays = hol_index + 1;
(Sample patch for 2)
diff --git a/src/scheduler/prime.c b/src/scheduler/prime.c
--- a/src/scheduler/prime.c
+++ b/src/scheduler/prime.c
@@ -620,7 +620,10 @@ end_prime_status(time_t date)
if (p == PRIME && conf.holiday_year == 0)
return SCHD_INFINITY;
- return end_prime_status_rec(date, date, p);
+ // Fix infinite loop. Oops, Very very slow....
+ time_t ret = end_prime_status_rec(date, date, p);
+ if ( ret == date ) { ret = date + 60; }
+ return ret;
}
/**
Thank you.