Skip to content

Commit

Permalink
core-out-of-memory: start timeout from first waitpid exit
Browse files Browse the repository at this point in the history
Fix timeout, it should be from when the first waitpid fails.

Signed-off-by: Colin Ian King <[email protected]>
  • Loading branch information
ColinIanKing committed Feb 17, 2025
1 parent 922944c commit cd99527
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion core-out-of-memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -281,13 +281,15 @@ int stress_oomable_child(
} else if (pid > 0) {
/* Parent, wait for child */
int status, ret;
double t_end = stress_time_now() + WAIT_TIMEOUT;
double t_end = -1.0;

args->stats->s_pid.oomable_child = pid;
rewait:
stress_set_proc_state(args->name, STRESS_STATE_WAIT);
ret = waitpid(pid, &status, 0);
if (ret < 0) {
if (t_end < 0.0)
t_end = stress_time_now() + WAIT_TIMEOUT;
stress_set_proc_state(args->name, STRESS_STATE_RUN);
/* No longer alive? */
if (errno == ECHILD)
Expand Down

0 comments on commit cd99527

Please sign in to comment.