Namespace: OpenEdge.Core.Util
Type: Class LeakCheck
Parent Classes:
Progress.Lang.Object

Inherits: Progress.Lang.Object


Copyright (c) 2022 by Progress Software Corporation. All rights reserved.
File:LeakCheck
Purpose:Parses a LOG-MANAGER file for DYNOBJECTS entries and
determines whether there are any memory leaks
Author(s):pjudge
Created:2022-02-04
Notes:* To exclude any groups of object from tracking, set the ExcludeGroups property to a CSV list of groups
to exclude.
USE-WIDGET-POOL phrase and the session widget-pool
the MaxErrorLines threshold, then parsing for that file stops.
- PROCEDURE (type=procedure name)
- PLO (type=OOABL type name)
- DATA (type=BUFFER | DATASET | TEMP-TABLE | DATA-SOURCE)
- XML (type=X-DOCUMENT | X-NODEREF | SAX-READER | SAX-WRITER | SAX-ATTRIBUTES | SOAP-HEADER | SOAP-HEADER-ENTRYREF)
- BLOB (type=MEMPTR)
- WIDGET-POOL (type=PROGRAM | PERSISTENT)
- HANDLE (Anything else)
{
"filter": <the group or session used to filter, or null>
"sessions": {
<session-id>: {
"cnt": <leak count>
"size": <bytes leaked for session>
"req": {
<request-id>: {
"cnt": <leak count>
"size": <bytes leaked for session>
}
}
}
},
"groups": {
<group>: {
"cnt": <leak count>
"size": <bytes leaked for group>
}
},
"objects":[
{
"session": <PID | PID Session-ID>
"grp": <PROCEDURE|PLO|DATA|XML|BLOB|HANDLE|WIDGET-POOL>
"type": <OOABL type or procedure name|widget type|MEMPTR>
"id": <handle or internal id>
"req": <the PASOE request id or null>
"info": <information about where this object was created>
"size": <either null or a positive value>
"pool": <the name of the widget pool this object was created in, or null>
"created": <the timestamp wheen the object was creaetd>
"line": <the line on which the object creation happened in the log
"log": <the name of the logfile this record was created>
"action": <CREATE|DELETE|DELETE-PENDING>
"rel": <optionally the related record (so a DELETE for a CREATE and vice versa)>
}
]
}
- Which data is returned depends on the report parameters in LeakReportParameters
- Sessions will only have request information if there are any leaks detected in a request. This is also only
relevent for PAS agent logs



Method Summary
  Options Name Purpose
  Clear () /* Clears any previously-parsed data. */
  CreateRow (buffer, character, character, character, character, character, character, character, int64, datetime-tz, character, character) /* Creates a new record for a tracked object @param buffer tObject The buffer in which to create the record @param character The action: one of CREATE, DELETE, DELETE-PENDING @param character The session id @param character The request id, if any @param character The object group @param character The object type @param character The object's unique ID @param character The name of the logfile being parsed @param int64 The current line in the log @param datetime-tz The timestamp of the event @param character Line info @param character The widget-pool name, if any */
  Progress.Json.ObjectModel.JsonObject GetReport () /* Returns any leaks for all groups as a JSON array of objects @return JsonObject If there are leaks, an aray of objects, otherwise an empty array returned */
  Progress.Json.ObjectModel.JsonObject GetReport (LeakReportParameters) /* Builds the leak report based on the requested filter/criteria @param pReportParams Parameters for the report @return JsonObject The leak report */
  GetReport (table) /* Returns the internal temp-table BY VALUE. This is to keep the set of data in this object, and not allow external callers to modify it. They may modify their copy of the data of course. If this method is called with the BY-REFERENCE option, an AssertionFailedError is raised. @parameter TABLE tObject. */
  Progress.Json.ObjectModel.JsonObject GetReportForGroup (character) /* Returns any leaks for a group as a JSON array of objects @param character A group identifier. If not in the list above, then all leaks are returned. @return JsonObject If there are leaks, an aray of objects, otherwise an empty array returned */
  Progress.Json.ObjectModel.JsonObject GetReportForSession (character) /* Returns any leaks for a particular session The session is in one of two forms - For PASOE, it takes the form "<agent-pid> <abl-session-id>" (as in the agent log) - For other clients, it takes the form "P-<process-id>" (as in a client log) @param character The context to search. The search is a BEGINS operation, not EQ @return JsonObject If there are leaks, an aray of objects, otherwise an empty array returned */
  Progress.Json.ObjectModel.JsonObject GetReportForType (character) /* Returns any leaks for a group as a JSON array of objects @param character A type name, or part thereof. All leaks that begin with this string are returned @return JsonObject If there are leaks, an aray of objects, otherwise an empty array returned */
  CHARACTER GetReportGroups () /* Returns an array of all the groups that have leaks. If there are no leaks in this group, an indeterminate array is returned. @return character[] An aray of the leak groups */
  CHARACTER GetReportSessions () /* Returns an array of all the contexts that have leaks. If there are no leaks for this context, an indeterminate array is returned. @return character[] An array of the leak sessions */
  LOGICAL HasLeaks () /* Are there any memory leaks in the scanned log(s)? @return logical TRUE if there are leaks detected. FALSE if no scan has been done, or if there are no leaks. */
  LOGICAL HasLeaksForGroup (character) /* Are there any memory leaks in the scanned log(s), for a specific group? @param character A group. If the group is not in the list above, will look for any leak @return logical TRUE if there are leaks detected in that group. FALSE if no scan has been done, or if there are no leaks. */
  LOGICAL HasLeaksForSession (character) /* Are there any memory leaks in the scanned log(s), for the specified session? @param character A session identifier, or part thereof. The check is done with the BEGINS operator. If an unknown value is passed, then any leak, anywhere, will return TRUE. @return logical TRUE if there are leaks detected in that group. FALSE if no scan has been done, or if there are no leaks. */
  MatchRelated (buffer) /* Find any related records, by a combo of session/group/type/id CREATE may have DELETE and DELETE-PENDING DELETE may have CREATE DELETE-PENDING may have CREATE @param buffer The record for which to find a related record */
  MatchRelatedBlob (buffer) /* Find related BLOB records, by a combo of session/group/id (with LONGCHAR/MEMPTR types checked explicitly) @param buffer The record for which to find a related record */
  MatchRelatedPool (buffer) /* Finds a related record for a widget-pool, by a combo of session/group/type/id and time @param buffer The record for which to find a related record */
  LOGICAL ParseLog (character) /* Reads a log file and determines whether there are leaks. ParseLog can be called multiple times, for multiple files if needed. LONGCHARs are ignored, since they are memory-safe (aka cannot leak) Only lines in the DYNOBJECTS group are read. Parsing errors only refer to lines with DYNOBJECST in them; lines that do not contain " DYNOBJECTS " in them are skipped and are not parsed. @param character A file name representing a client log (LOG-MANAGER) @return logical TRUE if there were no parsing errors during this parse, FALSE otherwise. */

Constructor Summary
  Options Name Purpose
  LeakCheck () /* Default constructor */

Property Summary
  Options Name Purpose
  CHARACTER ExcludeGroups
  OpenEdge.Logging.ILogWriter Logger
  INT64 MaxErrorLines


Method Detail
Top

Clear ()

/* Clears any previously-parsed data.
Top

CreateRow (buffer, character, character, character, character, character, character, character, int64, datetime-tz, character, character)

/* Creates a new record for a tracked object
Parameters:
pObject buffer
 
pAction CHARACTER
 
pSession CHARACTER
 
pReqId CHARACTER
 
pGroup CHARACTER
 
pType CHARACTER
 
pId CHARACTER
 
pLogname CHARACTER
 
pLogLine INT64
 
pTimestamp DATETIME-TZ
 
pInfo CHARACTER
 
pPool CHARACTER
 
Top

Progress.Json.ObjectModel.JsonObject GetReport ()

/* Returns any leaks for all groups as a JSON array of objects
Returns Progress.Json.ObjectModel.JsonObject
  JsonObject If there are leaks, an aray of objects, otherwise an empty array returned
Top

Progress.Json.ObjectModel.JsonObject GetReport (LeakReportParameters)

/* Builds the leak report based on the requested filter/criteria
Parameters:
pReportParams OpenEdge.Core.Util.LeakReportParameters
  Parameters for the report
Returns Progress.Json.ObjectModel.JsonObject
  JsonObject The leak report
Top

GetReport (table)

/* Returns the internal temp-table BY VALUE. This is to keep the set of data in this object, and
not allow external callers to modify it. They may modify their copy of the data of course.
If this method is called with the BY-REFERENCE option, an AssertionFailedError is raised.
Parameters:
tObject TABLE
 
Top

Progress.Json.ObjectModel.JsonObject GetReportForGroup (character)

/* Returns any leaks for a group as a JSON array of objects
Parameters:
pGrp CHARACTER
 
Returns Progress.Json.ObjectModel.JsonObject
  JsonObject If there are leaks, an aray of objects, otherwise an empty array returned
Top

Progress.Json.ObjectModel.JsonObject GetReportForSession (character)

/* Returns any leaks for a particular session
The session is in one of two forms
- For PASOE, it takes the form "<agent-pid> <abl-session-id>" (as in the agent log)
- For other clients, it takes the form "P-<process-id>" (as in a client log)
Parameters:
pSession CHARACTER
 
Returns Progress.Json.ObjectModel.JsonObject
  JsonObject If there are leaks, an aray of objects, otherwise an empty array returned
Top

Progress.Json.ObjectModel.JsonObject GetReportForType (character)

/* Returns any leaks for a group as a JSON array of objects
Parameters:
pType CHARACTER
 
Returns Progress.Json.ObjectModel.JsonObject
  JsonObject If there are leaks, an aray of objects, otherwise an empty array returned
Top

CHARACTER GetReportGroups ()

/* Returns an array of all the groups that have leaks. If there are no leaks in this group, an indeterminate array
is returned.
Returns CHARACTER
  character[] An aray of the leak groups
Top

CHARACTER GetReportSessions ()

/* Returns an array of all the contexts that have leaks. If there are no leaks for this context, an indeterminate array
is returned.
Returns CHARACTER
  character[] An array of the leak sessions
Top

LOGICAL HasLeaks ()

/* Are there any memory leaks in the scanned log(s)?
Returns LOGICAL
  logical TRUE if there are leaks detected. FALSE if no scan has been done, or if there are no leaks.
Top

LOGICAL HasLeaksForGroup (character)

/* Are there any memory leaks in the scanned log(s), for a specific group?
Parameters:
pGrp CHARACTER
 
Returns LOGICAL
  logical TRUE if there are leaks detected in that group. FALSE if no scan has been done, or if there are no leaks.
Top

LOGICAL HasLeaksForSession (character)

/* Are there any memory leaks in the scanned log(s), for the specified session?
then any leak, anywhere, will return TRUE.
Parameters:
pSession CHARACTER
 
Returns LOGICAL
  logical TRUE if there are leaks detected in that group. FALSE if no scan has been done, or if there are no leaks.
Top

MatchRelated (buffer)

/* Find any related records, by a combo of session/group/type/id
CREATE may have DELETE and DELETE-PENDING
DELETE may have CREATE
DELETE-PENDING may have CREATE
Parameters:
pObject buffer
 
Top

MatchRelatedBlob (buffer)

/* Find related BLOB records, by a combo of session/group/id (with LONGCHAR/MEMPTR types checked explicitly)
Parameters:
pObject buffer
 
Top

MatchRelatedPool (buffer)

/* Finds a related record for a widget-pool, by a combo of session/group/type/id and time
Parameters:
pObject buffer
 
Top

LOGICAL ParseLog (character)

/* Reads a log file and determines whether there are leaks.
ParseLog can be called multiple times, for multiple files if needed.
LONGCHARs are ignored, since they are memory-safe (aka cannot leak)
Only lines in the DYNOBJECTS group are read. Parsing errors only refer to lines with DYNOBJECST in them;
lines that do not contain " DYNOBJECTS " in them are skipped and are not parsed.
Parameters:
pLogfile CHARACTER
 
Returns LOGICAL
  logical TRUE if there were no parsing errors during this parse, FALSE otherwise.


Constructor Detail
Top

LeakCheck ()

/* Default constructor


Property Detail
Top

CHARACTER ExcludeGroups

Returns CHARACTER
 
Top

OpenEdge.Logging.ILogWriter Logger

Returns OpenEdge.Logging.ILogWriter
 
Top

INT64 MaxErrorLines

Returns INT64