An exception processing method, apparatus, device, storage medium, and product

By finding the target process based on the process identifier and switching the memory node state in the vehicle-mounted PubSub communication system, the performance degradation caused by shared memory switching is solved, and the stability and maintainability of system performance are improved.

CN123157489APending Publication Date: 2026-11-24SHANGHAI LIXIANG AUTOMOBILE CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510678306.0
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-05-23
Publication Date
2026-11-24

AI Technical Summary

Technical Problem

In vehicle-mounted PubSub communication systems, shared memory switching caused by exception handling increases system performance degradation and complexity. Furthermore, the overhead of switching shared memory in existing technologies is significant, affecting system stability and maintainability.

Method used

The target process is located in at least two user processes based on the process identifier of the abnormal process. The user identifier is determined according to the index of the target process. The node state of the target memory node is switched to the unused shared memory state, the shared memory is reclaimed and reused, and the creation of new shared memory is avoided.

Benefits of technology

It reduces system performance degradation, simplifies exception handling processes, reduces system complexity, and improves system stability and maintainability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN123157489A_ABST
    Figure CN123157489A_ABST
Patent Text Reader

Abstract

This application provides an exception handling method, apparatus, device, storage medium, and product. The exception handling method includes: searching for a target process with the same identifier value as the process identifier among at least two user processes based on the process identifier of the exception process; determining a user identifier based on the index of the target process; and switching the node state of the target memory node corresponding to the user identifier to an unused shared memory state. This application can reduce system performance degradation.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of vehicle communication technology, and in particular to an anomaly handling method, apparatus, device, storage medium, and product. Background Technology

[0002] In vehicular publisher / subscriber (PubSub) communication systems, the domain portion typically employs a shared memory mechanism provided by the operating system to implement 0-copy message transmission, thereby improving communication efficiency and reducing latency, such as CyberRT and FastDDS.

[0003] In related technologies, schemes for zero-copy message transmission based on the shared memory mechanism provided by the operating system primarily manage shared memory by switching to a new shared memory after either end of the communication fails. That is, upon detecting an anomaly at either end of the communication using shared memory, the existing shared memory is reclaimed, and a new shared memory is created for subsequent communication. However, switching shared memory causes the memory allocation and management structure to be rebuilt, thus increasing system performance degradation. Summary of the Invention

[0004] This application provides an exception handling method, apparatus, device, storage medium, and product that can reduce system performance degradation.

[0005] The technical solution of this application embodiment is implemented as follows:

[0006] This application provides an exception handling method, the method comprising:

[0007] Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes;

[0008] Determine the user identifier based on the index of the target process;

[0009] Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0010] In the above scheme, before switching the node state of the target memory node corresponding to the user identifier to the unused shared memory state, the method further includes:

[0011] In at least two user states corresponding to the at least two user processes, the user state of the target process is switched to a crash state.

[0012] In the above scheme, the user state includes: the crash state, the usage state, and the unused state;

[0013] The unused state includes situations where the publisher has not built the user process or the subscriber has not used the user process.

[0014] In the above scheme, the node state includes: the unused shared memory state, the shared memory in use state, and the intermediate state;

[0015] The intermediate state is either the state where the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output.

[0016] In the above scheme, after switching the node state of the target memory node corresponding to the user identifier to an unused shared memory state, the method further includes:

[0017] Determine whether the node state of each memory node in the shared memory is the unused shared memory state;

[0018] If the node state of each memory node in the shared memory is the unused shared memory state, then the shared memory is closed.

[0019] In the above scheme, after switching the node state of the target memory node corresponding to the user identifier to an unused shared memory state, the method further includes:

[0020] The target memory node is reclaimed and reused.

[0021] In the above scheme, before searching for a target process with the same identifier value as the abnormal process identifier among at least two user processes, the method further includes:

[0022] If an abnormal process is identified, the process identifier of the abnormal process is determined.

[0023] In the above scheme, determining the process identifier of the abnormal process when an abnormal process is identified includes:

[0024] Determine if the abnormal memory flag is enabled;

[0025] If it is determined that the abnormal memory identifier is in an open state and an abnormal process is identified, the process identifier of the abnormal process is determined.

[0026] This application provides an exception handling device, including:

[0027] The search unit is used to search for a target process with the same identifier value as the process identifier among at least two user processes based on the process identifier of the abnormal process.

[0028] The determining unit is used to determine the user identifier based on the index of the target process;

[0029] The switching unit is used to switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state.

[0030] In the above scheme, the switching unit is further configured to switch the user state of the target process to a crash state in at least two user states corresponding to the at least two user processes.

[0031] In the above scheme, the user state includes: the crash state, the usage state, and the unused state;

[0032] The unused state includes situations where the publisher has not built the user process or the subscriber has not used the user process.

[0033] In the above scheme, the node state includes: the unused shared memory state, the shared memory in use state, and the intermediate state;

[0034] The intermediate state is either the state where the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output.

[0035] In the above scheme, the device further includes a shut-off unit;

[0036] The determining unit is used to determine whether the node state of each memory node in the shared memory is the unused shared memory state;

[0037] The shutdown unit is used to shut down the shared memory when the node state of each memory node in the shared memory is the unused shared memory state.

[0038] In the above scheme, the device further includes a recycling unit and a usage unit;

[0039] The recycling unit is used to reclaim the target memory node.

[0040] The usage unit is used to use the target memory node.

[0041] In the above scheme, the determining unit is used to determine the process identifier of the abnormal process when it is determined that an abnormal process exists.

[0042] In the above scheme, the determining unit is used to determine whether the abnormal memory identifier is in an open state; if it is determined that the abnormal memory identifier is in an open state and an abnormal process is determined, the process identifier of the abnormal process is determined.

[0043] This application embodiment provides an anomaly handling device, the anomaly handling device comprising:

[0044] Memory is used to store executable instructions for a computer;

[0045] A processor, when executing computer-executable instructions stored in the memory, implements the method provided in the embodiments of this application.

[0046] This application provides a computer-readable storage medium storing a computer program or computer-executable instructions for implementing the exception handling method provided in this application when executed by a processor.

[0047] This application provides a computer program product, including a computer program or computer executable instructions, which, when executed by a processor, implements the exception handling method provided in this application.

[0048] The embodiments of this application have the following beneficial effects: The exception handling device searches for the target process corresponding to the process identifier of the exception process in at least two user processes. Based on the index of the target process, it obtains the user identifier and switches the node state of the target memory node corresponding to the user identifier to an unused shared memory state. This allows the publisher or subscriber to reclaim and reuse the shared memory corresponding to the target memory node by adjusting the node state of the target memory node to an unused shared memory state in the event of an exception on the subscriber or publisher side. This enables the publisher to rewrite to the shared memory or the subscriber to resubscribe to the shared memory without having to create and switch to a new shared memory, thus reducing system performance degradation. Attached Figure Description

[0049] Figure 1 This is a flowchart of an exception handling method provided in an embodiment of this application;

[0050] Figure 2 This is a schematic diagram of an exemplary BufferRefer data structure provided in an embodiment of this application;

[0051] Figure 3 This is an exemplary schematic diagram of a buffer state machine transition provided in an embodiment of this application;

[0052] Figure 4 This is a schematic diagram of an exemplary abnormal event perception and processing flow provided in an embodiment of this application;

[0053] Figure 5 This is an exemplary flowchart of an exception handling process for a Pub node provided in an embodiment of this application;

[0054] Figure 6 This is an exemplary flowchart of an exception handling process for a Sub node provided in an embodiment of this application;

[0055] Figure 7 This is a schematic diagram of the composition structure of an exception handling device provided in an embodiment of this application;

[0056] Figure 8 This is a schematic diagram of the composition structure of an exception handling device provided in an embodiment of this application. Detailed Implementation

[0057] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. The described embodiments should not be regarded as limitations on this application. All other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0058] In the following description, references are made to “some embodiments,” which describe a subset of all possible embodiments. However, it is understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0059] In the embodiments of this application, the terms "module" or "unit" refer to a computer program or part of a computer program that has a predetermined function and works with other related parts to achieve a predetermined goal, and can be implemented wholly or partially using software, hardware (such as processing circuitry or memory), or a combination thereof. Similarly, a processor (or at least two processors or memory) can be used to implement one or at least two modules or units. Furthermore, each module or unit can be part of an overall module or unit that includes the functionality of that module or unit.

[0060] Unless otherwise defined, all technical and scientific terms used in the embodiments of this application have the same meaning as commonly understood by one of ordinary skill in the art. The terminology used in the embodiments of this application is for the purpose of describing the embodiments of this application only and is not intended to limit this application.

[0061] In the implementation of this application, the collection and processing of relevant data should strictly comply with the requirements of relevant national laws and regulations, obtain the informed consent or separate consent of the personal information subject, and carry out subsequent data use and processing within the scope of laws and regulations and the authorization of the personal information subject.

[0062] Before providing a further detailed description of the embodiments of this application, the nouns and terms involved in the embodiments of this application will be explained, and the nouns and terms involved in the embodiments of this application shall be interpreted as follows.

[0063] 1) Publisher / Subscriber (PubSub);

[0064] 2) Globally Unique Identifier (UUID);

[0065] 3) Process Identifier (PID).

[0066] In related technologies, the main drawbacks of the scheme that processes and reclaims the existing shared memory after detecting an anomaly, and then creates a new shared memory for subsequent communication include: (1) The overhead of switching shared memory during anomalies is relatively large, mainly in two aspects: performance overhead, as switching to a new shared memory causes memory allocation and management structure reconstruction, leading to performance degradation; and time overhead, as the reclamation of the old shared memory generally requires a separate thread to periodically poll and process, resulting in a long overall anomaly handling time. (2) Since switching to a new shared memory involves memory anomaly handling, it is heavily coupled with other business logic, and the complex implicit dependencies result in weak module cohesion. (3) The periodic detection method heavily relies on the stability and reliability of the detection process in handling anomalies. Once the detection program has a problem, there is a risk of memory leaks, and the redundant design of the detection process increases the complexity and maintainability of the entire system.

[0067] The problems existing in the related technologies can be solved by means of the methods in the following embodiments.

[0068] Example 1

[0069] This application provides an exception handling method, which is applied to an exception handling device. Figure 1 A flowchart of an exception handling method provided in an embodiment of this application is shown below. Figure 1 As shown, exception handling methods may include:

[0070] S101. Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0071] The exception handling method provided in this application embodiment is applicable to scenarios where the publisher or subscriber is experiencing an exception when communicating using shared memory.

[0072] In the embodiments of this application, the exception handling device can be implemented in various forms. For example, the exception handling device described in this application may include devices such as vehicle controllers, cloud, servers, etc. The specific exception handling device can be determined according to the actual situation, and the embodiments of this application do not limit it.

[0073] It should be noted that the specific number of at least two user processes can be determined according to the actual situation, and this application embodiment does not limit this.

[0074] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0075] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0076] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0077] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0078] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0079] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0080] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0081] It should be noted that the process identifier can be the PID value of the process.

[0082] In the embodiments of this application, the number of abnormal processes can be one or at least two. The specific number of abnormal processes can be determined according to the actual situation, and the embodiments of this application do not limit this.

[0083] S102. Determine the user identifier based on the index of the target process.

[0084] In this embodiment of the application, after the exception handling device finds the target process with the same identifier value as the process identifier in at least two user processes based on the process identifier of the exception process, it can determine the user identifier according to the index of the target process.

[0085] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0086] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0087] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0088] For example, the user identifier can be a userID.

[0089] S103. Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0090] In this embodiment of the application, after the exception handling device determines the user identifier based on the index of the target process, it can switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0091] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0092] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0093] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0094] In this embodiment, in the event of a subscriber malfunction, the publisher communicating with the subscriber via shared memory can search for a target process with the same identifier value among at least two user processes based on the process identifier of the malfunctioning process; determine the user identifier based on the index of the target process; and switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state. Alternatively, in the event of a publisher malfunction, the subscriber communicating with the publisher via shared memory can search for a target process with the same identifier value among at least two user processes based on the process identifier of the malfunctioning process; determine the user identifier based on the index of the target process; and switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state.

[0095] Understandably, the exception handling device searches for the target process corresponding to the process identifier of the exception process among at least two user processes. Based on the index of the target process, it obtains the user identifier and switches the node state of the target memory node corresponding to the user identifier to an unused shared memory state. This allows the publisher or subscriber to reclaim and reuse the shared memory corresponding to the target memory node by adjusting the node state of the target memory node to an unused shared memory state in the event of an exception on the subscriber or publisher side. This enables the publisher to rewrite to the shared memory or the subscriber to resubscribe to the shared memory without having to create and switch to a new shared memory, thus reducing system performance degradation.

[0096] Example 2

[0097] This embodiment will introduce the process of another exception handling method. The specific implementation process may include the following steps (1)-(4):

[0098] Step (1): Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0099] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0100] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0101] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0102] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0103] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0104] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0105] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0106] Step (2): Determine the user identifier based on the index of the target process.

[0107] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0108] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0109] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0110] For example, the user identifier can be a userID.

[0111] Step (3): In at least two user states corresponding to at least two user processes, switch the user state of the target process to the crash state.

[0112] In this embodiment of the application, the user state corresponding to the target process can be determined in the BufferRefer data structure, and the user state in the BufferRefer data structure can be adjusted to a crash state.

[0113] It should be noted that the crash state can be the Crash state, which means that the process on the requesting end or the user end has crashed.

[0114] In this embodiment of the application, the BufferRefer data structure is configured with a correspondence between user processes and user process states. Based on this correspondence, the target user process state corresponding to the target process can be accurately and efficiently determined, that is, the user state is determined. Then, the user state in the BufferRefer data structure is switched to the crash state.

[0115] In this embodiment, the user state includes: a crash state, a usage state, and an unused state; wherein, the unused state includes the publisher not building the user process or the subscriber not using the user process. The usage state includes the publisher using the user process or the subscriber using the user process.

[0116] In this embodiment of the application, the data structure of BufferRefer is as follows: Figure 2 As shown, the User's state includes Invalid (not used), Using (in use), and Crash (crashed). Invalid means that the sending end has not been built or the receiving end is not using it; Using means that the requesting end is using it or the receiving end is using it; Crash means that the requesting end or the user end process has crashed.

[0117] In this embodiment, the bufferRefer state machine switching process can be switching the Using state to the Crash state, or switching the Crash state to the Invalid state; or switching the Invalid state to the Using state.

[0118] In this embodiment of the application, step (3) can be executed after step (2); step (3) can be executed first and then step (2); step (3) can be executed at the same time as step (2); the specific execution order of step (2) and step (3) can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0119] Step (4): Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0120] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0121] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0122] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0123] In this embodiment, the node state includes: an unused shared memory state, a shared memory in use state, and an intermediate state; wherein, the intermediate state is the state in which the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output. The shared memory in use state is the state in which the subscriber is using the target memory node or the publisher is using the target memory node.

[0124] In this embodiment of the application, the data structure of the memory node (BufferNode) is as follows: Figure 3 As shown, a BufferNod e has 64 bits, with every 3 bits used to manage the state of a buffer. The states of a buffer include Free, Using, and Pending. Free means that the sender or receiver is not using it, Pending means that the user has requested memory or it is in the queue output and has not been delivered to the user, and Using means that the requester is using it or the receiver is using it.

[0125] In the embodiments of this application, the Buffer state machine switching process can be switching the Using state to the Free state, or switching the Free state to the Pending state; or switching the Pending state to the Using state.

[0126] In this embodiment, in the event of a subscriber malfunction, the publisher communicating with the subscriber via shared memory can search for a target process with the same identifier value among at least two user processes based on the process identifier of the malfunctioning process; determine the user identifier based on the index of the target process; switch the user state of the target process to a crash state among at least two user states corresponding to the at least two user processes; and finally switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state. Alternatively, in the event of a publisher malfunction, the subscriber communicating with the publisher via shared memory can search for a target process with the same identifier value among at least two user processes based on the process identifier of the malfunctioning process; determine the user identifier based on the index of the target process; switch the user state of the target process to a crash state among at least two user states corresponding to the at least two user processes; and finally switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state.

[0127] Example 3

[0128] This embodiment will describe the process of another exception handling method. The specific implementation process may include the following steps (1)-(6):

[0129] Step (1): Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0130] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0131] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0132] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0133] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0134] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0135] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0136] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0137] Step (2): Determine the user identifier based on the index of the target process.

[0138] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0139] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0140] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0141] For example, the user identifier can be a userID.

[0142] Step (3): In at least two user states corresponding to at least two user processes, switch the user state of the target process to the crash state.

[0143] In this embodiment of the application, the user state corresponding to the target process can be determined in the BufferRefer data structure, and the user state in the BufferRefer data structure can be adjusted to a crash state.

[0144] It should be noted that the crash state can be the Crash state, which means that the process on the requesting end or the user end has crashed.

[0145] In this embodiment, the BufferRefer data structure contains a correspondence between user processes and user process states. The target user process state corresponding to the target process can be determined based on this correspondence, i.e., the user state is determined. Then, the user state in the BufferRefer data structure is switched to the crash state.

[0146] In this embodiment of the application, the user state includes: crash state, usage state, and unused state;

[0147] The "unused" state includes situations where the publisher has not built the user process or the subscriber is not using the user process. The "used" state includes situations where the publisher is using the user process or the subscriber is using the user process.

[0148] In this embodiment of the application, step (3) can be executed after step (2); step (3) can be executed first and then step (2); step (3) can be executed at the same time as step (2); the specific execution order of step (2) and step (3) can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0149] Step (4): Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0150] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0151] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0152] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0153] In this embodiment, the node state includes: an unused shared memory state, a shared memory in use state, and an intermediate state; wherein, the intermediate state is the state in which the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output. The shared memory in use state is the state in which the subscriber is using the target memory node or the publisher is using the target memory node.

[0154] Step (5): Determine whether the node state of each memory node in the shared memory is unused shared memory.

[0155] In this embodiment, the shared memory includes at least three memory nodes, and the target memory node is among the at least three memory nodes. The states of at least three nodes corresponding to the at least three memory nodes in the shared memory can be determined, that is, the node state of each memory node in the shared memory can be determined.

[0156] It should be noted that there is a one-to-one correspondence between at least three memory nodes and at least three node states, that is, one memory node corresponds to one node state.

[0157] Step (6): When the node state of each memory node in the shared memory is the unused shared memory state, close the shared memory.

[0158] In this embodiment of the application, the shared memory is closed when the node state of each memory node in the shared memory is the unused shared memory state, that is, when the node state corresponding to all memory nodes in the shared memory is the unused shared memory state.

[0159] In this embodiment, in the event of an anomaly at the publisher, the subscriber communicating with the publisher via shared memory can search for a target process with the same identifier value as the abnormal process among at least two user processes; determine the user identifier based on the index of the target process; switch the user state of the target process to a crash state among at least two user states corresponding to at least two user processes; switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state; and determine whether the node state of each memory node in the shared memory is an unused shared memory state; if the node state of each memory node in the shared memory is an unused shared memory state, then the shared memory is closed.

[0160] Example 4

[0161] This embodiment will describe the flow of another exception handling method. The specific implementation process may include the following steps (1)-(4) and step (7):

[0162] Step (1): Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0163] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0164] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0165] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0166] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0167] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0168] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0169] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0170] Step (2): Determine the user identifier based on the index of the target process.

[0171] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0172] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0173] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0174] For example, the user identifier can be a userID.

[0175] Step (3): In at least two user states corresponding to at least two user processes, switch the user state of the target process to the crash state.

[0176] In this embodiment of the application, the user state corresponding to the target process can be determined in the BufferRefer data structure, and the user state in the BufferRefer data structure can be adjusted to a crash state.

[0177] It should be noted that the crash state can be the Crash state, which means that the process on the requesting end or the user end has crashed.

[0178] In this embodiment, the BufferRefer data structure contains a correspondence between user processes and user process states. The target user process state corresponding to the target process can be determined based on this correspondence, i.e., the user state is determined. Then, the user state in the BufferRefer data structure is switched to the crash state.

[0179] In this embodiment of the application, the user state includes: crash state, usage state, and unused state;

[0180] The "unused" state includes situations where the publisher has not built the user process or the subscriber is not using the user process. The "used" state includes situations where the publisher is using the user process or the subscriber is using the user process.

[0181] In this embodiment of the application, step (3) can be executed after step (2); step (3) can be executed first and then step (2); step (3) can be executed at the same time as step (2); the specific execution order of step (2) and step (3) can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0182] Step (4): Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0183] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0184] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0185] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0186] In this embodiment, the node state includes: an unused shared memory state, a shared memory in use state, and an intermediate state; wherein, the intermediate state is the state in which the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output. The shared memory in use state is the state in which the subscriber is using the target memory node or the publisher is using the target memory node.

[0187] Step (7): Reclaim and reuse the target memory node.

[0188] In this embodiment of the application, after switching the node state of the target memory node corresponding to the user identifier to the unused shared memory state, the target memory node can be reclaimed and reused.

[0189] In this embodiment, in the event of an anomaly at the publisher, the subscriber communicating with the publisher via shared memory can search for a target process with the same identifier value as the abnormal process among at least two user processes; determine the user identifier based on the target process's index; switch the user state of the target process to a crash state among at least two user states corresponding to the at least two user processes; switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state; and then reclaim and reuse the target memory node. Alternatively, in the event of an anomaly at the subscriber, the publisher communicating with the subscriber via shared memory can search for a target process with the same identifier value as the abnormal process among at least two user processes; determine the user identifier based on the target process's index; switch the user state of the target process to a crash state among at least two user states corresponding to the at least two user processes; switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state; and then reclaim and reuse the target memory node.

[0190] Example 5

[0191] This embodiment will describe the flow of another exception handling method. The specific implementation process may include the following steps (1)-(4) and steps (7)-(8):

[0192] Step (8): If an abnormal process is found to exist, determine the process identifier of the abnormal process.

[0193] In this embodiment of the application, it can be specifically determined whether the abnormal memory identifier is in an open state; if it is determined that the abnormal memory identifier is in an open state and an abnormal process is determined, then the process identifier of the abnormal process is determined.

[0194] In this embodiment of the application, determining whether the abnormal memory identifier is in an open state includes determining whether the abnormal memory identifier in the shared memory is in an open state.

[0195] In this embodiment of the application, the abnormal memory identifier can be an abnormal UUID.

[0196] It's important to note that when a UUID is opened on the subscriber side, its information is stored in a data structure. Therefore, determining whether an abnormal UUID is open is simply a matter of checking if the abnormal UUID is present in the subscriber's data structure. Only open UUIDs represent memory where actual communication has occurred and require exception handling; UUIDs that have not been opened on the subscriber side do not require exception handling.

[0197] It's important to note that when each UUID is opened on the publishing end, its information is stored in a data structure. Therefore, determining whether an abnormal UUID is open is simply a matter of checking if it's present in the publishing end's data structure. Only open UUIDs are those that have actually been used for communication and require exception handling; UUIDs that haven't been opened on the publishing end do not require exception handling.

[0198] In this application embodiment, there are multiple ways to detect the abnormal PID (process ID) after a PubSub communication node malfunctions. The specific method can be determined according to the actual situation, and this application embodiment does not limit this. For example, the underlying kernel can be used to detect whether an abnormal process exists; that is, if the underlying kernel detects an abnormal process, it is determined that an abnormal process exists.

[0199] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0200] Step (1): Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0201] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0202] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0203] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0204] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0205] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0206] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0207] Step (2): Determine the user identifier based on the index of the target process.

[0208] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0209] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0210] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0211] For example, the user identifier can be a userID.

[0212] Step (3): In at least two user states corresponding to at least two user processes, switch the user state of the target process to the crash state.

[0213] In this embodiment of the application, the user state corresponding to the target process can be determined in the BufferRefer data structure, and the user state in the BufferRefer data structure can be adjusted to a crash state.

[0214] It should be noted that the crash state can be the Crash state, which means that the process on the requesting end or the user end has crashed.

[0215] In this embodiment, the BufferRefer data structure contains a correspondence between user processes and user process states. The target user process state corresponding to the target process can be determined based on this correspondence, i.e., the user state is determined. Then, the user state in the BufferRefer data structure is switched to the crash state.

[0216] In this embodiment of the application, the user state includes: crash state, usage state, and unused state;

[0217] The "unused" state includes situations where the publisher has not built the user process or the subscriber is not using the user process. The "used" state includes situations where the publisher is using the user process or the subscriber is using the user process.

[0218] In this embodiment of the application, step (3) can be executed after step (2); step (3) can be executed first and then step (2); step (3) can be executed at the same time as step (2); the specific execution order of step (2) and step (3) can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0219] Step (4): Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0220] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0221] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0222] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0223] In this embodiment, the node state includes: an unused shared memory state, a shared memory in use state, and an intermediate state; wherein, the intermediate state is the state in which the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output. The shared memory in use state is the state in which the subscriber is using the target memory node or the publisher is using the target memory node.

[0224] Step (7): Reclaim and reuse the target memory node.

[0225] In this embodiment of the application, after switching the node state of the target memory node corresponding to the user identifier to the unused shared memory state, the target memory node can be reclaimed and reused.

[0226] In the event of a publisher-side anomaly, the subscriber communicating with the publisher via shared memory, upon identifying the existence of an abnormal process, determines the process identifier of the abnormal process. Then, based on the process identifier, it searches for a target process with the same identifier value among at least two user processes. Using the target process's index, it determines the user identifier. In at least two user states corresponding to the at least two user processes, it switches the user state of the target process to a crash state. It then switches the node state of the target memory node corresponding to the user identifier to an unused shared memory state. Finally, it reclaims and reuses the target memory node. Alternatively, in the event of a subscriber-side anomaly, the publisher communicating with the subscriber via shared memory, upon identifying the existence of an abnormal process, determines the process identifier of the abnormal process. Then, based on the process identifier, it searches for a target process with the same identifier value among at least two user processes. Using the target process's index, it determines the user identifier. In at least two user states corresponding to the at least two user processes, it switches the user state of the target process to a crash state. It then switches the node state of the target memory node corresponding to the user identifier to an unused shared memory state. Finally, it reclaims and reuses the target memory node.

[0227] In this application embodiment, there are multiple ways to detect the abnormal PID of a PubSub communication node after it malfunctions. The processing procedure after detecting the PID and combining it with data structures is as follows: Figure 4 As shown: Upon detecting an abnormal PID, the system first reads a BufferRefer data structure from shared memory, iterates through all UserPids within it to find the UserPid value that matches the abnormal PID, and obtains the index of that value, which is the abnormal UserID. Simultaneously, the corresponding UserState in the BufferRefer data structure is switched to the Crash state. After obtaining the UserID, the system retrieves the address of the first BufferNode data structure from shared memory, iterates through all BufferNodes, and switches the state of the BufferNode corresponding to the abnormal UserID to Free. Finally, the abnormal Buffer is reclaimed and reused.

[0228] In this embodiment of the application, the exception handling process for the Pub node is as follows: Figure 5As shown: First, determine whether the abnormal memory identifier is in an open state (i.e., check whether the abnormal UUID is open). If the abnormal memory identifier is in an open state (Y), further determine whether an abnormal process exists (check whether the abnormal PID exists). If an abnormal process exists (Y), determine the process identifier of the abnormal process. Based on this process identifier, search for a target process with the same identifier value as the process identifier among at least two user processes. Determine the user identifier based on the index of the target process. Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state (switch the abnormal buffer state to free).

[0229] Example 6

[0230] This embodiment will describe the flow of another exception handling method. The specific implementation process may include the following steps (1)-(4) and steps (7)-(8):

[0231] Step (8): If an abnormal process is found to exist, determine the process identifier of the abnormal process.

[0232] In this embodiment of the application, it can be specifically determined whether the abnormal memory identifier is in an open state; if it is determined that the abnormal memory identifier is in an open state and an abnormal process is determined, then the process identifier of the abnormal process is determined.

[0233] In this embodiment of the application, the abnormal memory identifier can be an abnormal UUID.

[0234] It's important to note that when a UUID is opened on the subscriber side, its information is stored in a data structure. Therefore, determining whether an abnormal UUID is open is simply a matter of checking if the abnormal UUID is present in the subscriber's data structure. Only open UUIDs represent memory where actual communication has occurred and require exception handling; UUIDs that have not been opened on the subscriber side do not require exception handling.

[0235] It's important to note that when each UUID is opened on the publishing end, its information is stored in a data structure. Therefore, determining whether an abnormal UUID is open is simply a matter of checking if it's present in the publishing end's data structure. Only open UUIDs are those that have actually been used for communication and require exception handling; UUIDs that haven't been opened on the publishing end do not require exception handling.

[0236] In this embodiment, upon determining the existence of an abnormal process, the process identifier of the abnormal process is obtained. This can be achieved by retrieving the process identifier from a database, sending an identifier information retrieval request, or obtaining the process identifier through other means. The specific method for obtaining the process identifier can be determined based on actual circumstances, and this embodiment does not limit this approach.

[0237] Step (1): Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes.

[0238] In the embodiments of this application, each of the at least two user processes has an identifier value corresponding to a process identifier. The at least two identifier values ​​corresponding to the at least two user processes can be compared with the identifier value of the process identifier. If the first identifier value among the at least two identifier values ​​is the same as the identifier value of the process identifier, then the first user process corresponding to the first identifier value is determined as the target process among the at least two user processes.

[0239] In this embodiment of the application, when the process identifier of the abnormal process is determined, the information in the BufferRefer data structure in the shared memory can be read directly, and all user processes in this information can be traversed to find the target process with the same identifier value as the abnormal process.

[0240] It should be noted that the number of abnormal processes is the same as the number of target processes.

[0241] It should also be noted that the shared memory header has a BufferRefer data structure for managing user-related states (including user states). It also achieves efficient state switching based on mutual exclusion access of the principle variables. At the same time, the use of bit-based methods makes the management structure compact and supports partial concurrent access, thus improving performance.

[0242] In this embodiment, the shared memory contains at least two user processes and their corresponding process information. The process information includes at least two process identifiers corresponding to the at least two user processes.

[0243] In the embodiments of this application, the target process is included in at least two user processes. The number of target processes is less than or equal to the number of at least two user processes.

[0244] Step (2): Determine the user identifier based on the index of the target process.

[0245] It should be noted that the index of the target process can be obtained from the database and used as the user identifier, thus determining the user identifier.

[0246] In this embodiment of the application, after determining the target process from the BufferRefer data structure, the index of the identifier value corresponding to the target index is obtained from the BufferRefer data structure, thereby obtaining the user identifier.

[0247] In this embodiment of the application, the user identifier can be information such as the user's identification number or unique code. The specific user identifier can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0248] For example, the user identifier can be a userID.

[0249] Step (3): In at least two user states corresponding to at least two user processes, switch the user state of the target process to the crash state.

[0250] In this embodiment of the application, the user state corresponding to the target process can be determined in the BufferRefer data structure, and the user state in the BufferRefer data structure can be adjusted to a crash state.

[0251] It should be noted that the crash state can be the Crash state, which means that the process on the requesting end or the user end has crashed.

[0252] In this embodiment, the BufferRefer data structure contains a correspondence between user processes and user process states. The target user process state corresponding to the target process can be determined based on this correspondence, i.e., the user state is determined. Then, the user state in the BufferRefer data structure is switched to the crash state.

[0253] In this embodiment of the application, the user state includes: crash state, usage state, and unused state;

[0254] The "unused" state includes situations where the publisher has not built the user process or the subscriber is not using the user process. The "used" state includes situations where the publisher is using the user process or the subscriber is using the user process.

[0255] In this embodiment of the application, step (3) can be executed after step (2); step (3) can be executed first and then step (2); step (3) can be executed at the same time as step (2); the specific execution order of step (2) and step (3) can be determined according to the actual situation, and this embodiment of the application does not limit it.

[0256] Step (4): Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

[0257] In this embodiment of the application, after determining the user identifier, the address of the first memory node (bufferNode) data structure can be obtained from the shared memory, and all bufferNodes can be traversed one by one to determine the target memory node corresponding to the user identifier, and the node state of the target memory node can be switched to the unused shared memory state.

[0258] It should be noted that the unused shared memory state can be the Free state, which means that the sending end is not using the target memory node or the receiving end is not using the target memory node.

[0259] It should also be noted that by switching the node state of the target memory node to an unused shared memory state, the target memory node can be requested and used again by the sender or receiver.

[0260] In this embodiment, the node state includes: an unused shared memory state, a shared memory in use state, and an intermediate state; wherein, the intermediate state is the state in which the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output. The shared memory in use state is the state in which the subscriber is using the target memory node or the publisher is using the target memory node.

[0261] Step (5): Determine whether the node state of each memory node in the shared memory is unused shared memory.

[0262] In this embodiment, the shared memory includes at least three memory nodes, and the target memory node is among the at least three memory nodes. The states of at least three nodes corresponding to the at least three memory nodes in the shared memory can be determined, that is, the node state of each memory node in the shared memory can be determined.

[0263] It should be noted that there is a one-to-one correspondence between at least three memory nodes and at least three node states, that is, one memory node corresponds to one node state.

[0264] Step (6): When the node state of each memory node in the shared memory is the unused shared memory state, close the shared memory.

[0265] In this embodiment of the application, the shared memory is closed when the node state of each memory node in the shared memory is the unused shared memory state, that is, when the node state corresponding to all memory nodes in the shared memory is the unused shared memory state.

[0266] Step (7): Reclaim and reuse the target memory node.

[0267] In this embodiment of the application, after switching the node state of the target memory node corresponding to the user identifier to the unused shared memory state, the target memory node can be reclaimed and reused.

[0268] In this embodiment, when the publisher is abnormal, the subscriber communicating with the publisher via shared memory determines the process identifier of the abnormal process upon identifying its existence. Then, based on the process identifier, it searches for a target process with the same identifier value among at least two user processes. The subscriber identifies the user based on the target process's index. In at least two user states corresponding to the at least two user processes, the subscriber switches the target process's user state to a crash state. The subscriber switches the target memory node's node state to an unused shared memory state. It then determines whether the node state of each memory node in the shared memory is unused shared memory. If the node state of each memory node in the shared memory is unused shared memory, the shared memory is closed. Finally, the target memory node is reclaimed and reused.

[0269] In this embodiment of the application, the exception handling process for the Sub node is as follows: Figure 6 As shown: First, determine if the abnormal memory identifier is in an open state (i.e., check if the abnormal UUID is open). If the abnormal memory identifier is in an open state (Y), further determine if an abnormal process exists (check if the abnormal PID exists). If an abnormal process exists (Y), determine the process identifier of the abnormal process. Based on this process identifier, search for a target process with the same identifier value among at least two user processes. Determine the user identifier based on the index of the target process. Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state. Then, determine if the node state of each memory node in the shared memory is the unused shared memory state (check if all buffers are in the free state). If the node state of each memory node in the shared memory is the unused shared memory state (Y), close the shared memory (close the shared resource pool).

[0270] Example 7

[0271] Based on the same inventive concept as the above-mentioned exception handling method, this application provides an exception handling device 1, corresponding to an exception handling method; Figure 7 This is a schematic diagram of the composition structure of an exception handling device provided in an embodiment of this application. The exception handling device 1 may include:

[0272] The search unit 11 is used to search for a target process with the same identifier value as the process identifier among at least two user processes based on the process identifier of the abnormal process.

[0273] The determining unit 12 is used to determine the user identifier based on the index of the target process;

[0274] The switching unit 13 is used to switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state.

[0275] In some embodiments of this application, the switching unit 13 is further configured to switch the user state of the target process to a crash state in at least two user states corresponding to the at least two user processes.

[0276] In some embodiments of this application, the user state includes: the crash state, the usage state, and the unused state;

[0277] The unused state includes situations where the publisher has not built the user process or the subscriber has not used the user process.

[0278] In some embodiments of this application, the node state includes: the unused shared memory state, the shared memory in use state, and the intermediate state;

[0279] The intermediate state is either the state where the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output.

[0280] In some embodiments of this application, the device further includes a shut-off unit;

[0281] The determining unit 12 is used to determine whether the node state of each memory node in the shared memory is the unused shared memory state;

[0282] The shutdown unit is used to shut down the shared memory when the node state of each memory node in the shared memory is the unused shared memory state.

[0283] In some embodiments of this application, the apparatus further includes a recycling unit and a usage unit;

[0284] The recycling unit is used to reclaim the target memory node.

[0285] The usage unit is used to use the target memory node.

[0286] In some embodiments of this application, the determining unit 12 is used to determine the process identifier of the abnormal process when it is determined that an abnormal process exists.

[0287] In some embodiments of this application, the determining unit 12 is used to determine whether the abnormal memory identifier is in an open state; if it is determined that the abnormal memory identifier is in an open state and an abnormal process is determined to exist, the process identifier of the abnormal process is determined.

[0288] It should be noted that, in practical applications, the aforementioned search unit 11, determination unit 12, and switching unit 13 can be implemented by the processor 14 on the exception handling device, specifically by a CPU (Central Processing Unit), MPU (Microprocessor Unit), DSP (Digital Signal Processor), or Field Programmable Gate Array (FPGA); the aforementioned data storage can be implemented by the memory 15 on the exception handling device.

[0289] This application also provides an exception handling device, such as... Figure 8 As shown, the exception handling device includes a processor 14, a memory 15, and a communication bus 16. The memory 15 communicates with the processor 14 through the communication bus 16. The memory 15 stores programs executable by the processor 14. When the program is executed, the exception handling method described above is executed by the processor 14.

[0290] In practical applications, the aforementioned memory 15 can be volatile memory, such as random-access memory (RAM); or non-volatile memory, such as read-only memory (ROM), flash memory, hard disk drive (HDD), or solid-state drive (SSD); or a combination of the above types of memory, and provide instructions and data to the processor 14.

[0291] This application provides a computer program product including a computer program or computer-executable instructions stored in a computer-readable storage medium. The processor of an exception handling device reads the computer-executable instructions from the computer-readable storage medium and executes the computer-executable instructions, causing the exception handling device to perform the exception handling method described in this application.

[0292] This application provides a computer-readable storage medium storing computer-executable instructions. When these computer-executable instructions are executed by a processor, they cause the processor to execute the exception handling method provided in this application. For example, ... Figure 1 The exception handling method is shown.

[0293] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEP ROM, flash memory, magnetic surface memory, optical disk, or CD-ROM; or it may be a variety of devices including one or any combination of the above-mentioned memories.

[0294] In some embodiments, computer-executable instructions may take the form of programs, software, software modules, scripts, or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as stand-alone programs or as modules, components, subroutines, or other units suitable for use in a computing environment.

[0295] As an example, computer-executable instructions may, but do not necessarily, correspond to files in a file system. They may be stored as part of a file that holds other programs or data, for example, in one or at least two scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in at least two collaborative files (e.g., files that store one or at least two modules, subroutines, or code sections).

[0296] Understandably, the exception handling device searches for the target process corresponding to the process identifier of the exception process among at least two user processes. Based on the index of the target process, it obtains the user identifier and switches the node state of the target memory node corresponding to the user identifier to an unused shared memory state. This allows the publisher or subscriber to reclaim and reuse the shared memory corresponding to the target memory node by adjusting the node state of the target memory node to an unused shared memory state in the event of an exception on the subscriber or publisher side. This enables the publisher to rewrite to the shared memory or the subscriber to resubscribe to the shared memory without having to create and switch to a new shared memory, thus reducing system performance degradation.

[0297] Those skilled in the art will understand that embodiments of this application can be provided as methods, systems, or computer program products. Therefore, this application can take the form of hardware embodiments, software embodiments, or embodiments combining software and hardware aspects. Furthermore, this application can take the form of a computer program product implemented on one or at least two computer-usable storage media (including, but not limited to, disk storage and optical storage) containing computer-usable program code.

[0298] This application is described with reference to flowchart illustrations and / or block diagrams of methods, apparatus (systems), and computer program products according to embodiments of this application. It will be understood that each block of the flowchart illustrations and / or block diagrams, and combinations of blocks in the flowchart illustrations and / or block diagrams, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, special-purpose computer, embedded processor, or other programmable data processing apparatus to produce a machine, such that the instructions, which execute via the processor of the computer or other programmable data processing apparatus, generate instructions for implementing the flowchart... Figure 1 One process or at least two processes and / or boxes Figure 1 A device that provides the function specified in one or at least two boxes.

[0299] These computer program instructions may also be stored in a computer-readable storage medium that can direct a computer or other programmable data processing device to function in a particular manner, such that the instructions stored in the computer-readable storage medium produce an article of manufacture including instruction means, which are implemented in a process Figure 1 One process or at least two processes and / or boxes Figure 1 The function specified in one or at least two boxes.

[0300] These computer program instructions may also be loaded onto a computer or other programmable data processing equipment to cause a series of operational steps to be performed on the computer or other programmable equipment to produce a computer-implemented process, thereby providing instructions that execute on the computer or other programmable equipment for implementing the process. Figure 1 One process or at least two processes and / or boxes Figure 1 The steps of the function specified in one or at least two boxes.

[0301] The above description is merely a preferred embodiment of this application and is not intended to limit the scope of protection of this application. Any modifications, equivalent substitutions, and improvements made within the spirit and scope of this application are included within the scope of protection of this application.

Claims

1. An exception handling method, characterized in that, The method includes: Based on the process identifier of the abnormal process, find the target process with the same identifier value as the process identifier among at least two user processes; Determine the user identifier based on the index of the target process; Switch the node state of the target memory node corresponding to the user identifier to the unused shared memory state.

2. The method according to claim 1, characterized in that, Before switching the node state of the target memory node corresponding to the user identifier to the unused shared memory state, the method further includes: In at least two user states corresponding to the at least two user processes, the user state of the target process is switched to a crash state.

3. The method according to claim 2, characterized in that, The user status includes: the crash status, the usage status, and the unused status; The unused state includes situations where the publisher has not built the user process or the subscriber has not used the user process.

4. The method according to any one of claims 1-3, characterized in that, The node states include: the unused shared memory state, the shared memory in use state, and the intermediate state; The intermediate state is either the state where the subscriber has requested shared memory or the shared memory has not been delivered to the subscriber in the queue output.

5. The method according to any one of claims 1-4, characterized in that, After switching the node state of the target memory node corresponding to the user identifier to an unused shared memory state, the method further includes: Determine whether the node state of each memory node in the shared memory is the unused shared memory state; If the node state of each memory node in the shared memory is the unused shared memory state, then the shared memory is closed.

6. The method according to any one of claims 1-5, characterized in that, After switching the node state of the target memory node corresponding to the user identifier to an unused shared memory state, the method further includes: The target memory node is reclaimed and reused.

7. The method according to any one of claims 1-6, characterized in that, Before searching for a target process with the same identifier value as the abnormal process identifier among at least two user processes, the method further includes: If an abnormal process is identified, the process identifier of the abnormal process is determined.

8. The method according to any one of claims 7, characterized in that, The step of determining the process identifier of the abnormal process when an abnormal process is identified includes: Determine if the abnormal memory flag is enabled; If it is determined that the abnormal memory identifier is in an open state and an abnormal process is identified, the process identifier of the abnormal process is determined.

9. An anomaly handling device, characterized in that, The device includes: The search unit is used to search for a target process with the same identifier value as the process identifier among at least two user processes based on the process identifier of the abnormal process. The determining unit is used to determine the user identifier based on the index of the target process; The switching unit is used to switch the node state of the target memory node corresponding to the user identifier to an unused shared memory state.

10. An anomaly handling device, characterized in that, The device includes: Memory is used to store executable instructions for a computer; A processor, when executing computer-executable instructions stored in the memory, implements the exception handling method according to any one of claims 1 to 8.

11. A computer-readable storage medium storing computer-executable instructions, characterized in that, When the computer-executable instructions are executed by a processor, they implement the method described in any one of claims 1 to 8.

12. A computer program product comprising computer-executable instructions or a computer program, characterized in that, When the computer-executable instructions or computer program are executed by a processor, they implement the method according to any one of claims 1 to 8.