fix: debug stuck process by sending SIGUSR1

It will print stack to stderr.
This commit is contained in:
Ankush Menat 2024-03-18 11:56:22 +05:30
parent 0a81407304
commit 6560d4587a

View file

@ -11,6 +11,7 @@ be used to build database driven apps.
Read the documentation: https://frappeframework.com/docs
"""
import copy
import faulthandler
import functools
import gc
import importlib
@ -18,6 +19,7 @@ import inspect
import json
import os
import re
import signal
import traceback
import warnings
from collections.abc import Callable
@ -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))
@ -2542,6 +2545,10 @@ def validate_and_sanitize_search_inputs(fn):
return wrapper
def _register_fault_handler():
faulthandler.register(signal.SIGUSR1)
from frappe.utils.error import log_error
if _tune_gc: