Skip to content

Commit

Permalink
fix: debug stuck process by sending SIGUSR1
Browse files Browse the repository at this point in the history
It will print stack to stderr.
  • Loading branch information
ankush committed Mar 18, 2024
1 parent 0a81407 commit 6560d45
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions frappe/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,15 @@
Read the documentation: https://frappeframework.com/docs
"""
import copy
import faulthandler
import functools
import gc
import importlib
import inspect
import json
import os
import re
import signal
import traceback
import warnings
from collections.abc import Callable
Expand Down Expand Up @@ -304,6 +306,7 @@ def init(site: str, sites_path: str = ".", new_site: bool = False, force=False)
if not _qb_patched.get(local.conf.db_type):
patch_query_execute()
patch_query_aggregation()
_register_fault_handler()

setup_module_map(include_all_apps=not (frappe.request or frappe.job or frappe.flags.in_migrate))

Expand Down Expand Up @@ -2542,6 +2545,10 @@ def wrapper(*args, **kwargs):
return wrapper


def _register_fault_handler():
faulthandler.register(signal.SIGUSR1)


from frappe.utils.error import log_error

if _tune_gc:
Expand Down

0 comments on commit 6560d45

Please sign in to comment.