File storage gateway thread health detection method and system

By setting health conditions and maintaining thread status, combined with regular heartbeat checks and automatic recovery measures, the inefficiency of NFS-Ganesha thread health checks has been resolved, improving system availability and response speed.

CN120973631APending Publication Date: 2025-11-18SHANDONG LANGCHAO YUNTOU INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511100491.1
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-07
Publication Date
2025-11-18

AI Technical Summary

Technical Problem

Traditional NFS-Ganesha thread health checks rely on manual monitoring, which is inefficient and has a long response time, making it difficult to meet the high availability requirements of modern data centers.

Method used

By setting health conditions, maintaining thread states, performing regular thread health heartbeat checks, and implementing automatic recovery operations and alarm notifications when anomalies are detected, including anomaly information collection, automatic recovery, and logging.

Benefits of technology

It enables early detection of issues such as thread deadlock and resource exhaustion, reduces manual debugging time, and improves system maintainability and response speed.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120973631A_ABST
    Figure CN120973631A_ABST
Patent Text Reader

Abstract

The invention relates to the technical field of cloud computing, in particular to a file storage gateway thread health detection method and system, and the method comprises the following steps: health condition setting, thread state maintenance, thread health heartbeat and abnormal state processing. The method has the advantages that potential problems such as thread deadlock and resource exhaustion can be found as soon as possible through regular heartbeat checking and state monitoring, and therefore intervention is conducted before the problems become serious. An automatic recovery mechanism can recover an abnormal state as early as possible.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of cloud computing technology, specifically to a method and system for detecting thread health in a file storage gateway. Background Technology

[0002] NFS is a distributed file system protocol that allows clients to access files on a server over a network. NFS-Ganesha is an open-source user-space NFS server implementation that supports multiple protocols, including NFSv3, NFSv4, and 9P (Plan 9).

[0003] In practical use, NFS-Ganesha may face potential problems such as thread deadlock and resource exhaustion. If these problems are not detected and handled in a timely manner, they may lead to serious business interruptions. Traditional solutions usually rely on manual monitoring and troubleshooting, which is not only inefficient but also has long response times, making it difficult to meet the high availability requirements of modern data centers. Summary of the Invention

[0004] The purpose of this invention is to provide a method and system for detecting the thread health of a file storage gateway, so as to solve the problems mentioned in the background art.

[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for detecting the thread health of a file storage gateway, comprising the following steps:

[0006] Health condition settings: Pre-set relevant configurations for judging abnormal thread or program states, including response time thresholds, CPU utilization, memory usage, and set the period of thread health heartbeat. The above configurations can be dynamically adjusted during operation.

[0007] Thread state maintenance: Maintain the state of threads in handling requests and resource usage, and manage the state information of each thread in a unified manner, including state initialization when the thread is created, state update when processing requests, resource reclamation when the thread is destroyed, as well as persistence and logging.

[0008] Thread health heartbeat: A separate management thread periodically checks the status of each task thread to identify and handle abnormal threads;

[0009] Abnormal state handling: When an abnormal thread state is detected, effective handling measures are implemented, including abnormal information collection, alarm notification, automatic recovery operation, and recording of abnormal logs.

[0010] Preferably, in the health condition setting steps: the response time threshold is set to the maximum allowed time for a thread to process a single request; if the time for a thread to process a request exceeds this threshold, it is marked as abnormal; the CPU utilization rate is set to the maximum percentage of CPU that a thread can use and the duration thereof; if the CPU utilization rate of a thread continuously exceeds the set limit for a set time, it is marked as abnormal; the memory usage is set to the maximum amount of memory that the program can normally use; if the program's memory usage exceeds this set value, it is marked as abnormal; and the thread health heartbeat cycle is set to perform a thread status check at regular intervals.

[0011] Preferably, the thread state maintenance steps include: Thread creation state initialization: When a new thread is created, it is registered in the thread manager and assigned a unique identifier. State information is initialized, including thread ID, state flags, the start timestamp of the most recently processed request, and CPU usage. Request processing state update: When a thread receives a new request, its state is updated to "busy" and the request start timestamp is recorded. After the request is processed, its state is updated to "idle" and the request end timestamp is recorded. Simultaneously, the request processing time is calculated and resource usage statistics are updated. Thread destruction resource reclamation: When a thread enters the destruction logic, the thread is unregistered, all resources occupied by the thread are cleaned up and released, and the thread's state information is removed from the global state table and the thread state table. Persistence and logging: Important state changes and abnormal situations are periodically recorded in a persistent log file.

[0012] Preferably, the thread health heartbeat steps include: Initialization: When the system starts, a dedicated independent management thread is created to perform health checks, and relevant configuration items for health condition settings are loaded, including the heartbeat check interval and the criteria for anomaly judgment; Periodic trigger detection: The independent management thread periodically triggers thread status checks according to the preset heartbeat interval, uses the global thread status table maintained during the thread status maintenance process, and checks whether the status of each thread is normal according to the preset health conditions. If the status information of a certain thread exceeds the preset health condition threshold, it is marked as an abnormal state and the abnormality type is recorded. At the same time, the abnormal situation and its context information are recorded in detail.

[0013] Preferably, the abnormal state handling steps include: Abnormal information collection: collecting recent request information, including request ID, request type, request parameters, request time, processing result, and completion time; dynamically increasing the log level to collect more log information; obtaining the stack information of each thread of the program and printing it to a specified file; Alarm notification: connecting to the alarm platform, and sending alarm notifications to operation and maintenance personnel via email, SMS, or other instant messaging tools when an abnormal state is detected. The alarm content includes the trigger time, alarm type, program information, abnormal type, and detailed information; Automatic recovery operation: executing pre-set repair measures, including restarting the process, adjusting resource configuration, and executing custom scripts, and different handling measures can be configured separately for various abnormal states; Recording abnormal logs: recording the abnormal situation and its context information in detail, including timestamp, thread ID, abnormal type, detailed information, handling measures, and results.

[0014] A system for a file storage gateway thread health detection method includes:

[0015] The health condition setting module is used to pre-set relevant configurations for judging abnormal thread or program states, including response time threshold, CPU utilization, memory usage, and thread health heartbeat cycle. The above configurations can be dynamically adjusted during operation.

[0016] The thread state maintenance module is used to maintain the state of threads processing requests and resource usage. It provides unified management of the state information of each thread, covering the state initialization when the thread is created, the state update when processing requests, the resource reclamation when the thread is destroyed, as well as persistence and logging.

[0017] The thread health heartbeat module uses a separate management thread to periodically check the status of each task thread in order to identify and handle abnormal threads.

[0018] The exception handling module is used to implement effective handling measures when an abnormal thread state is detected. These measures include exception information collection, alarm notification, automatic recovery operation, and exception logging.

[0019] Preferably, in the health condition setting module: the response time threshold is set to the maximum allowed time for a thread to process a single request; if the time for a thread to process a request exceeds this threshold, it is considered abnormal; the CPU utilization rate is set to the maximum percentage of CPU that a thread can use and the duration thereof; if the CPU utilization rate of a thread continuously exceeds the set limit for a set time, it is considered abnormal; the memory usage is set to the maximum amount of memory that the program can normally use; if the program's memory usage exceeds this set value, it is considered abnormal; and the thread health heartbeat cycle is set to perform a thread status check at regular intervals.

[0020] Preferably, the thread state maintenance module includes:

[0021] The thread creation submodule registers the new thread in the thread manager and assigns a unique identifier when a new thread is created, and initializes the status information, including the thread ID, status flags, the start timestamp of the most recently processed request, and CPU usage.

[0022] In the request processing submodule, when a thread receives a new request, it updates its status to "busy" and records the request start timestamp; after the request is processed, it updates its status to "idle" and records the request end timestamp, while also calculating the request processing time and updating resource usage statistics.

[0023] The thread destruction submodule, when a thread enters the destruction logic, cancels the thread, cleans up and releases all resources occupied by the thread, and removes the thread's state information from the global state table and the thread state table;

[0024] The persistence and logging submodule periodically records important state changes and exceptions to persistent log files.

[0025] Preferably, the thread health heartbeat module includes:

[0026] The initialization submodule creates a dedicated management thread for performing health checks when the system starts, loading relevant configuration items for health conditions, including the time interval for heartbeat checks and the criteria for abnormal judgment.

[0027] The timed detection submodule independently manages threads to periodically trigger thread status checks according to preset heartbeat intervals. It uses a global thread status table maintained during thread status maintenance to check whether the status of each thread is normal based on preset health conditions. If the status information of a thread exceeds the preset health condition threshold, it is marked as an abnormal state and the abnormality type is recorded. At the same time, the abnormal situation and its context information are recorded in detail.

[0028] Preferably, the abnormal state handling module includes:

[0029] The exception information collection submodule collects recent request information, including request ID, request type, request parameters, request time, processing result, and completion time; dynamically increases the log level to collect more log information; and obtains the stack information of each thread of the program and prints it to a specified file.

[0030] The alarm notification submodule connects to the alarm platform. When an abnormal state is detected, it sends alarm notifications to maintenance personnel via email, SMS or other instant messaging tools. The alarm content includes the trigger time, alarm type, program information, abnormal type and detailed information.

[0031] The automatic recovery operation submodule executes pre-set repair measures, including restarting processes, adjusting resource configurations, and executing custom scripts. It can also configure different handling measures for various abnormal states.

[0032] The exception logging submodule records exception situations and their context information in detail, including timestamp, thread ID, exception type, detailed information, handling measures, and results.

[0033] Compared with the prior art, the beneficial effects of the present invention are:

[0034] The file storage gateway thread health detection method and system proposed in this invention can detect potential problems such as thread deadlock and resource exhaustion early through regular heartbeat checks and status monitoring, thus intervening before the problems become serious. An automatic recovery mechanism can restore abnormal states as early as possible. Once an anomaly is detected, the system automatically sends an alarm notification and performs recovery operations according to preset strategies, reducing the time spent on manual debugging and troubleshooting. Collecting and recording detailed anomaly information, request information, and stack trace information helps to quickly locate the root cause of the problem. It allows for dynamic adjustment of health conditions and processing strategies according to actual needs, making the system more flexible and adaptable to different operating environments. Support for executing custom scripts enables the automation of complex fault recovery operations, improving system maintainability. Attached Figure Description

[0035] Figure 1 This is a flowchart of the method of the present invention. Detailed Implementation

[0036] To make the objectives, technical solutions, and advantages of the present invention clear and complete, the embodiments of the present invention will be further described in detail below with reference to the accompanying drawings. It should be understood that the specific embodiments described herein are only some, not all, embodiments of the present invention, and are merely illustrative of the embodiments of the present invention. They are not intended to limit the embodiments of the present invention. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0037] Example 1, please refer to Figure 1 The present invention provides a technical solution: a method for thread health detection in a file storage gateway, including setting health conditions, maintaining thread status, thread health heartbeat, and handling abnormal status.

[0038] 1. Health condition settings refer to pre-setting configurations for judging abnormal thread or program states. Currently supported abnormal state configurations are as follows:

[0039] (1) Response time threshold: Sets the maximum allowed time for a thread to process a single request. If a thread processes a single request for an extended period, it may deadlock or the underlying file system may become too slow. For example, if a thread takes more than 30 seconds to process a request, it is marked as an exception.

[0040] (2) CPU Utilization: Sets the maximum percentage of CPU that a thread can use and the duration thereof. A thread being in a state of high CPU utilization for an extended period may be due to insufficient CPU resources, which will cause performance degradation. For example, if a thread's CPU utilization exceeds 80% for 30 consecutive minutes, it is marked as abnormal.

[0041] (3) Memory usage: Sets the maximum amount of memory the program can normally use. For example, if the program's memory usage exceeds 8GB, it will be marked as abnormal.

[0042] Additionally, the interval for subsequent thread health heartbeats needs to be configured. For example, a thread status check can be performed every 15 seconds. All of the above configurations can be dynamically adjusted during runtime.

[0043] 2. Thread state maintenance refers to maintaining the state of a thread in handling requests and its resource usage, with unified management of the state information of each thread. Since nfs-ganesha threads are dynamically created and destroyed, state maintenance needs to be added when a thread is created, related resources need to be reclaimed when a thread is destroyed, and the thread state information needs to be updated when the thread is handling operations.

[0044] (1) State initialization during thread creation

[0045] Registering a thread: When a new thread is created, it is first registered in the thread manager and assigned a unique identifier (such as a thread ID).

[0046] Initialization State: Initializes state information for the new thread, including but not limited to:

[0047] Thread ID: Uniquely identifies a thread.

[0048] Status indicators: such as "idle", "busy", etc.

[0049] The start timestamp of the most recently processed request: initialized to the current time or set to empty.

[0050] CPU usage: Initialized to 0 or the default value.

[0051] (2) Status update when processing requests

[0052] When NFS-Ganesha receives a request, it dispatches it to a currently idle thread for processing. The current thread's state information needs to be updated.

[0053] Receiving requests: When a thread receives a new request, it updates its status to "busy" and records the timestamp of the request's start.

[0054] Request Completed: Once the request is processed, the status is updated to "Idle," and the request's end timestamp is recorded. Simultaneously, the request processing time can be calculated, and resource usage statistics can be updated.

[0055] (3) Resource reclamation during thread destruction

[0056] Thread cancellation: When there are too many threads in the thread pool compared to the number of requests, some threads will enter the destruction logic if they do not process requests for a period of time.

[0057] Release resources: Clean up and release all resources occupied by the thread, including memory, file handles, etc.

[0058] State cleanup: Remove the thread's state information from the global state table to ensure that no invalid data is retained in the state table. Also, remove the thread's information from the thread state table accordingly.

[0059] (4) Persistence and logging

[0060] Persistent state: Important state changes and abnormal situations are periodically recorded in persistent log files for subsequent analysis and troubleshooting.

[0061] 3. The core of the thread health heartbeat mechanism is to periodically check the status of each task thread through a separate management thread to identify and handle abnormal threads. The main processing logic of this mechanism is as follows:

[0062] (1) Initialization

[0063] Create a management thread: When the system starts, a separate management thread is created specifically for performing health checks.

[0064] Load configuration parameters: Load the relevant configuration items for health conditions, including the time interval for heartbeat checks (e.g., every 15 seconds) and the criteria for anomaly judgment (e.g., response time threshold, CPU utilization limit, etc.).

[0065] (2) Timed trigger detection

[0066] An independent management thread periodically triggers thread state checks according to a preset heartbeat interval. The state information directly uses the global thread state table maintained during the thread state maintenance process.

[0067] Based on preset health conditions (such as response time threshold, CPU utilization limit, memory usage limit, etc.), check whether the status of each thread is normal. If the status information of a thread exceeds the preset health condition threshold (such as CPU utilization exceeding 80%), it is marked as an abnormal state and the abnormality type is recorded.

[0068] Log recording: Records detailed abnormal situations and their context information, facilitating subsequent fault analysis and root cause identification.

[0069] 4. Abnormal state handling refers to implementing effective processing measures when an abnormal thread state is detected. The following measures can all be dynamically switched on / off according to actual needs. Supported processing measures include:

[0070] (1) Anomaly information collection: Collecting detailed anomaly information facilitates subsequent problem localization and analysis. This includes:

[0071] Recent Request Information: Collects request information received by the program when problems occur, including request ID, request type, request parameters, request time, processing result, and completion time.

[0072] Detailed Logs: Dynamically increase the log level to collect more log information.

[0073] Stack information: Obtain the stack information of each thread of the program and print it to the specified file.

[0074] (2) Alarm Notification: Connect to the alarm platform. Once an abnormal state is detected, immediately send an alarm notification to the operations and maintenance personnel via email, SMS, or other instant messaging tools. The alarm content should include:

[0075] Trigger time: Alarm trigger time

[0076] Alarm type: NFS-Ganesha thread exception

[0077] Program information: The node it is located on, the process PID, and the thread ID, which are used to uniquely identify the abnormal thread.

[0078] Error types: no response, abnormal resource usage, etc.

[0079] Detailed information: such as the timestamp of the most recently processed request, current CPU usage, memory usage, etc.

[0080] (3) Automatic recovery operation: It can execute pre-set repair measures, such as restarting processes, adjusting resource configurations, and executing custom scripts. Different handling measures can be configured separately for various abnormal states.

[0081] Restart process: Applicable when a thread is unresponsive or encounters a problem that cannot be recovered by other means.

[0082] Adjust resource configuration: Applicable when the resource utilization (such as CPU, memory) of a thread exceeds a preset threshold.

[0083] Execute custom scripts: for specific types of exceptions or complex fault recovery scenarios.

[0084] (4) Log exceptions: Record exception details and their context information, including but not limited to:

[0085] Timestamp: The time when the exception occurred.

[0086] Thread ID: The thread ID involved.

[0087] Exception type: The specific exception type.

[0088] Detailed information: such as CPU usage, memory consumption, and recently processed request information.

[0089] Handling measures and results: Specific measures implemented, and whether the handling was successful. For example, whether an alarm was triggered, and whether the alarm-related interface was successfully called, etc.

[0090] Example 2, based on Example 1, proposes a system for a file storage gateway thread health detection method, comprising:

[0091] The health condition settings module is used to pre-set relevant configurations for judging abnormal thread or program states, including response time thresholds, CPU utilization, memory usage, and thread health heartbeat cycles. These configurations can be dynamically adjusted during operation. The response time threshold is set as the maximum allowed time for a thread to process a single request. If the time for a thread to process a request exceeds this threshold, it is judged as abnormal. The CPU utilization is set as the maximum percentage of CPU that a thread can use and the duration thereof. If the CPU utilization of a thread continuously exceeds the set limit for a set time, it is judged as abnormal. The memory usage is set as the maximum amount of memory that the program can normally use. If the program's memory usage exceeds this set value, it is judged as abnormal. The thread health heartbeat cycle is set to perform thread state checks at regular intervals.

[0092] The thread state maintenance module is used to maintain the state of threads processing requests and their resource usage. It provides unified management of the state information of each thread, covering state initialization when a thread is created, state updates when processing requests, resource reclamation when a thread is destroyed, and persistence and logging. It includes: a thread creation submodule, which registers a new thread in the thread manager and assigns a unique identifier, initializes state information including thread ID, state flags, the start timestamp of the most recent processed request, and CPU usage; a request processing submodule, which updates the state to "busy" and records the request start timestamp when a thread receives a new request; after the request is processed, it updates the state to "idle" and records the request end timestamp, while calculating the request processing time and updating resource usage statistics; a thread destruction submodule, which unregisters the thread, cleans up and releases all resources occupied by the thread, and removes the thread's state information from the global state table and the thread state table when a thread enters the destruction logic; and a persistence and logging submodule, which periodically records important state changes and exceptions to a persistent log file.

[0093] The thread health heartbeat module uses an independent management thread to periodically check the status of each task thread to identify and handle abnormal threads. It includes: an initialization submodule, which creates a dedicated management thread for health checks during system startup and loads relevant configuration items for health conditions, including the heartbeat check interval and the criteria for anomaly judgment; and a periodic detection submodule, where the independent management thread periodically triggers thread status checks according to preset heartbeat intervals. Using a global thread status table maintained during thread status maintenance, it checks the status of each thread against preset health conditions. If a thread's status exceeds a preset health condition threshold, it is marked as abnormal, and the anomaly type is recorded, along with detailed information about the anomaly and its context.

[0094] The abnormal state handling module is used to implement effective handling measures when abnormal thread states are detected. These measures include abnormal information collection, alarm notification, automatic recovery operations, and abnormal log recording. Specifically: An abnormal information collection submodule collects recent request information, including request ID, request type, request parameters, request time, processing result, and completion time; dynamically increases the log level to collect more log information; and obtains the stack trace information of each thread and prints it to a specified file. An alarm notification submodule connects to an alarm platform and sends alarm notifications to operations personnel via email, SMS, or other instant messaging tools when an abnormal state is detected. The alarm content includes the trigger time, alarm type, program information, abnormal type, and detailed information. An automatic recovery operation submodule executes pre-defined repair measures, including restarting the process, adjusting resource configuration, and executing custom scripts. Different handling measures can be configured individually for various abnormal states. An abnormal log recording submodule records detailed abnormal conditions and their context information, including timestamps, thread IDs, abnormal types, detailed information, handling measures, and results.

[0095] Although embodiments of the invention have been shown and described, it will be understood by those skilled in the art that various changes, modifications, substitutions and alterations can be made to these embodiments without departing from the principles and spirit of the invention, the scope of which is defined by the appended claims and their equivalents.

Claims

1. A method for detecting thread health in a file storage gateway, characterized in that: Includes the following steps: Health condition settings: Pre-set relevant configurations for judging abnormal thread or program states, including response time thresholds, CPU utilization, memory usage, and set the period of thread health heartbeat. The above configurations can be dynamically adjusted during operation. Thread state maintenance: Maintain the state of threads in handling requests and resource usage, and manage the state information of each thread in a unified manner, including state initialization when the thread is created, state update when processing requests, resource reclamation when the thread is destroyed, as well as persistence and logging. Thread health heartbeat: A separate management thread periodically checks the status of each task thread to identify and handle abnormal threads; Abnormal state handling: When an abnormal thread state is detected, effective handling measures are implemented, including abnormal information collection, alarm notification, automatic recovery operation, and recording of abnormal logs.

2. The file storage gateway thread health detection method according to claim 1, characterized in that: In the health condition setting steps: the response time threshold is set as the maximum allowed time for a thread to process a single request. If the time for a thread to process a request exceeds this threshold, it is marked as abnormal. CPU utilization is set to the maximum percentage of CPU that a thread can use for a certain duration. If a thread's CPU utilization exceeds the set limit for an extended period of time, it will be marked as abnormal. Memory usage is set to the maximum amount of memory that the program can normally use. If the program's memory usage exceeds this setting, it will be marked as abnormal. The thread health heartbeat cycle is set to perform a thread status check at regular intervals.

3. The file storage gateway thread health detection method according to claim 2, characterized in that: The thread state maintenance steps include: Thread creation state initialization: When a new thread is created, it is registered in the thread manager and assigned a unique identifier. State information is initialized, including thread ID, state flags, the start timestamp of the most recently processed request, and CPU usage. Request processing state update: When a thread receives a new request, its state is updated to "busy" and the request start timestamp is recorded. After the request is processed, the state is updated to "idle" and the request end timestamp is recorded. Simultaneously, the request processing time is calculated and resource usage statistics are updated. Thread destruction resource reclamation: When a thread enters the destruction logic, the thread is unregistered, all resources occupied by the thread are cleaned up and released, and the thread's state information is removed from the global state table and the thread state table. Persistence and logging: Important state changes and exceptions are periodically recorded in a persistent log file.

4. The file storage gateway thread health detection method according to claim 3, characterized in that: The thread health heartbeat steps include: Initialization: When the system starts, a dedicated independent management thread is created to perform health checks, and the relevant configuration items for health condition settings are loaded, including the heartbeat check interval and the criteria for anomaly judgment; Periodic trigger detection: The independent management thread periodically triggers thread status checks according to the preset heartbeat interval, uses the global thread status table maintained during the thread status maintenance process, and checks whether the status of each thread is normal according to the preset health conditions. If the status information of a certain thread exceeds the preset health condition threshold, it is marked as an abnormal state and the abnormality type is recorded. At the same time, the abnormal situation and its context information are recorded in detail.

5. The file storage gateway thread health detection method according to claim 4, characterized in that: In the abnormal state handling steps: Abnormal information collection: Collect recent request information, including request ID, request type, request parameters, request time, processing result, and completion time; Dynamically increase log levels to collect more log information; obtain stack information of each thread of the program and print it to a specified file; alarm notification: connect to the alarm platform, and when an abnormal state is detected, send alarm notifications to operation and maintenance personnel via email, SMS or other instant messaging tools. The alarm content includes the trigger time, alarm type, program information, abnormal type, and detailed information; automatic recovery operation: execute pre-set repair measures, including restarting the process, adjusting resource configuration, and executing custom scripts. Different handling measures can be configured separately for various abnormal states. Record exception logs: Record exception situations and their context information in detail, including timestamp, thread ID, exception type, detailed information, handling measures and results.

6. A system for the file storage gateway thread health detection method according to claim 5, characterized in that: include: The health condition setting module is used to pre-set relevant configurations for judging abnormal thread or program states, including response time threshold, CPU utilization, memory usage, and thread health heartbeat cycle. The above configurations can be dynamically adjusted during operation. The thread state maintenance module is used to maintain the state of threads processing requests and resource usage. It provides unified management of the state information of each thread, covering the state initialization when the thread is created, the state update when processing requests, the resource reclamation when the thread is destroyed, as well as persistence and logging. The thread health heartbeat module uses a separate management thread to periodically check the status of each task thread in order to identify and handle abnormal threads. The exception handling module is used to implement effective handling measures when an abnormal thread state is detected. These measures include exception information collection, alarm notification, automatic recovery operation, and exception logging.

7. The system according to claim 6, characterized in that: In the health condition settings module: the response time threshold is set as the maximum allowed time for a thread to process a single request. If the time for a thread to process a request exceeds this threshold, it is considered abnormal; the CPU utilization is set as the maximum percentage of CPU that a thread can use and the duration of that time. If the CPU utilization of a thread continuously exceeds the set limit for a certain period of time, it is considered abnormal; the memory usage is set as the maximum amount of memory that the program can normally use. If the program's memory usage exceeds this setting, it is considered abnormal. The thread health heartbeat cycle is set to perform a thread status check at regular intervals.

8. The system according to claim 7, characterized in that: The thread state maintenance module includes: The thread creation submodule registers the new thread in the thread manager and assigns a unique identifier when a new thread is created, and initializes the status information, including the thread ID, status flags, the start timestamp of the most recently processed request, and CPU usage. In the request processing submodule, when a thread receives a new request, it updates its status to "busy" and records the request start timestamp; after the request is processed, it updates its status to "idle" and records the request end timestamp, while also calculating the request processing time and updating resource usage statistics. The thread destruction submodule, when a thread enters the destruction logic, cancels the thread, cleans up and releases all resources occupied by the thread, and removes the thread's state information from the global state table and the thread state table; The persistence and logging submodule periodically records important state changes and exceptions to persistent log files.

9. A system according to claim 8, characterized in that: The thread health heartbeat module includes: The initialization submodule creates a dedicated management thread for performing health checks when the system starts, loading relevant configuration items for health conditions, including the time interval for heartbeat checks and the criteria for abnormal judgment. The timed detection submodule independently manages threads to periodically trigger thread status checks according to preset heartbeat intervals. It uses a global thread status table maintained during thread status maintenance to check whether the status of each thread is normal based on preset health conditions. If the status information of a thread exceeds the preset health condition threshold, it is marked as an abnormal state and the abnormality type is recorded. At the same time, the abnormal situation and its context information are recorded in detail.

10. A system according to claim 9, characterized in that: The abnormal state handling module includes: The exception information collection submodule collects recent request information, including request ID, request type, request parameters, request time, processing result, and completion time; dynamically increases the log level to collect more log information; and obtains the stack information of each thread of the program and prints it to a specified file. The alarm notification submodule connects to the alarm platform. When an abnormal state is detected, it sends alarm notifications to maintenance personnel via email, SMS or other instant messaging tools. The alarm content includes the trigger time, alarm type, program information, abnormal type and detailed information. The automatic recovery operation submodule executes pre-set repair measures, including restarting processes, adjusting resource configurations, and executing custom scripts. It can also configure different handling measures for various abnormal states. The exception logging submodule records exception situations and their context information in detail, including timestamp, thread ID, exception type, detailed information, handling measures, and results.