Skip to content

Lingering processes after task timeout #6228

@OneMoreByte

Description

@OneMoreByte

Describe the bug

I have some "Executable tests" that run for a while if something is super unhealthy. To keep them from running too long, I've set task.timeout.running in the config I pass to move on to the next test if they hang.

I've noticed in my test logs that the tests continue running after avocado exits, and I was able to replicate the error with the steps below.

I'd believe I'm doing something wrong, let me know if there's a setting I should be using or if this is intended behaviour.

Steps to reproduce
Using a dumb script that sleeps several times while echoing something to show progress

#!/bin/bash

echo "starting test!"

for i in {1..15}; do
  echo "on ${i} of 15"
  sleep 15
done

echo "stopping test!"
exit 0

and task.timeout.running set to something lower than the maximum time that the script will sleep for

[task.timeout]
running = 30

My "test" is interrupted like I'd expect

$ avocado --config avocado.conf run ./test
JOB ID     : c126f4781381074db834720e7afbbdb6b79ffe0c
JOB LOG    : /home/user/avocado/job-results/job-2025-10-29T16.54-c126f47/job.log
 (1/1) ./tests/test.sh: STARTED
 (1/1) ./tests/test.sh:  INTERRUPTED: Test interrupted: Timeout reached (29.93 s)
RESULTS    : PASS 0 | ERROR 0 | FAIL 0 | SKIP 0 | WARN 0 | INTERRUPT 1 | CANCEL 0
JOB TIME   : 30.87 s

But the script is still running after avocado exits

  97259 pts/2    00:00:00 zsh
  98371 pts/2    00:00:00 test.sh
  98433 pts/2    00:00:00 sleep
  98478 pts/2    00:00:00 ps

And in the stdout file it continues executing until it finishes

$ cat ~/avocado/job-results/job-2025-10-29T16.54-c126f47/test-results/1-._tests_test.sh/stdout
starting test!
on 1 of 15
on 2 of 15
on 3 of 15
on 4 of 15
on 5 of 15
on 6 of 15
on 7 of 15
on 8 of 15
on 9 of 15
on 10 of 15
on 11 of 15
on 12 of 15
on 13 of 15
on 14 of 15
on 15 of 15
stopping test!

Expected behavior

I expect the test process to be killed.

Current behavior

The process gets abandoned and continues running after avocado exits.

System information (please complete the following information):

  • OS: lsb_release -a
    LSB Version: n/a
    Distributor ID: Arch
    Description: Arch Linux
    Release: rolling
    Codename: n/a

I've seen this on SLES 15 and MacOS as well.

  • Avocado version: avocado -v
    Avocado 112.0

  • Avocado installation method: pip, rpm, github ?
    pip

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Status

In progress

Relationships

None yet

Development

No branches or pull requests

Issue actions