CN113687971B - Method and device for generating memory map file - Google Patents

Method and device for generating memory map file Download PDF

Info

Publication number
CN113687971B
CN113687971B CN202110985049.7A CN202110985049A CN113687971B CN 113687971 B CN113687971 B CN 113687971B CN 202110985049 A CN202110985049 A CN 202110985049A CN 113687971 B CN113687971 B CN 113687971B
Authority
CN
China
Prior art keywords
file
generating
space
fault data
memory map
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.)
Active
Application number
CN202110985049.7A
Other languages
Chinese (zh)
Other versions
CN113687971A (en
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.)
Hangzhou DPTech Technologies Co Ltd
Original Assignee
Hangzhou DPTech Technologies 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 Hangzhou DPTech Technologies Co Ltd filed Critical Hangzhou DPTech Technologies Co Ltd
Priority to CN202110985049.7A priority Critical patent/CN113687971B/en
Publication of CN113687971A publication Critical patent/CN113687971A/en
Application granted granted Critical
Publication of CN113687971B publication Critical patent/CN113687971B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0766Error or fault reporting or storing
    • G06F11/0787Storage of error reports, e.g. persistent data storage, storage using memory protection
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; 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/0766Error or fault reporting or storing
    • G06F11/0781Error filtering or prioritizing based on a policy defined by the user or on a policy defined by a hardware/software module, e.g. according to a severity level
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/362Debugging of software
    • G06F11/366Debugging of software using diagnostics
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The present disclosure relates to a method, apparatus, electronic device, and computer-readable medium for generating a memory map file. The method comprises the following steps: generating fault data when a process fails; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; and when the occupied space is smaller than or equal to the residual space, generating a memory image file based on the fault data. The method, the device, the electronic equipment and the computer readable medium for generating the memory image file can optimize the mechanism for generating the memory image file, avoid the problems of file interception and positioning influence caused by too small file occupation space setting, and also avoid the problem of business system breakdown caused by too large file space setting.

Description

Method and device for generating memory map file
Technical Field
The present disclosure relates to the field of computer information processing, and in particular, to a method, an apparatus, an electronic device, and a computer readable medium for generating a memory map file.
Background
On Linux systems, when a program crashes, it typically creates a memory image (core) file under a specified directory. The core file is simply a memory image (plus debug information), primarily for debugging, and the process terminates and creates the core file in response to a specific signal. Typically, the process also has a core file size limit value that defaults to 0, indicating that the core file is not being created; setting to a value other than 0 indicates that a core file is generated, and if the length of data to be recorded by the core file exceeds the value, the core file is truncated to the limit value. Only partial information of the process exiting the site is recorded in the truncated core file, and the problem location can be affected.
The core file is set, and the size of the core file is set, so that the size is related to the running time of the program and is not fixed, and the size cannot be known in advance generally. If the setting is too small, the stored core file can be cut off to influence the problem location, and if the setting is large, the storage space is easy to occupy, and other businesses also need the storage space to influence the operation of other businesses. Since the set size cannot be known, many defaults are to close the generated core file, or to set a value first, if the core file is generated, the problem location is affected, and then a large size is modified.
In addition, the generated core file directory disk space can not be subjected to quota by default, if the quota is to be set, a file system partition with a fixed size needs to be independently created on the disk, if the core file is not available, the disk space is wasted, or the size of the current core file is changed, the re-creation is needed, and the operation process is complex.
The above information disclosed in the background section is only for enhancement of understanding of the background of the disclosure and therefore it may include information that does not form the prior art that is already known to a person of ordinary skill in the art.
Disclosure of Invention
In view of this, the present disclosure provides a method, an apparatus, an electronic device, and a computer readable medium for generating a memory map file, which can optimize a mechanism for generating a core file, avoid the problems of file interception and positioning influence caused by too small file occupation space, and avoid the problem of service system crash caused by too large file space.
According to an aspect of the present disclosure, a method for generating a memory map file is provided, the method including: generating fault data when a process fails; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; and when the occupied space is smaller than or equal to the residual space, generating a memory image file based on the fault data.
In an exemplary embodiment of the present disclosure, further comprising: when the occupied space is larger than the residual space, cutting off the fault data based on the residual space; and generating a memory map file through the fault data after the truncation.
In an exemplary embodiment of the present disclosure, further comprising: and when the residual space is 0, not generating a memory map file.
In an exemplary embodiment of the present disclosure, further comprising: configuring a quota strategy of the memory mapping file based on a user space of the proc file system.
In one exemplary embodiment of the present disclosure, generating crash data upon a process crash includes: and when the process fails, generating the memory image file according to a preset signal mechanism.
In an exemplary embodiment of the present disclosure, determining a remaining space of a preset storage address based on the quota policy includes: acquiring a preset storage address based on the quota policy; determining the occupied space of a memory mapping file stored at a preset storage address; and determining the residual space based on the total space of the preset storage addresses and the occupied space of the stored memory image file.
In one exemplary embodiment of the present disclosure, generating a memory map file based on the failure data includes: ignoring a capacity limiting function of a preset memory map file, and generating the memory map file based on the fault data; and storing the memory mapping file in the preset storage address.
In an exemplary embodiment of the present disclosure, generating the memory map file from the fault data after the truncating further includes: and generating log information based on the related information of the memory mapping file.
According to an aspect of the present disclosure, there is provided an apparatus for generating a memory map file, the apparatus including: the fault module is used for generating fault data when the process fails; the policy module is used for acquiring a corresponding quota policy based on the fault data; an occupancy module for determining an occupancy of the fault data based on the quota policy; the residual module is used for determining the residual space of the preset storage address based on the quota strategy; and the generating module is used for generating a memory image file based on the fault data when the occupied space is smaller than or equal to the residual space.
In an exemplary embodiment of the present disclosure, further comprising: the cutoff module is used for cutting off the fault data based on the residual space when the occupied space is larger than the residual space; generating a memory map file through the truncated fault data; the discarding module is used for not generating a memory image file when the residual space is 0; and the configuration module is used for configuring the quota strategy of the memory image file based on the user space of the proc file system.
According to an aspect of the present disclosure, there is provided an electronic device including: one or more processors; a storage means for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors are caused to implement the methods as described above.
According to an aspect of the present disclosure, a computer-readable medium is presented, on which a computer program is stored, which program, when being executed by a processor, implements a method as described above.
According to the method, the device, the electronic equipment and the computer readable medium for generating the memory image file, when a process fails, failure data are generated; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; when the occupied space is smaller than or equal to the residual space, the method for generating the memory image file based on the fault data can optimize a core file generation mechanism, avoid the problems of file interception and positioning influence caused by too small file occupied space, and avoid the problem of business system breakdown caused by too large file space.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The above and other objects, features and advantages of the present disclosure will become more apparent by describing in detail exemplary embodiments thereof with reference to the attached drawings. The drawings described below are merely examples of the present disclosure and other drawings may be obtained from these drawings without inventive effort for a person of ordinary skill in the art.
FIG. 1 is a system block diagram illustrating a method and apparatus for generating a memory map file according to an exemplary embodiment.
FIG. 2 is a flowchart illustrating a method of generating a memory map file according to an exemplary embodiment.
FIG. 3 is a flowchart illustrating a method of generating a memory map file according to another exemplary embodiment.
FIG. 4 is a flowchart illustrating a method of generating a memory map file according to another exemplary embodiment.
FIG. 5 is a block diagram illustrating an apparatus for generating a memory map file according to an exemplary embodiment.
Fig. 6 is a block diagram of an electronic device, according to an example embodiment.
Fig. 7 is a block diagram of a computer-readable medium shown according to an example embodiment.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. However, the exemplary embodiments can be embodied in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of the example embodiments to those skilled in the art. The same reference numerals in the drawings denote the same or similar parts, and thus a repetitive description thereof will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the disclosed aspects may be practiced without one or more of the specific details, or with other methods, components, devices, steps, etc. In other instances, well-known methods, devices, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams depicted in the figures are merely functional entities and do not necessarily correspond to physically separate entities. That is, the functional entities may be implemented in software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
The flow diagrams depicted in the figures are exemplary only, and do not necessarily include all of the elements and operations/steps, nor must they be performed in the order described. For example, some operations/steps may be decomposed, and some operations/steps may be combined or partially combined, so that the order of actual execution may be changed according to actual situations.
It will be understood that, although the terms first, second, third, etc. may be used herein to describe various components, these components should not be limited by these terms. These terms are used to distinguish one element from another element. Accordingly, a first component discussed below could be termed a second component without departing from the teachings of the concepts of the present disclosure. As used herein, the term "and/or" includes any one of the associated listed items and all combinations of one or more.
Those skilled in the art will appreciate that the drawings are schematic representations of example embodiments and that the modules or flows in the drawings are not necessarily required to practice the present disclosure, and therefore, should not be taken to limit the scope of the present disclosure.
The inventors of the present disclosure found that on the Linux system, the core file mechanism of a process is as follows:
the core file switch defaults to a disabled state, and is started by maintenance personnel when the core file switch is required to be started, or the core file is set to be opened through the setlimit in the source code of each application program;
the signal for triggering the generation of the core file is predefined, namely, the process can generate the core file only when receiving the specific signal, and then the process exits; the core file generated by each process defaults to be in the working directory of the current process, the core file path and the name of the core file can be set through the proc file system interface "/proc/sys/kernel/core_pattern" variable, the core file name defaults to be core, and related information such as the process name, the process ID, the triggered signal value, the time stamp of the generation time (seconds from the 1970's of the element) and the like can be appointed.
The core file is set, and the size of the core file is set, so that the size is related to the running time of the program and is not fixed, and the size cannot be known in advance generally. If the setting is too small, the stored core file can be cut off to influence the problem location, and if the setting is large, the storage space is easy to occupy, and other businesses also need the storage space to influence the operation of other businesses. Since the set size cannot be known, many defaults are to close the generated core file, or to set a value first, if the core file is generated, the problem location is affected, and then a large size is modified.
In addition, the generated core file directory disk space can not be subjected to quota by default, if the quota is to be set, a file system partition with a fixed size needs to be independently created on the disk, if the core file is not available, the disk space is wasted, or the size of the current core file is changed, the re-creation is needed, and the operation process is complex.
In view of the technical problems in the prior art, the present disclosure proposes a method for generating a memory image file, which optimizes a core file mechanism in a Linux-based operating system, provides a print log for increasing a directory size quota generated by a core file and exceeding the quota, and realizes an intelligent generation of the core file without considering how large the core file is set, and particularly in a production system, there is a concern that the core file occupies more disk space, which affects program operation and business use. Even the disk space is full, the uncontrollable factors of business running are more, and the disk is not set. Or because the setting is unreasonable, the core file is cut off, and the problem positioning is affected. In addition, the application source code does not need to be modified. The technical contents of the present disclosure are described in detail below in connection with specific embodiments.
FIG. 1 is a system block diagram of a method, apparatus, electronic device, and computer readable medium for generating a memory map file, according to an example embodiment.
As shown in fig. 1, the system architecture 10 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used as a medium to provide communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
The user may interact with the server 105 via the network 104 using the terminal devices 101, 102, 103 to receive or send messages or the like. Various communication client applications, such as shopping class applications, web browser applications, search class applications, instant messaging tools, mailbox clients, social platform software, etc., may be installed on the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may be a variety of electronic devices having a display screen and supporting web browsing, including but not limited to smartphones, tablets, laptop and desktop computers, and the like.
The server 105 may be a server that provides various services, such as a background management server that manages the terminal devices 101, 102, 103. The background management server can manage and maintain the systems of the terminal devices 101, 102, 103.
The terminal devices 101, 102, 103 may generate the failure data, for example, when a process fails; the terminal device 101, 102, 103 may obtain its corresponding quota policy, e.g. based on the failure data; the terminal device 101, 102, 103 may determine an occupancy of the fault data, e.g. based on the quota policy; the terminal device 101, 102, 103 may determine a remaining space of a preset storage address, e.g. based on the quota policy; the terminal device 101, 102, 103 may generate a memory map file based on the fault data, for example, when the occupied space is equal to or less than the remaining space.
The terminal device 101, 102, 103 may, for example, truncate the fault data based on the remaining space when the occupied space is larger than the remaining space; and generating a memory map file through the fault data after the truncation.
The terminal device 101, 102, 103 may not generate a memory map file, for example, when the remaining space is 0.
The terminal device 101, 102, 103 or the server 105 may configure the quota policy of the memory map file, e.g. based on the user space of the proc file system.
The server 105 may be an entity server, or may be a plurality of servers, for example, it should be noted that the method for generating the memory map file provided in the embodiments of the present disclosure may be executed by the terminal devices 101, 102, 103 and/or the server 105, and accordingly, the generating device of the memory map file may be set in the terminal devices 101, 102, 103 and/or the server 105.
FIG. 2 is a flowchart illustrating a method of generating a memory map file according to an exemplary embodiment. The memory map file generation method 20 includes steps S202 to S212.
As shown in fig. 2, in S202, when a process fails, failure data is generated. Comprising the following steps: and when the process fails, generating the memory image file according to a preset signal mechanism. In the core file, in the Linux system (and other Unix-like systems), when a process exits (receives a specific signal) due to some abnormal reasons, data in the virtual address space of the process, the reason for causing the exit, call stack information, and the like can be recorded in a binary file, i.e., the core file. The research and development personnel can analyze the core file by utilizing the debugging tool gdb so as to locate the specific reason of the process exit.
In S204, a corresponding quota policy is obtained based on the failure data. Quota policies may be set according to characteristics of different application processes. More specifically, the configuration may be performed through the proc file system user space.
More specifically, the kernel adds a function of configuring the disk quota of the core file directory, and configures the disk quota through the user space of the proc file system. If the content quota of the core file is controlled by adding/proc/sys/core_dir_quota, the content quota is indicated as the maximum disk space that the core file can occupy, default to 0, and the unit is M, if the quota is set to 1G, the content quota can be configured by 'echo 1024 >/proc/sys/core_dir_quota', the maximum disk space that the core file occupies is 1G, and 1G space is used up, so that the core file cannot be generated. In addition, the kernel increases core file directory disk quota space overflow print log parameters, and is also configured through proc file system user space, and the increase/proc/sys/core_quota_overflow_log indicates whether to output a log or not if the disk quota is exceeded, 0 indicates that no log is output, and 1 is the output log.
In one embodiment, the core dump file directory of coreDump may be set first and a core file naming rule may be generated, and the formatted core file save location or file name format may be set by/proc/sys/kernel/core_pattern, for example, by an echo "/core-% > e-% > p-% > s-% > t" >/proc/sys/kernel/core_pattern command, which controls the generated core file to be saved under/core file directory, and the generated file name is a core-process name-process pid-timestamp, where each parameter has the following meaning: % e represents the process name,% p represents the process id,% s represents the signal that causes the core file to be generated, and t represents the time the core file is generated.
In one embodiment, the core file disk quota size parameter may also be set by/proc/sys/core_dir_quota, e.g., set to 1G, if not set, then the core file disk quota size is not valid. The core file directory disk quota space overflow print log parameter is set by/proc/sys/core_quota_overflow_log.
In S206, an occupancy of the fault data is determined based on the quota policy. In the quota strategy, when the core file corresponding to the fault data is not zero, and the fault data is proved to be storable, the space occupied by the fault data is acquired.
In S208, a remaining space of the preset storage address is determined based on the quota policy. Comprising the following steps: acquiring a preset storage address based on the quota policy; determining the occupied space of a memory mapping file stored at a preset storage address; and determining the residual space based on the total space of the preset storage addresses and the occupied space of the stored memory image file.
In one embodiment, according to user configuration, it is first checked whether a core file quota (configuration of corresponding/proc/sys/core_dir_quota) is configured, if configured, the disk quota size total_size of the configured core file directory is obtained, and meanwhile, the sum of the occupied space sizes of all files in the directory is counted, and the disk space size core_size required for generating the core file at this time is calculated.
In S210, when the occupied space is less than or equal to the remaining space, a memory map file is generated based on the fault data.
In one embodiment, for example, a capacity limiting function of a preset memory map file may be ignored, and a memory map file is generated based on the fault data; and storing the memory mapping file in the preset storage address.
More specifically, according to the user configuration, the sum of the sizes of all the files in the directory is counted, the size core_size of the disk space needed for generating the coredump file is calculated, and the remaining space main_size is equal to the total_size-used_size. If the remaining space remain_size is larger than or equal to the current core file size core_size, the core file size limitation set by the program through the setlimit function is ignored, so that the problem that the core file cannot be completely stored due to unreasonable setting is avoided, particularly, for some network devices, the problem that the core file size is not limited by configuration, the disk is full is solved, or the core file size is limited by the setlimit only, but the size is not well set, the problem of cutoff is solved, the core is closed by default, and the application program does not need to modify source codes is avoided. Then a complete core file may be generated,
in one embodiment, further comprising: and when the residual space is 0, not generating a memory map file. If 0, then no space is created for the core file and no core file is created.
In S212, when the occupied space is greater than the remaining space, truncating the fault data based on the remaining space; and generating a memory map file through the fault data after the truncation. The remaining space is between 0 and core_size, then the truncated generation part core file.
In one embodiment, further comprising: and generating log information based on the related information of the memory mapping file. More specifically, if the core file is insufficient in remaining space, a complete core file cannot be generated, the kernel checks that a log needs to be printed (configuration of corresponding/proc/sys// core_quoa_overflow_log), and outputs a log through printk to display that the core file cannot be generated due to the core file directory quota, including information such as a hanging process name, time, signal, core file size, core file directory quota size, and the like.
According to the method for generating the memory map file, when a process fails, failure data are generated; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; when the occupied space is smaller than or equal to the residual space, the method for generating the memory image file based on the fault data can optimize a core file generation mechanism, avoid the problems of file interception and positioning influence caused by too small file occupied space, and avoid the problem of business system breakdown caused by too large file space.
It should be clearly understood that this disclosure describes how to make and use particular examples, but the principles of this disclosure are not limited to any details of these examples. Rather, these principles can be applied to many other embodiments based on the teachings of the present disclosure.
FIG. 3 is a flowchart illustrating a method of generating a memory map file according to another exemplary embodiment. The flow 30 shown in fig. 3 is a detailed description of the flow shown in fig. 2.
As shown in fig. 3, in S301, an abnormality occurs in a process, and a memory map file is to be generated.
In S302, whether the memory map file to be generated has a corresponding quota policy.
In S303, a memory map file is generated according to a default mechanism.
In S304, the remaining space size is determined.
In S305, the remaining space size is compared with the occupied space of the memory map file to be generated.
In S306, the remaining space is equal to or larger than the occupied space, and a memory map file is generated.
In S307, the remaining space is 0, and the memory map file is not generated.
In S308, the remaining space is smaller than the occupied space, the fault data is truncated, a memory map file is generated, and a log is printed.
Those skilled in the art will appreciate that all or part of the steps implementing the above described embodiments are implemented as a computer program executed by a CPU. The above-described functions defined by the above-described methods provided by the present disclosure are performed when the computer program is executed by a CPU. The program may be stored in a computer readable storage medium, which may be a read-only memory, a magnetic disk or an optical disk, etc.
Furthermore, it should be noted that the above-described figures are merely illustrative of the processes involved in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily appreciated that the processes shown in the above figures do not indicate or limit the temporal order of these processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, for example, among a plurality of modules.
The following are device embodiments of the present disclosure that may be used to perform method embodiments of the present disclosure. For details not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the method of the present disclosure.
Fig. 4 is a block diagram illustrating an apparatus for generating a memory map file according to another exemplary embodiment. As shown in fig. 4, the memory map file generation apparatus 40 includes: failure module 402, policy module 404, occupancy module 406, remaining module 408, generation module 410.
The fault module 402 is configured to generate fault data when a process fails; the failure module 402 is further configured to generate the memory map file according to a preset signaling mechanism when a process fails.
The policy module 404 is configured to obtain a quota policy corresponding to the failure data based on the failure data;
an occupancy module 406 is configured to determine an occupancy of the fault data based on the quota policy;
the remaining module 408 is configured to determine a remaining space of a preset storage address based on the quota policy; the remaining module 408 is further configured to obtain a preset storage address based on the quota policy; determining the occupied space of a memory mapping file stored at a preset storage address; and determining the residual space based on the total space of the preset storage addresses and the occupied space of the stored memory image file.
The generating module 410 is configured to generate a memory map file based on the fault data when the occupied space is less than or equal to the remaining space. The generating module 410 is further configured to ignore a capacity limiting function of a preset memory map file, and generate a memory map file based on the fault data; and storing the memory mapping file in the preset storage address.
FIG. 5 is a block diagram illustrating an apparatus for generating a memory map file according to an exemplary embodiment. As shown in fig. 5, the memory map file generation apparatus 50 includes: the module 502 is truncated, the module 504 is discarded, and the module 506 is configured.
The truncation module 502 is configured to truncate the fault data based on the remaining space when the occupied space is greater than the remaining space; generating a memory map file through the truncated fault data;
the discarding module 504 is configured to not generate a memory map file when the remaining space is 0;
the configuration module 506 is configured to configure a quota policy of the memory map file based on a user space of the proc file system.
According to the memory map file generating device, when a process fails, failure data are generated; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; when the occupied space is smaller than or equal to the residual space, the method for generating the memory image file based on the fault data can optimize a core file generation mechanism, avoid the problems of file interception and positioning influence caused by too small file occupied space, and avoid the problem of business system breakdown caused by too large file space.
Fig. 6 is a block diagram of an electronic device, according to an example embodiment.
An electronic device 600 according to such an embodiment of the present disclosure is described below with reference to fig. 6. The electronic device 600 shown in fig. 6 is merely an example and should not be construed to limit the functionality and scope of use of embodiments of the present disclosure in any way.
As shown in fig. 6, the electronic device 600 is in the form of a general purpose computing device. Components of electronic device 600 may include, but are not limited to: at least one processing unit 610, at least one memory unit 620, a bus 630 connecting the different system components (including the memory unit 620 and the processing unit 610), a display unit 640, etc.
Wherein the storage unit stores program code that is executable by the processing unit 610 such that the processing unit 610 performs steps described in the present specification according to various exemplary embodiments of the present disclosure. For example, the processing unit 610 may perform the steps as shown in fig. 2, 3.
The memory unit 620 may include readable media in the form of volatile memory units, such as Random Access Memory (RAM) 6201 and/or cache memory unit 6202, and may further include Read Only Memory (ROM) 6203.
The storage unit 620 may also include a program/utility 6204 having a set (at least one) of program modules 6205, such program modules 6205 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each or some combination of which may include an implementation of a network environment.
Bus 630 may be a local bus representing one or more of several types of bus structures including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or using any of a variety of bus architectures.
The electronic device 600 may also communicate with one or more external devices 600' (e.g., keyboard, pointing device, bluetooth device, etc.), devices that enable a user to interact with the electronic device 600, and/or any devices (e.g., routers, modems, etc.) that the electronic device 600 can communicate with one or more other computing devices. Such communication may occur through an input/output (I/O) interface 650. Also, electronic device 600 may communicate with one or more networks such as a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the Internet, through network adapter 660. The network adapter 660 may communicate with other modules of the electronic device 600 over the bus 630. It should be appreciated that although not shown, other hardware and/or software modules may be used in connection with electronic device 600, including, but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, data backup storage systems, and the like.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or may be implemented in software in combination with the necessary hardware. Thus, as shown in fig. 7, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and includes several instructions to cause a computing device (may be a personal computer, a server, or a network device, etc.) to perform the above-described method according to the embodiments of the present disclosure.
The software product may employ any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium can be, for example, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples (a non-exhaustive list) of the readable storage medium would include the following: an electrical connection having one or more wires, a portable disk, a hard disk, random Access Memory (RAM), read-only memory (ROM), erasable programmable read-only memory (EPROM or flash memory), optical fiber, portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
The computer readable storage medium may include a data signal propagated in baseband or as part of a carrier wave, with readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A readable storage medium may also be any readable medium that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a readable storage medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations of the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C++ or the like and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device, partly on a remote computing device, or entirely on the remote computing device or server. In the case of remote computing devices, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., connected via the Internet using an Internet service provider).
The computer-readable medium carries one or more programs, which when executed by one of the devices, cause the computer-readable medium to perform the functions of: generating fault data when a process fails; acquiring a corresponding quota strategy based on the fault data; determining an occupied space of the fault data based on the quota policy; determining the residual space of a preset storage address based on the quota strategy; and when the occupied space is smaller than or equal to the residual space, generating a memory image file based on the fault data. The computer readable medium may also implement the following functions: configuring a quota strategy of the memory mapping file based on a user space of the proc file system. The computer readable medium may also implement the following functions: when the occupied space is larger than the residual space, cutting off the fault data based on the residual space; and generating a memory map file through the fault data after the truncation. The computer readable medium may also implement the following functions: and when the residual space is 0, not generating a memory map file.
Those skilled in the art will appreciate that the modules may be distributed throughout several devices as described in the embodiments, and that corresponding variations may be implemented in one or more devices that are unique to the embodiments. The modules of the above embodiments may be combined into one module, or may be further split into a plurality of sub-modules.
From the above description of embodiments, those skilled in the art will readily appreciate that the example embodiments described herein may be implemented in software, or in combination with the necessary hardware. Thus, the technical solutions according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (may be a CD-ROM, a U-disk, a mobile hard disk, etc.) or on a network, and include several instructions to cause a computing device (may be a personal computer, a server, a mobile terminal, or a network device, etc.) to perform the method according to the embodiments of the present disclosure.
Exemplary embodiments of the present disclosure are specifically illustrated and described above. It is to be understood that this disclosure is not limited to the particular arrangements, instrumentalities and methods of implementation described herein; on the contrary, the disclosure is intended to cover various modifications and equivalent arrangements included within the spirit and scope of the appended claims.

Claims (4)

1. A method of generating a memory map file, comprising:
generating fault data when a process fails;
acquiring a corresponding quota strategy based on the fault data;
determining an occupied space of the fault data based on the quota policy;
acquiring a preset storage address based on the quota policy, determining the occupied space of a memory image file stored in the preset storage address, and determining the residual space of the preset storage address based on the total space of the preset storage address and the occupied space of the stored memory image file;
generating a memory map file based on the fault data and configuring a quota policy of the memory map file based on a user space of a proc file system when the occupied space is smaller than or equal to the remaining space, truncating the fault data based on the remaining space when the occupied space is larger than the remaining space, generating a memory map file through the truncated fault data, and not generating a memory map file when the remaining space is 0, wherein generating a memory map file based on the fault data includes omitting a capacity limiting function of a preset memory map file, generating a memory map file based on the fault data, and storing the memory map file at the preset storage address.
2. The method of claim 1, wherein generating the crash data upon a process crash comprises:
and when the process fails, generating the memory image file according to a preset signal mechanism.
3. The method of claim 2, wherein generating the memory map file from the fault data after truncation, further comprises:
and generating log information based on the related information of the memory mapping file.
4. A memory map file generation apparatus comprising:
the fault module is used for generating fault data when the process fails;
the policy module is used for acquiring a corresponding quota policy based on the fault data;
an occupancy module for determining an occupancy of the fault data based on the quota policy;
the residual module is used for acquiring a preset storage address based on the quota strategy, determining the occupied space of the memory image file stored in the preset storage address, and determining the residual space of the preset storage address based on the total space of the preset storage address and the occupied space of the stored memory image file;
the generating module is used for generating a memory map file based on the fault data when the occupied space is smaller than or equal to the residual space, comprises a capacity limiting function of neglecting a preset memory map file, generates the memory map file based on the fault data, and stores the memory map file in the preset storage address;
the cutoff module is used for cutting off the fault data based on the residual space when the occupied space is larger than the residual space; generating a memory map file through the truncated fault data;
the discarding module is used for not generating a memory image file when the residual space is 0;
and the configuration module is used for configuring the quota strategy of the memory image file based on the user space of the proc file system.
CN202110985049.7A 2021-08-24 2021-08-24 Method and device for generating memory map file Active CN113687971B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110985049.7A CN113687971B (en) 2021-08-24 2021-08-24 Method and device for generating memory map file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110985049.7A CN113687971B (en) 2021-08-24 2021-08-24 Method and device for generating memory map file

Publications (2)

Publication Number Publication Date
CN113687971A CN113687971A (en) 2021-11-23
CN113687971B true CN113687971B (en) 2023-06-27

Family

ID=78582720

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110985049.7A Active CN113687971B (en) 2021-08-24 2021-08-24 Method and device for generating memory map file

Country Status (1)

Country Link
CN (1) CN113687971B (en)

Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612760A (en) * 2020-12-30 2021-04-06 中国农业银行股份有限公司 Log message output method and device

Family Cites Families (13)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8452835B2 (en) * 2009-12-23 2013-05-28 Citrix Systems, Inc. Systems and methods for object rate limiting in multi-core system
CN103064639B (en) * 2012-12-28 2016-08-03 华为技术有限公司 Data storage method and device
CN105468989B (en) * 2014-09-04 2018-10-12 中国石油化工股份有限公司 Cloud storage quota management method based on linux kernel monitoring
US10235176B2 (en) * 2015-12-17 2019-03-19 The Charles Stark Draper Laboratory, Inc. Techniques for metadata processing
CN107291510B (en) * 2017-06-30 2020-11-06 惠州华阳通用电子有限公司 Rapid starting method for Linux vehicle-mounted information system
CN109426606A (en) * 2017-08-23 2019-03-05 东软集团股份有限公司 Kernel failure diagnosis information processing method, device, storage medium and electronic equipment
CN111290871A (en) * 2018-12-10 2020-06-16 北京京东尚科信息技术有限公司 Method and device for obtaining application crash information
CN109656743B (en) * 2018-12-28 2022-04-26 杭州迪普科技股份有限公司 Core file management method and device, equipment and medium
CN110011854B (en) * 2019-04-12 2022-03-04 苏州浪潮智能科技有限公司 MDS fault handling method, device, storage system and computer-readable storage medium
CN110515820B (en) * 2019-08-29 2022-07-08 北京浪潮数据技术有限公司 Server fault maintenance method and device, server and storage medium
CN110704222A (en) * 2019-09-02 2020-01-17 深圳壹账通智能科技有限公司 Dump file analysis method and device, storage medium, electronic device
CN111158945B (en) * 2019-12-31 2023-12-22 奇安信科技集团股份有限公司 Kernel fault processing method, device, network security equipment and readable storage medium
CN113127263B (en) * 2020-01-15 2023-04-07 中移(苏州)软件技术有限公司 Kernel crash recovery method, device, equipment and storage medium

Patent Citations (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112612760A (en) * 2020-12-30 2021-04-06 中国农业银行股份有限公司 Log message output method and device

Also Published As

Publication number Publication date
CN113687971A (en) 2021-11-23

Similar Documents

Publication Publication Date Title
CA3059709C (en) Risk analysis method, device and computer readable medium
US8843621B2 (en) Event prediction and preemptive action identification in a networked computing environment
CN110337075A (en) A kind of short message sending method, device and electronic equipment based on APP type of service
CN110351134A (en) A kind of server environment switching method, device and electronic equipment
CN110795649A (en) Target page display method, device and system and electronic equipment
CN109726076B (en) Applet life cycle management method and system
US20200372372A1 (en) Predicting the disaster recovery invocation response time
CN112764729A (en) Application software development method and device, computer equipment and readable storage medium
CN110347505B (en) Access method and device supporting cross-network-segment scheduling and electronic equipment
CN110445632A (en) A method and device for preventing client crashes
CN112347169A (en) PHP (hypertext preprocessor) framework based user request processing method and device and electronic equipment
CN114827157A (en) Cluster task processing method, device and system, electronic equipment and readable medium
JP2021163475A (en) Log-based mashup code generation
CN111954240A (en) Network fault processing method and device and electronic equipment
CN113722007B (en) Configuration method, device and system of VPN branch equipment
CN111949906A (en) Page display method and device and electronic equipment
CN111681093B (en) Method and device for displaying resource page and electronic equipment
CN110928940B (en) Data writing method and device based on kafka cluster, electronic equipment and storage medium
CN113687971B (en) Method and device for generating memory map file
CN112800006B (en) Log storage method and device for network equipment
CN111488316B (en) File cache recovery method and device
CN113064783B (en) Application monitoring method, device, system, electronic device and readable medium
CN113890819A (en) Fault processing method, device and system
CN112231614A (en) Combined type activity page display method and device and electronic equipment
CN113141407B (en) A page resource loading method, device and electronic device

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
GR01 Patent grant
GR01 Patent grant