CN112035289A - Method and device for determining data block leakage, storage medium and electronic device - Google Patents

Method and device for determining data block leakage, storage medium and electronic device Download PDF

Info

Publication number
CN112035289A
CN112035289A CN202010917315.8A CN202010917315A CN112035289A CN 112035289 A CN112035289 A CN 112035289A CN 202010917315 A CN202010917315 A CN 202010917315A CN 112035289 A CN112035289 A CN 112035289A
Authority
CN
China
Prior art keywords
data block
state information
determining
abnormal
current
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010917315.8A
Other languages
Chinese (zh)
Inventor
李香林
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Dahua Technology Co Ltd
Original Assignee
Zhejiang Dahua Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Dahua Technology Co Ltd filed Critical Zhejiang Dahua Technology Co Ltd
Priority to CN202010917315.8A priority Critical patent/CN112035289A/en
Publication of CN112035289A publication Critical patent/CN112035289A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0751Error or fault detection not based on redundancy
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/07Responding to the occurrence of a fault, e.g. fault tolerance
    • G06F11/0703Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation
    • G06F11/0706Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment
    • G06F11/073Error or fault processing not based on redundancy, i.e. by taking additional measures to deal with the error or fault not making use of redundancy in operation, in hardware, or in data representation the processing taking place on a specific hardware platform or in a specific software environment in a memory management context, e.g. virtual memory or cache management

Abstract

The invention provides a method and a device for determining data block leakage, a storage medium and an electronic device, wherein the method for determining the data block leakage comprises the following steps: acquiring current state information of the data block, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating a current attribution process of the data block, and the second state information is used for indicating a target attribution process of the data block; and determining whether the data block leaks according to the state information of the data block and the process abnormal condition. The method can find the leaked data blocks in time, thereby solving the problem that the leakage of the data blocks cannot be determined in time in the related technology, and achieving the technical effects of determining the leakage of the data blocks in time and guaranteeing the normal operation of the system.

Description

Method and device for determining data block leakage, storage medium and electronic device
Technical Field
The present invention relates to the field of communications, and in particular, to a method and an apparatus for determining data block leakage, a storage medium, and an electronic apparatus.
Background
In a Linux environment, such as the Linux environment of embedded security products, data blocks, such as image data blocks, can be circulated inside the device. Linux is used as a multi-process operating system, and allows services to be deployed and realized in a multi-process mode. Data blocks are circulated between processes as memory data having a specific meaning.
And after the data block is acquired by the Linux user mode process, the data block is transmitted and used among the processes. Data blocks can be repeatedly used as limited memory resources in embedded security products, such as YUV image data blocks, where YUV is a kind of compiled true-color space (color space), and the proper terms such as Y' UV, YUV, YCbCr, YPbPr, etc. can all be called YUV and overlap with each other. "Y" represents brightness (Luma) or gray scale value, and "U" and "V" represent Chroma (Chroma or Chroma) and are used to describe the color and saturation of the image for specifying the color of the pixel. Therefore, the life cycle of a frame of YUV image data is the process of "applying, circulating, using … … to release", and when an abnormal condition occurs in a data block in the circulation process, for example, an abnormality (for example, exit) occurs in a certain process in a circulating link, the data block cannot be continuously transferred to a release link, so that leakage of the data block is caused. In such a scenario, although it can be presumed that an abnormal situation may cause leakage of a data block, it is not known which data block has leaked at what time, and the leaked data block cannot be processed in time, thereby affecting normal operation of the system. For example, the patent with publication number CN105446871B provides a method, an apparatus, and a system for detecting resource leakage, and the main disadvantage of the design is that the judgment is performed by the growth trend and the trigger threshold, the method can only perform the early warning of resource leakage, and when the condition of the trigger threshold is satisfied, the data block leakage has occurred in the system for a long time, so the problem of resource leakage is not effectively solved in the patent. Also, for example, patent publication No. CN107957950A provides a method and an apparatus for detecting system resource leakage, and the main drawback of the design is that the process suspected of resource leakage is restarted to recover resources, but if the process is restarted, leakage still occurs, and only a different restart-recovery cycle is performed, and the problem of resource leakage is not effectively solved.
Aiming at the problem that the leakage of the data block cannot be determined in time in the related technology, no better solution exists yet.
Disclosure of Invention
The embodiment of the invention provides a method and a device for determining data block leakage, a storage medium and an electronic device, which are used for at least solving the problem that the data block leakage cannot be determined in time in the related technology.
According to an embodiment of the present invention, there is provided a method for determining data block leakage, including:
acquiring current state information of a data block, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating a current home process of the data block, and the second state information is used for indicating a target home process of the data block;
and determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
According to another embodiment of the present invention, an apparatus for determining a block leakage, includes:
a first obtaining module, configured to obtain current state information of a data block, where the state information includes first state information and/or second state information, where the first state information is used to indicate a current home process of the data block, and the second state information is used to indicate a target home process of the data block;
and the determining module is used for determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
According to a further embodiment of the present invention, there is also provided a storage medium having a computer program stored therein, wherein the computer program is arranged to perform the steps of any of the above method embodiments when executed.
According to yet another embodiment of the present invention, there is also provided an electronic device, including a memory in which a computer program is stored and a processor configured to execute the computer program to perform the steps in any of the above method embodiments.
According to the embodiment of the invention, the current state information of the data block is obtained, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating the current home process of the data block, and the second state information is used for indicating the target home process of the data block; and determining whether the data block leaks according to the state information and the process abnormal condition of the data block, and finding the leaked data block in time, so that the problem that the leakage of the data block cannot be determined in time in the related technology can be solved, and the technical effects of determining the leakage of the data block in time and ensuring the normal operation of a system are achieved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
fig. 1 is a block diagram of a hardware structure of a mobile terminal of a method for determining data block leakage according to an embodiment of the present invention;
FIG. 2 is a flow chart of a method of determining data block leakage according to an embodiment of the present invention;
fig. 3 is a block diagram of the structure of a data block leakage determination apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic diagram of a data block streaming process according to an example embodiment of the invention;
FIG. 5 is a schematic diagram of a process by which a monitoring module maintains data block information according to an example embodiment of the invention;
fig. 6 is a first way of obtaining data block information according to an example embodiment of the present invention;
FIG. 7 is a second way of obtaining data block information according to an example embodiment of the present invention;
fig. 8 is a diagram illustrating a change in state information of a data block during a data block streaming process according to an exemplary embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
The method provided by the embodiment of the application can be executed in a mobile terminal, a computer terminal, a monitoring camera or a similar arithmetic device. Taking the example of being operated on a computer terminal, fig. 1 is a hardware structure block diagram of a computer terminal of a method for determining data block leakage according to an embodiment of the present invention. As shown in fig. 1, the computer terminal may include one or more (only one shown in fig. 1) processors 102 (the processors 102 may include, but are not limited to, a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, and in one example, may also include a transmission device 106 for communication functions and an input-output device 108. It will be understood by those skilled in the art that the structure shown in fig. 1 is only an illustration and is not intended to limit the structure of the computer terminal. For example, the computer terminal may also include more or fewer components than shown in FIG. 1, or have a different configuration than shown in FIG. 1.
The memory 104 may be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to the method for determining the data block leakage in the embodiment of the present invention, and the processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, so as to implement the method described above. The memory 104 may include high speed random access memory, and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include memory located remotely from the processor 102, which may be connected to a computer terminal over a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The transmission device 106 is used for receiving or transmitting data via a network. Specific examples of the network described above may include a wireless network provided by a communication provider of the computer terminal. In one example, the transmission device 106 includes a Network adapter (NIC), which can be connected to other Network devices through a base station so as to communicate with the internet. In one example, the transmission device 106 may be a Radio Frequency (RF) module, which is used for communicating with the internet in a wireless manner.
In this embodiment, a method for determining a data block leakage running in the computer terminal is provided, and fig. 2 is a flowchart of the method for determining a data block leakage according to an embodiment of the present invention, as shown in fig. 2, the flowchart includes the following steps:
step S202, acquiring current state information of a data block, wherein the state information includes first state information and/or second state information, the first state information is used for indicating a current home process of the data block, and the second state information is used for indicating a target home process of the data block;
step S204, determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
Through the steps, the current state information of the data block is obtained, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating the current home process of the data block, and the second state information is used for indicating the target home process of the data block; and determining whether the data block leaks according to the state information of the data block and the process abnormal condition. The method can find the leaked data blocks in time, thereby solving the problem that the leakage of the data blocks cannot be determined in time in the related technology, and achieving the technical effects of determining the leakage of the data blocks in time and guaranteeing the normal operation of the system.
It should be noted that a data block represents a memory whose content is data. The current home process for a data block may refer to the current holder of the data block, i.e., the process currently using the data block. The target owning process for a data block may refer to the process that applies for using the data block, i.e., the process that does not currently hold the data block but needs to hold the data block in the future, e.g., may be the next process that needs to hold the data block. It should be noted that, in general, one data block can be held by only one process at a time, and therefore, when a certain process holds a certain data block, it is impossible for other processes to hold the certain data block.
In one example, the determining whether the data block leaks according to the state information of the data block and a process exception condition includes:
determining that the data block leaks if the status information includes the first status information and the second status information and at least one of:
the process exception condition indicates that the current home process corresponding to the first state information is abnormal, and the process exception condition indicates that the target home process corresponding to the second state information is abnormal.
In one example, the determining whether the data block leaks according to the state information of the data block and a process exception condition includes: and determining that the data block is not leaked under the condition that the state information comprises the first state information and the second state information, and the process abnormal condition indicates that the current home process corresponding to the first state information is not abnormal and the target home process corresponding to the second state information is not abnormal.
In one example, the determining whether the data block leaks according to the state information of the data block and a process exception condition includes: and determining that the data block leaks when the state information only comprises the first state information and the process exception condition indicates that the current home process corresponding to the first state information is abnormal.
In one example, the determining whether the data block leaks according to the state information of the data block and a process exception condition includes: and determining that the data block is not leaked when the state information only comprises the first state information and the process exception condition indicates that the current home process corresponding to the first state information is not abnormal.
In one example, where the state information includes the first state information and the data block is used by a first process, the first state information of the data block is a process identification of the first process, the process identification to uniquely identify the first process;
in one example, where the status information includes the first status information and the data block is not used by a process, the first status information of the data block is a null value, where the null value indicates that the data block is not currently used.
In one example, in a case that the state information includes the second state information, and a second process applies for using the data block and the second process has not received the data block, the second state information is a process identification of the second process, the process identification being used to uniquely identify the second process;
in one example, the status information includes the second status information, and the second status information is a null value in a case where no third process applies for using the data block, wherein the null value is used to indicate that no process needs to continue using the data block.
It should be noted that, if the first status information and the second status information of a certain data block are both null values, it indicates that the data block is not attributed to any process, i.e., the data block is not held by a process. The above data block is used by the process to indicate that the process actually "holds" the data block, or that the process is the "holder" of the data block.
In one example, the obtaining the current state information of the data block includes: receiving the state information reported by the current attribution process of the data block; or, the state information of the data block is queried.
In one example, before the determining whether the data block leaks according to the state information of the data block and a process exception condition, the method further comprises:
acquiring the process exception condition by at least one of the following modes:
inquiring whether the current attribution process of the data block is alive or not;
determining whether a registration exception signal is received, wherein the registration exception signal is used for indicating that the current home process of the data block is abnormal in registration;
receiving a process exit signal, wherein the process exit signal is used for indicating the process to exit.
In one example, the method further comprises: and after determining that the data block leaks, recycling the data block.
Through the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but the former is a better implementation mode in many cases. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (e.g., a mobile phone, a computer, a server, or a network device) to execute the method according to the embodiments of the present invention.
In this embodiment, a device for determining data block leakage is further provided, where the device is used to implement the foregoing embodiments and preferred embodiments, and details are not repeated for what has been described. As used below, the term "module" may be a combination of software and/or hardware that implements a predetermined function. Although the means described in the embodiments below are preferably implemented in software, an implementation in hardware, or a combination of software and hardware is also possible and contemplated.
Fig. 3 is a block diagram of a structure of an apparatus for determining a block leakage according to an embodiment of the present invention, as shown in fig. 3, the apparatus including:
a first obtaining module 31, configured to obtain current state information of a data block, where the state information includes first state information and/or second state information, where the first state information is used to indicate a current home process of the data block, and the second state information is used to indicate a target home process of the data block;
the determining module 33 is configured to determine whether the data block is leaked according to the state information of the data block and a process exception condition.
Through the steps, the current state information of the data block is obtained, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating the current home process of the data block, and the second state information is used for indicating the target home process of the data block; and determining whether the data block leaks according to the state information of the data block and the process abnormal condition. The method can find the leaked data blocks in time, thereby solving the problem that the leakage of the data blocks cannot be determined in time in the related technology, and achieving the technical effects of determining the leakage of the data blocks in time and guaranteeing the normal operation of the system.
The determining module is further configured to determine that the data block leaks if the status information includes the first status information and the second status information and at least one of the following occurs:
the process exception condition indicates that the current home process corresponding to the first state information is abnormal, and the process exception condition indicates that the target home process corresponding to the second state information is abnormal;
alternatively, the first and second electrodes may be,
exemplarily, the determining module is further configured to determine that the data block is not leaked when the state information includes the first state information and the second state information, and the process exception condition indicates that the current home process corresponding to the first state information is not abnormal and the target home process corresponding to the second state information is not abnormal.
Exemplarily, the determining module is further configured to determine that the data block leaks when the state information only includes the first state information and the process exception condition indicates that the current home process corresponding to the first state information is abnormal;
alternatively, the first and second electrodes may be,
exemplarily, the determining module is further configured to determine that the data block is not leaked when the state information only includes the first state information and the process exception condition indicates that the current home process corresponding to the first state information is not abnormal.
Illustratively, in a case where the state information includes the first state information and the data block is used by a first process, the first state information of the data block is a process identification of the first process, the process identification being used to uniquely identify the first process;
illustratively, in a case where the status information includes the first status information and the data block is not used by a process, the first status information of the data block is a null value, wherein the null value is used to indicate that the data block is not currently used.
Exemplarily, in a case that the state information includes the second state information, and a second process applies for using the data block and the second process has not received the data block, the second state information is a process identifier of the second process, the process identifier is used for uniquely identifying the second process;
illustratively, in a case where the status information includes the second status information and no third process applies for using the data block, the second status information is a null value, where the null value is used to indicate that no process needs to continue using the data block.
Exemplarily, the first obtaining module is configured to receive the state information reported by a current home process of the data block; or, the first obtaining module is configured to query the status information of the data block.
Illustratively, the apparatus further comprises:
a second obtaining module, configured to obtain the process exception condition in at least one of the following manners before determining whether the data block leaks according to the state information of the data block and the process exception condition:
inquiring whether the current attribution process of the data block is alive or not;
determining whether a registration exception signal is received, wherein the registration exception signal is used for indicating that the current home process of the data block is abnormal in registration;
receiving a process exit signal, wherein the process exit signal is used for indicating the process to exit.
Illustratively, the apparatus further comprises:
and the recovery module is used for recovering the data block after determining that the data block leaks.
It should be noted that, the above modules may be implemented by software or hardware, and for the latter, the following may be implemented, but not limited to: the modules are all positioned in the same processor; alternatively, the modules are respectively located in different processors in any combination.
Example embodiments
The following further explains embodiments of the present invention with reference to specific scenarios.
The flow of the complete scheme for complete tracking and leakage of a resource is explained as follows: and in the process from application to circulation to final release, the matching mode of each related module.
The embodiment defines an owner state of the resource, and the owner of the resource is characterized by the owner state of the resource. And is marked with two states curr-owner and next-owner.
curr-owner ═ a; next-owner ═ null: the holder is A;
curr-owner ═ null; next-owner ═ B: a data transmission link in circulation;
curr-owner ═ B; next-owner ═ null: the data arrives at B and confirms the holder as B;
by adopting the double-marking method, the data leakage can be timely and accurately identified when the process B is abnormal in the data streaming link (namely the data is not held by any process).
It should be noted that if a single tag is used, for example, only the holder of the data is tagged, since it is not known clearly who the next process is, when the next process is abnormal, the data can only be considered to be still in transmission.
This embodiment describes a maintenance method for an owner state, which includes:
when a resource applies, setting the initial state of the resource curr-owner as a process identifier of an applicant;
in the process of resource transmission, the curr-owner of the data is marked as null by the current holding process of the resource, and the next-owner is set as a target process of the transmission;
when the receiving process confirms the receiving, the curr-owner of the resource is marked as the curr-owner of the resource, and the next-owner is set to null;
when the resource is transferred to the last user, the releasing operation is carried out after the resource is used, and at the moment, the curr-opener is set to null;
table 1 is an illustration of a resource leakage determination method according to curr-owner/next-owner, as shown in table 1:
Figure BDA0002665468450000111
Figure BDA0002665468450000121
TABLE 1
Exemplarily, the present embodiment provides a scheme based on data block state management based on environmental characteristics of a Linux operating system, and cooperates with a state marking method of a data block in a streaming process, and an independent management module may monitor all data blocks, and fig. 4 is a schematic diagram of a data block streaming process according to an exemplary embodiment of the present invention, as shown in fig. 4:
in this embodiment, a data block monitoring module (hereinafter referred to as a "monitoring module") is designed, and when a process needs to apply or release a data block, information of the data block is intercepted, for example, information of applying or releasing the data block is obtained, and information of the data block is maintained.
In an example, fig. 5 is a schematic process diagram of a monitoring module maintaining data block information according to an example embodiment of the present invention, and as shown in fig. 5, when a process performs an application or release operation on a data block, the monitoring module maintains the information of the data block according to the information of the application or release of the data block, where the maintained information of the data block may include at least one of: data block address, data block size, data block application process identification (i.e., identification of the process applying for use of the data block, corresponding to the "target home process" in the above-described embodiment), and identification of the process currently using the data block (corresponding to the "current home process" in the above-described embodiment). The identifier of the application process may be information capable of uniquely identifying the process, such as a process ID of the process.
It should be noted that the data block is stored in the memory, and the data block can be found according to the data block address.
For example, to obtain the information of the data block, the following method may be adopted: exemplarily, one is the method shown in fig. 6, fig. 6 is a first manner of obtaining data block information according to the exemplary embodiment of the present invention, and as shown in fig. 6, the data block Provider actively reports in an Application Programming Interface (API) for release, which is provided to notify the data block monitoring module; illustratively, the data block provider may be linux os. Another is the method shown in fig. 7, and fig. 7 is a second method for acquiring data block information according to the exemplary embodiment of the present invention, and as shown in fig. 7, an application process of a data block actively reports the information to a data block monitoring module. For another example, a dynamic replacement mode during program runtime may be adopted to intercept application and/or release information, such as: function symbol replacement is carried out by using a-wrap option mode of gcc; if the application function is realized in the so dynamic library, a plt table modifying mode can be adopted; it should be noted that, when calling the apply/release function, the user can add some operations in the apply/release process, and if the apply/release function is released, the user can inform the detection module that the data block can be released, and if the detect module is not used by any person, the data block can be removed from the monitored table without being detected.
Illustratively, the state of the data block information may be tracked to determine which process the memory block owner is in the current data block, and the data block state may include an identification of the process currently using the database.
Illustratively, when a data block is applied for use by other processes, the owner (owner) to which the data block belongs becomes the process for which the data block is applied for use; when a data block is streamed, the scenario is as shown in fig. 8, and fig. 8 is a schematic diagram of a change of state information of the data block during a data block streaming process according to an exemplary embodiment of the present invention:
when the data block is circulated, the holder (curr-owner) of the data block is changed, and in the process, the owner state transition information of the data block is as follows:
a) after the process A applies for the data block, the current holder curr-owner of the data block is A;
b) determining that the data block is not operated any more by the process A, and preparing to transmit the data block to the process B; the holder state of the data block is curr-owner ═ null; next-owner ═ B;
it should be noted that it is already clear that the data block is irrelevant to the process a, so any problem occurs in the data block and is irrelevant to the process a; meanwhile, any exception occurs in the process A, and no influence is caused on the data block; the data block is ready to be transferred to the process B, but the process B has not formally received the data block, so that the owner of the data block is about to be the process B, but the owner is not the process B at this time;
c) the process B receives the data block and definitely wants to start using, and the holder state of the data block is curr-owner ═ B at this time; next-owner ═ null;
d) the data block is circulated to the subsequent process according to the service requirement until a certain process X confirms that the data block can be released (or destroyed), and the process X modifies the state of the data block into curr-winner ═ null; next-winner ═ null. And performs a release operation.
Alternatively, the policy method for determining the data block leakage may be: the monitoring module obtains information of the owner and a state corresponding to a owner process, wherein a matrix is determined according to curr-owner and next-owner, table 2 shows three states indicating data block flowing between a process A and a process B, and in the three states, a matrix indication of leakage is determined when the following exceptions occur:
Figure BDA0002665468450000141
TABLE 2
Table 3 below is a schematic based on the curr-owner decision matrix, as shown in table 3:
Figure BDA0002665468450000142
Figure BDA0002665468450000151
TABLE 3
In this embodiment, the two tables 2 or 3 may be used for determining, where in the process of transferring data from a to B in table 2, if an abnormality occurs in process B, the data block will stay in a state where curr-owner is null because there is no receiver, and it cannot be determined whether the data block is in the process of transmission or whether there is no receiver because B exits, and it is necessary to use other auxiliary means to determine whether the data block leaks.
For example, the monitoring module determines whether the data block is leaked through the decision matrix of table 1, wherein the monitoring module must be able to obtain information about the current owner of each monitored data block. Alternatively, information of the owner can be obtained by the following method:
a) the monitoring module provides a function or a protocol, and the function or the protocol is actively called by the using process of the data block, and the function or the protocol provided by the monitoring module is called to report the state information to the monitoring module; the monitoring module updates the content of the self-maintained data block information table;
b) the data block has a fixed data structure head description, and the user process of the data block can modify the contents of curr-owner and next-owner in the head structure;
in order to monitor the abnormal state of the data block-owner process, the monitoring module may use the following schemes:
a) the monitoring module checks whether the owner process still survives by adopting a timing query mode, such as: methods to view Linux/proc/< pid >;
b) the data block uses the process, register the abnormal signal, when receiving the abnormal signal, notify the monitoring module in the signal processing function immediately, the response speed of time delay under the enhancement polling mode;
c) and informing the monitoring module from the exit flow of the Task in the Task management module of the Linux operating system, such as: the process exit signals sigchild to the parent process, and at the point of sigchild issuance, a notification signal is also issued to the monitoring module.
The method of a) adopts polling to ensure that the abnormal exit of the process is ensured and must be collected; b) and c) the problem of delay caused by polling in the method a) is solved, and the timeliness of resource recovery is improved.
Optionally, the resource is determined to be leaked and then the resource is forcibly released and recovered, for example, when it is determined that one data block is leaked, the monitoring module may directly recover the corresponding data block.
It should be noted that the resource monitoring module in this embodiment may be integrated in the data block Provider, or may be an independent process and an independent driving module.
Compared with the prior art of counting the resource use condition of a single process, the method solves the problem of resource leakage on a system with cooperation of a plurality of processes; although the resource occupation conditions of all processes are counted from the whole system in the related technology, the problem that the resources are exclusively used by the private resources of each process is solved, and the problem of resource leakage in the use scene of resource circulation among multiple processes cannot be solved;
in this embodiment, resources are circulated among processes, and whether the resources are held in each process as an entity or not does not reflect continuous improvement of the occupancy rate of the resources, and particularly, the memory resources may include the resources in the memory space among the processes, but the holder does not belong to the process at a certain time. From the perspective of Linux, the resource occupancy rate is not an increased data embodiment.
In this embodiment, after the leakage of the resource is monitored, the resource needs to be recovered, so as to ensure that other processes unrelated to the process with the resource leakage can be reused. Especially, under the scene that multiple services exist in the system, one service consists of multiple processes, and when a certain process of a certain service is abnormal, resource leakage occurs, and the service can be used by other services after resource recovery is well done.
Embodiments of the present invention also provide a computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to perform the steps of any of the above method embodiments when executed.
Alternatively, in the present embodiment, the storage medium may be configured to store a computer program for executing the steps of:
s1, acquiring current state information of a data block, where the state information includes first state information and/or second state information, where the first state information is used to indicate a current home process of the data block, and the second state information is used to indicate a target home process of the data block;
s2, determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
Through the steps, the current state information of the data block is obtained, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating the current home process of the data block, and the second state information is used for indicating the target home process of the data block; and determining whether the data block leaks according to the state information of the data block and the process abnormal condition. The method can find the leaked data blocks in time, thereby solving the problem that the leakage of the data blocks cannot be determined in time in the related technology, and achieving the technical effects of determining the leakage of the data blocks in time and guaranteeing the normal operation of the system.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
Optionally, in this embodiment, the storage medium may include, but is not limited to: various media capable of storing computer programs, such as a usb disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a removable hard disk, a magnetic disk, or an optical disk.
Embodiments of the present invention also provide an electronic device comprising a memory having a computer program stored therein and a processor arranged to run the computer program to perform the steps of any of the above method embodiments.
Optionally, the electronic apparatus may further include a transmission device and an input/output device, wherein the transmission device is connected to the processor, and the input/output device is connected to the processor.
Optionally, in this embodiment, the processor may be configured to execute the following steps by a computer program:
s1, acquiring current state information of a data block, where the state information includes first state information and/or second state information, where the first state information is used to indicate a current home process of the data block, and the second state information is used to indicate a target home process of the data block;
s2, determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
Through the steps, the current state information of the data block is obtained, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating the current home process of the data block, and the second state information is used for indicating the target home process of the data block; and determining whether the data block leaks according to the state information of the data block and the process abnormal condition. The method can find the leaked data blocks in time, thereby solving the problem that the leakage of the data blocks cannot be determined in time in the related technology, and achieving the technical effects of determining the leakage of the data blocks in time and guaranteeing the normal operation of the system.
Optionally, the specific examples in this embodiment may refer to the examples described in the above embodiments and optional implementation manners, and this embodiment is not described herein again.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the principle of the present invention should be included in the protection scope of the present invention.

Claims (11)

1. A method for determining data block leakage, comprising:
acquiring current state information of a data block, wherein the state information comprises first state information and/or second state information, the first state information is used for indicating a current home process of the data block, and the second state information is used for indicating a target home process of the data block;
and determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
2. The method of claim 1, wherein determining whether the data block is leaked according to the status information of the data block and a process exception comprises:
determining that the data block leaks if the status information includes the first status information and the second status information and at least one of:
the process exception condition indicates that the current home process corresponding to the first state information is abnormal, and the process exception condition indicates that the target home process corresponding to the second state information is abnormal;
alternatively, the first and second electrodes may be,
and determining that the data block is not leaked under the condition that the state information comprises the first state information and the second state information, and the process abnormal condition indicates that the current home process corresponding to the first state information is not abnormal and the target home process corresponding to the second state information is not abnormal.
3. The method of claim 1, wherein determining whether the data block is leaked according to the status information of the data block and a process exception comprises:
determining that the data block leaks when the state information only includes the first state information and the process exception condition indicates that the current home process corresponding to the first state information is abnormal;
alternatively, the first and second electrodes may be,
and determining that the data block is not leaked when the state information only comprises the first state information and the process exception condition indicates that the current home process corresponding to the first state information is not abnormal.
4. The method of claim 1, wherein if the state information comprises the first state information and the data block is used by a first process, the first state information of the data block is a process identifier of the first process, the process identifier being used to uniquely identify the first process;
and in the case that the state information includes the first state information and the data block is not used by a process, the first state information of the data block is a null value, wherein the null value is used for indicating that the data block is not currently used.
5. The method of claim 1, wherein in the case that the state information comprises the second state information, and a second process applies for using the data block and the second process has not received the data block, the second state information is a process identifier of the second process, the process identifier being used to uniquely identify the second process;
and under the condition that the state information comprises the second state information and no third process applies to use the data block, the second state information is a null value, wherein the null value is used for indicating that no process needs to continue to use the data block.
6. The method of claim 1, wherein the obtaining current state information of the data block comprises:
receiving the state information reported by the current attribution process of the data block; alternatively, the first and second electrodes may be,
querying the status information of the data block.
7. The method of claim 1, wherein prior to said determining whether the data block is leaking based on the state information of the data block and a process exception condition, the method further comprises:
acquiring the process exception condition by at least one of the following modes:
inquiring whether the current attribution process of the data block is alive or not;
determining whether a registration exception signal is received, wherein the registration exception signal is used for indicating that the current home process of the data block is abnormal in registration;
receiving a process exit signal, wherein the process exit signal is used for indicating the process to exit.
8. The method according to any one of claims 1 to 7, further comprising:
and after determining that the data block leaks, recycling the data block.
9. An apparatus for determining leakage of a block of data, comprising:
a first obtaining module, configured to obtain current state information of a data block, where the state information includes first state information and/or second state information, where the first state information is used to indicate a current home process of the data block, and the second state information is used to indicate a target home process of the data block;
and the determining module is used for determining whether the data block leaks according to the state information of the data block and the process abnormal condition.
10. A computer-readable storage medium, in which a computer program is stored, wherein the computer program is configured to carry out the method of any one of claims 1 to 8 when executed.
11. An electronic device comprising a memory and a processor, wherein the memory has stored therein a computer program, and wherein the processor is arranged to execute the computer program to perform the method of any of claims 1 to 8.
CN202010917315.8A 2020-09-03 2020-09-03 Method and device for determining data block leakage, storage medium and electronic device Pending CN112035289A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010917315.8A CN112035289A (en) 2020-09-03 2020-09-03 Method and device for determining data block leakage, storage medium and electronic device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010917315.8A CN112035289A (en) 2020-09-03 2020-09-03 Method and device for determining data block leakage, storage medium and electronic device

Publications (1)

Publication Number Publication Date
CN112035289A true CN112035289A (en) 2020-12-04

Family

ID=73592147

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010917315.8A Pending CN112035289A (en) 2020-09-03 2020-09-03 Method and device for determining data block leakage, storage medium and electronic device

Country Status (1)

Country Link
CN (1) CN112035289A (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage
CN103473172A (en) * 2013-09-05 2013-12-25 无敌科技(西安)有限公司 System and method for checking leak of background program memories and positioning leak memory points
CN106708616A (en) * 2016-11-29 2017-05-24 深圳天珑无线科技有限公司 Process control method and process control device
US9760464B1 (en) * 2015-03-27 2017-09-12 Amazon Technologies, Inc. Memory leak detection
US20200042371A1 (en) * 2018-08-02 2020-02-06 Samsung Electronics Co., Ltd. Method for detecting memory leak and electronic device thereof
CN111400125A (en) * 2020-02-13 2020-07-10 中国平安人寿保险股份有限公司 Memory overflow monitoring method, device, equipment and storage medium of JAVA process

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101414272A (en) * 2008-10-17 2009-04-22 上海华为技术有限公司 Method and apparatus for detecting memory leakage
CN103473172A (en) * 2013-09-05 2013-12-25 无敌科技(西安)有限公司 System and method for checking leak of background program memories and positioning leak memory points
US9760464B1 (en) * 2015-03-27 2017-09-12 Amazon Technologies, Inc. Memory leak detection
CN106708616A (en) * 2016-11-29 2017-05-24 深圳天珑无线科技有限公司 Process control method and process control device
US20200042371A1 (en) * 2018-08-02 2020-02-06 Samsung Electronics Co., Ltd. Method for detecting memory leak and electronic device thereof
CN111400125A (en) * 2020-02-13 2020-07-10 中国平安人寿保险股份有限公司 Memory overflow monitoring method, device, equipment and storage medium of JAVA process

Similar Documents

Publication Publication Date Title
CN110389815B (en) Task processing method, device and system
CN109635523B (en) Application program detection method and device and computer readable storage medium
CN105336074A (en) Alarm method and device
CN104021141B (en) Method, device and system for data processing and cloud service
US9854466B2 (en) Method and apparatus for managing monitoring task
CN110943862B (en) Mutual exclusion service judgment method and device, electronic equipment and storage medium
CN110557416B (en) Multi-node collaborative blocking method and system
CN110996056B (en) Video storage method and device of cascade monitoring system
US9949061B2 (en) Fault management method and apparatus
CN110738156A (en) face recognition system and method based on message middleware
CN112035289A (en) Method and device for determining data block leakage, storage medium and electronic device
CN103593239B (en) The method and device of application process command process in LINUX system
CN101998570B (en) Network switching method and system
CN111381868B (en) Method and device for implementing embedded system driving layer
US10674337B2 (en) Method and device for processing operation for device peripheral
CN112653609B (en) VPN identification application method, device, terminal and storage medium
CN104657152B (en) Data transfer management method and electronic equipment
CN109901933B (en) Operation method and device of business system, storage medium and electronic device
CN109039783B (en) Alarm method and device
CN111586841A (en) Terminal paging optimization method, system, device and readable storage medium
CN107528714B (en) Script processing method, device and system and router
CN112579616A (en) Task processing method and device, storage medium and electronic equipment
CN115065649B (en) Method, device, equipment and storage medium for determining service message forwarding mode
CN109445942B (en) Heartbeat message processing method and device
CN108959038A (en) A kind of method and device of distributed application services monitoring

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20201204