Skip to content

Commit

Permalink
move stack dump handler
Browse files Browse the repository at this point in the history
We set this up in main, but our test suite never calls qtile's main method,
so my attempts at logging why tests were hanging would never succeed.

Instead, let's set this up in async_loop() where we set up the other signal
handling, which is called by the test suite and hopefully as a result will
yield stack traces when our test suite hangs.

Fixes #4778

Signed-off-by: Tycho Andersen <tycho@tycho.pizza>
  • Loading branch information
tych0 authored and elParaguayo committed Apr 28, 2024
1 parent ddb5dcb commit e6c8d6d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
7 changes: 7 additions & 0 deletions libqtile/core/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
from __future__ import annotations

import asyncio
import faulthandler
import io
import logging
import os
Expand Down Expand Up @@ -213,6 +214,12 @@ async def async_loop(self) -> None:
self.core.qtile = self
self.load_config(initial=True)
self.core.setup_listener()

faulthandler.enable(all_threads=True)
# This is a bit unfortunate. We use SIGUSR1&2 for reloading config &
# restarting qtile, so we overload SIGWINCH here to dump threads.
faulthandler.register(signal.SIGWINCH, all_threads=True)

try:
async with LoopContext(
{
Expand Down
7 changes: 0 additions & 7 deletions libqtile/scripts/main.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import argparse
import faulthandler
import logging
import signal
import sys
from pathlib import Path

Expand All @@ -26,11 +24,6 @@ def check_folder(value):


def main():
faulthandler.enable(all_threads=True)
# This is a bit unfortunate. We use SIGUSR1&2 for reloading config &
# restarting qtile, so we overload SIGWINCH here to dump threads.
faulthandler.register(signal.SIGWINCH, all_threads=True)

parent_parser = argparse.ArgumentParser(add_help=False)
parent_parser.add_argument(
"-l",
Expand Down

0 comments on commit e6c8d6d

Please sign in to comment.