Skip to content

Commit 03e09d6

Browse files
xinhaoyuancopybara-github
authored andcommitted
Enforce batch timeout even when not running inputs.
This is to deal with slow per-iteration fixture. Note that this does not handle per-test fixture as it is conceptually not part of the batch execution. PiperOrigin-RevId: 774879276
1 parent 45a1c3a commit 03e09d6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

centipede/runner.cc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,13 +196,15 @@ static void CheckWatchdogLimits() {
196196
};
197197
const uint64_t input_start_time = state.input_start_time;
198198
const uint64_t batch_start_time = state.batch_start_time;
199-
if (input_start_time == 0 || batch_start_time == 0) return;
199+
if (batch_start_time == 0) return;
200200
const Resource resources[] = {
201201
{Resource{
202202
/*what=*/"Per-input timeout",
203203
/*units=*/"sec",
204204
/*value=*/curr_time - input_start_time,
205-
/*limit=*/state.run_time_flags.timeout_per_input,
205+
/*limit=*/input_start_time == 0
206+
? 0
207+
: state.run_time_flags.timeout_per_input,
206208
/*ignore_report=*/state.run_time_flags.ignore_timeout_reports != 0,
207209
/*failure=*/kExecutionFailurePerInputTimeout.data(),
208210
}},
@@ -218,7 +220,8 @@ static void CheckWatchdogLimits() {
218220
/*what=*/"RSS limit",
219221
/*units=*/"MB",
220222
/*value=*/GetPeakRSSMb(),
221-
/*limit=*/state.run_time_flags.rss_limit_mb,
223+
/*limit=*/input_start_time == 0 ? 0
224+
: state.run_time_flags.rss_limit_mb,
222225
/*ignore_report=*/false,
223226
/*failure=*/kExecutionFailureRssLimitExceeded.data(),
224227
}},
@@ -269,8 +272,8 @@ static void CheckWatchdogLimits() {
269272
while (true) {
270273
sleep(1);
271274

272-
// No calls to ResetInputTimer() yet: input execution hasn't started.
273-
if (state.input_start_time == 0) continue;
275+
// No calls to ResetInputTimer() yet: batch execution hasn't started.
276+
if (state.batch_start_time == 0) continue;
274277

275278
CheckWatchdogLimits();
276279
}

0 commit comments

Comments
 (0)