mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
test(operations): a worker a process test cannot stop shows where it is stuck
CI once found a test worker still running 15 s after SIGTERM, and the failure said nothing more. The worker children now dump their threads' stacks on SIGUSR1, and tearDown sends it to a child that is still alive before killing it, so the next such failure names the place. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
c4ab14db7f
commit
6ddde9376c
1 changed files with 4 additions and 0 deletions
|
|
@ -1,6 +1,7 @@
|
||||||
"""Real processes: a worker killed at each point is recovered by the next;
|
"""Real processes: a worker killed at each point is recovered by the next;
|
||||||
one worker per host; concurrent admissions and submissions never double up."""
|
one worker per host; concurrent admissions and submissions never double up."""
|
||||||
|
|
||||||
|
import faulthandler
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
import os
|
||||||
import shutil
|
import shutil
|
||||||
|
|
@ -19,6 +20,7 @@ from operations.tests import fakes, proc_kinds # noqa: F401
|
||||||
|
|
||||||
def _worker(data):
|
def _worker(data):
|
||||||
connections.close_all()
|
connections.close_all()
|
||||||
|
faulthandler.register(signal.SIGUSR1, all_threads=True) # tearDown asks a stuck worker where it is
|
||||||
from operations.worker import Worker
|
from operations.worker import Worker
|
||||||
os._exit(Worker(tick=0.05, heartbeat_every=0.2, grace=1, data=data).run())
|
os._exit(Worker(tick=0.05, heartbeat_every=0.2, grace=1, data=data).run())
|
||||||
|
|
||||||
|
|
@ -60,6 +62,8 @@ class ProcessTestCase(TransactionTestCase):
|
||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
for p in self.children:
|
for p in self.children:
|
||||||
if p.is_alive():
|
if p.is_alive():
|
||||||
|
os.kill(p.pid, signal.SIGUSR1) # its threads' stacks go to stderr
|
||||||
|
p.join(1)
|
||||||
p.kill()
|
p.kill()
|
||||||
p.join(10)
|
p.join(10)
|
||||||
shutil.rmtree(self.dir, ignore_errors=True)
|
shutil.rmtree(self.dir, ignore_errors=True)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue