PowerPointpresentatie - PowerPoint PPT Presentation

1 / 43
About This Presentation
Title:

PowerPointpresentatie

Description:

Printable Character Events logs all events concerning printable characters. Non-printable UI Events logs events concerning non-printable characters and WM GUI events. ... – PowerPoint PPT presentation

Number of Views:51
Avg rating:3.0/5.0
Slides: 44
Provided by: peterv8
Category:

less

Transcript and Presenter's Notes

Title: PowerPointpresentatie


1
PTW-043 Dynamic Debugging In OpenEdge
Peter van Dam pvd_at_netsetup.nl
2
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

3
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

4
Dynamic Programming
  • Dynamic Windows, Frames Widgets
  • Dynamic Browses
  • Dynamic Buffers Queries
  • Dynamic Temp-Tables
  • Objects, Handles, Methods Attributes
  • AppServer
  • WebClient

5
Memory leaks
  • Show up after a long time
  • Can be extremely difficult to track down (until
    now)

Bites you at deployment!
6
Memory leaks
  • Dynamic objects arescoped to the session
  • You are responsible fordeleting objects when you
    are done with themDELETE OBJECT
    hBuffer.hBuffer ?.
  • Use VALID-HANDLE in your code

7
Memory leak example
  • / countcust.p /
  • DEF VAR hQuery AS HANDLE NO-UNDO.
  • DEF VAR hBuffer AS HANDLE NO-UNDO.
  • DEF VAR iCount AS INTEGER NO-UNDO.
  • CREATE BUFFER hBuffer FOR TABLE "customer".
  • CREATE QUERY hQuery.
  • hQuerySET-BUFFERS(hBuffer).
  • hQueryQUERY-PREPARE("FOR EACH customer
    NO-LOCK").
  • hQueryQUERY-OPEN().
  • hQueryGET-FIRST().
  • DO WHILE hBufferAVAILABLE
  • iCount iCount 1.
  • hQueryGET-NEXT().
  • END.
  • MESSAGE iCount "customers found" VIEW-AS
    ALERT-BOX.

8
Memory leak example
  • / countcust.p /
  • DEF VAR hQuery AS HANDLE NO-UNDO.
  • DEF VAR hBuffer AS HANDLE NO-UNDO.
  • DEF VAR iCount AS INTEGER NO-UNDO.
  • CREATE BUFFER hBuffer FOR TABLE "customer".
  • CREATE QUERY hQuery.
  • hQuerySET-BUFFERS(hBuffer).
  • hQueryQUERY-PREPARE("FOR EACH customer
    NO-LOCK").
  • hQueryQUERY-OPEN().
  • hQueryGET-FIRST().
  • DO WHILE hBufferAVAILABLE
  • iCount iCount 1.
  • hQueryGET-NEXT().
  • END.
  • MESSAGE iCount "customers found" VIEW-AS
    ALERT-BOX.

9
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

10
The new Debugger
  • A brand new Debugger was introduced in OE 10
    (actually 9.1D05)
  • You must enable the Debugger in OE10

11
Enabling the Debugger in OE10
12
The Open Edge 10 Debugger
  • The new Debugger now also allows you to trace
    memory leaks
  • Use the debugalert startup parameter to invoke
    it from any message box (demo)
  • Or start from the 4GL (demo)
  • Or attach to a process (demo)
  • Trace a memory leak (demo)
  • Inspect dynamic properties (demo)

13
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

14
Checking memory leaks in 4GL
  • New in OE10 SESSIONFIRST-QUERYhQuery
    SESSIONFIRST-QUERY.DO WHILE VALID-HANDLE(hQuery)
    ASSIGN iQueries iQueries 1. hQuery
    hQueryNEXT-SIBLING.END.
  • SESSIONFIRST-BUFFER already in 9.1B
  • Demo countcustmemcheck1.p

15
Getting more info from the 4GL
  • Remember if you have the handle of an object,
    you can query its attributes
  • For example, for a BUFFER you can find the table
    name
  • For a QUERY you can find the PREPARE-STRING
  • Tip use the NAME and PRIVATE-DATA attributes to
    identify dynamic objects
  • Demo countcustmemcheck2.p

16
What can you check in the 4GL
  • Dynamic BUFFERS and TEMP-TABLES
  • Dynamic QUERIES
  • Dynamic DATASETS and DATA-SOURCES
  • SERVERS and SOCKETS
  • PERSISTENT PROCEDURES
  • Non-modal WINDOWS
  • Demo countcustmemcheck3.p

17
What is still missing in the 4GL
  • SESSIONMEMORY-SIZE
  • SESSIONFIRST-WIDGET-POOL
  • WIDGET-POOLFIRST-OBJECT

Just as well, because all the fun would be gone!
18
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

19
Enhanced logging in OE 10
  • In Open Edge 10 the LOG-MANAGER system handle was
    introduced
  • You can use it dynamically to log resources and
    events in detail
  • The most important attributes for dynamic
    debugging are LOGFILE-NAME and LOG-ENTRY-TYPES

20
LOG-MANAGERLOGFILE-NAME
  • You can only set LOG-MANAGERLOGFILE-NAME once
    per session
  • So you cannot change log files during the session
  • Regrettably it is also not possible to clear the
    log file during the session

21
LOG-MANAGERLOG-ENTRY-TYPES
  • There are many log entry types
  • You can set and unset them during the session
  • Each log entry type can have different logging
    levels
  • I created the Dynamic Debugging Logging
    Settings window to add to your PROTools palette

22
Dynamically SettingLog Entry Types and Logging
Levels
23
Using enhanced logging
  • Demo Switch on the Dynamic Database Objects
    logging type, set the level to 3 or 4 and run
    countcust.p again
  • The log file will show that a dynamic BUFFER and
    dynamic QUERY object are created in an unnamed
    widget pool but not deleted

24
Other useful Log Entry Types
  • 4GLTrace turns on logging for all RUN, FUNCTION,
    PUBLISH and SUBSCRIBE statements.
  • Dynamic UI Objects tells you where dynamic
    widgets are created and deleted in your
    application. Example Track down error 4025
    (Unable to realize widget).

25
Query logging
  • Query Information adds very detailed information
    on dynamic queries. Example track down all
    WHOLE-INDEX queries in your application.
  • You can also log information from individual
    queries by settinghQueryBASIC-LOGGING
    TRUE.Demo countcust4.p

26
Event logging
  • Printable Character Events logs all events
    concerning printable characters.
  • Non-printable UI Events logs events concerning
    non-printable characters and WM GUI events.
  • Other Events logs COM, Async and Sockets events

27
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

28
Analyzing Dynamic Queries
  • You can gather information on your dynamic
    queries using the Query Information Log Entry
    Type
  • During development it would be nice if you could
    analyze your dynamic queries interactively
  • Marius Fiere wrote a Query Tester for this purpose

29
Dynamic Query Tester
  • Publish your QUERY-PREPARE strings
    forinterception by the Query TesterPUBLISH
    QUERY (hQueryPREPARE-STRING).
  • Press the Full Test button for live analysis
  • Demo run countcust3.p

30
Dynamic Query Tester results
  • The Query Tester makes clever use of Dynamic
    Queries and VSTs (IMHO better information than
    DynObjects.DB Logging)
  • The analysis shows that this query cannot use an
    index
  • The Query Tester traps this problem although the
    performance is fine in the development environment

31
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

32
Dynamic Temp-table memory leaks
  • Dynamic temp-tables aremost likely to cause
    memory leaks
  • OUTPUT TABLE-HANDLES are created in the SESSION
    WIDGET-POOL (whether you like it or not)
  • You need to delete those explicitly

33
2 dynamic temp-table memory leaks
OUTPUT TABLE-HANDLE
CREATE TEMP-TABLE
DB
tt-leak1.p
tt-leak2.p
  • tt-leak2.p contains a CREATE TEMP-TABLE statement
    that creates the TEMP-TABLE in the current
    WIDGET-POOL
  • The temp-table received by tt-leak1.p is created
    in the SESSION WIDGET-POOL

34
LOG-MANAGER information
  • Demo Switch on Dynamic Database Objects logging
    and run tt-leak1.p
  • The log shows that the following objects are
    created but not deleted

35
Dynamic Temp-Table Viewer
  • Lets you examine dynamic temp-tables in memory
  • Download tool from www.v9stuff.com
  • It shows only one memory leak
  • Can you explain why?
  • Can you find out how?

36
Agenda
  • Creating memory leaks in the 4GL
  • The new Debugger
  • Checking for memory leaks in 4GL
  • Enhanced logging in OE10
  • Dynamic Query Tester
  • Dynamic Temp-table Viewer
  • Dynamic AppServer debugging

37
AppServer Debugging
  • Enhanced Debugging is also available in AppServer
    environments
  • Logging information is written to the normal log
    files
  • When you hunt for memory leaks, you sometimes
    want to inspect the memory of these remote
    Progress sessions
  • You can do this by splitting the memory checker
    in a client part and a server part

38
Checking AppServer memory
Getappsmeminfo1.p
Getappsmeminfo2.p
DB
(Web)Client
AppServer
  • The AppServer program takes a snapshot of
    AppServer memory usage and returns the result to
    the client for further processing

39
Publishing debug information
  • Instead of adding and removing debug messages in
    your code, you can PUBLISH the information
  • At any point in time you candecide to subscribe
    to it andprocess the information
  • This could mean display on aclient, write to a
    log file on theserver, analyze etc.
  • I use standard debug levels Demo

40
The new Debugger
  • In OpenEdge 10.0B you can now also attach the
    debugger to an AppServer process anywhere on your
    network!

41
Conclusion
  • Open Edge 10 provides you with a spectrum of
    tools that can help you troubleshoot dynamic
    programs
  • More capabilities have been added to the 4GL for
    this but there are always wishes left
  • Start exploring the new Debugger
  • Using handles, VSTs and pub/sub you can write
    your own tools

42
More information
  • Progress documentation
  • OpenEdgeTM Development Debugging and
    Troubleshooting
  • OpenEdgeTM Development Progress 4GL Handbook
    (John Sadds latest book)
  • All example programs and tools used in this
    presentation are included on your conference CD
  • www.v9stuff.com
  • Progressions magazine (www.wss.com)
  • Progress Email Group (www.peg.com)

43
Question time
Write a Comment
User Comments (0)
About PowerShow.com