Kbase P112486: How to produce a stack trace for a running process without killing it
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  18/03/2009 |
|
Status: Verified
GOAL:
How to produce a stack trace for a running process without killing it
GOAL:
Which signal should be used to produce a stack trace for a running process without killing it
FACT(s) (Environment):
UNIX
Progress/OpenEdge Versions
FIX:
Under UNIX, it is possible to send a running OpenEdge process (_progres, _proapsv, etc) a signal so that the process will generate a C stack trace and then just resume execution.
This is particularly useful in case you have runaway processes and you want to know exactly in which functions the process is spinning, or to understand what a "stuck" process is actually waiting for: a message from the network? A user-interface interaction?
The signal that allows you to do that is SIGUSR1. Usually you can use the following syntax from the OS prompt:
kill -SIGUSR1 <PID>
That will produce a file named protrace.<PID> in the process's working directory; the file protrace.<PID> will contain a readable stack trace.
As with any other signal, you are allowed to send SIGUSR1 to a specific process only if you are root, or belong to the same UNIX group as the user under which the process is running. Before running, make sure the PID exists. DON'T pass 1 as the PID, ?1 is the ?init?process. Make sure the PID has no children ? this is often overlooked.
SIGUSR1 translates to the following signals for the following operating systems:
Operating Signal
System Number
--------------- ------
AIX 30(*)
HP-UX 16
HP Tru64 30
RedHat Linux 10
Solaris 16
UnixWare N/A
(*) Please note that under AIX this feature is only available starting with OpenEdge 10.1A; in previous releases, Progress executables are built to simply ignore SIGUSR1.
For example, under RedHat Linux, issuing kill -SIGUSR1 is the same as issuing kill -10.
Under UnixWare, SIGUSR1 maps to signal 16, but the stack traces obtained by issuing kill -16 are of no use.
This all assumes that SIGUSR1 is not being trapped in the shell executing the cmd. Type ?trap?at the command line to see if your shell has any traps set
If you trap is set at the shell level, Progress will never get the signal, so the UNIX trap command needs to be removed from scripts used to invoke _progres or any other Progress/OpenEdge executables.
Since OpenEdge 10.1C ehancements were introduced to protrace output for ABL stack trace (OE00147006) whenever the client generates a protrace file it includes the ABL stack trace and the list of persistent procedures or classes that are in memory, along with their handle IDs. This enhancement is available on both UNIX and WINDOWS platforms. Please refer to Solution P134912, "What is proGetStack?"