Kbase P149371: How to determine when a hang is actually an infinite loop in 4GL code
Autor |
  Progress Software Corporation - Progress |
Acesso |
  Público |
Publicação |
  7/10/2009 |
|
Status: Unverified
GOAL:
How to determine when a hang is actually an infinite loop in 4GL code
GOAL:
When a hang is not a hang
GOAL:
How to determine when a hang is actually an infinite loop in ABL code
GOAL:
How to debug a hung process
FACT(s) (Environment):
CTRL-BREAK ends apparent hang
CTRL-C ends apparent hang
All Supported Operating Systems
Progress/OpenEdge Product Family
FIX:
Many times users may observe apparent hangs in their Progress/OpenEdge applications only to find out later that they are actually caused by some condition, such as an infinite loop, in their application.
An actual hang, as defined here, is a condition where the application is completely unresponsive to any effort by the user except killing the process or using CTRL-\ in *NIX.
The first thing the user should try when faced with an apparent hang is to hit CTRL-BREAK on Windows or CTRL-C on *NIX. This should effectively stop application processing and return the process to the previous screen or the procedure editor. The point is, however it ends up affecting application processing, if it DOES affect application processing, it is very likely that what you're faced with is not a hang per se but rather an infinite loop in your code.
Don't be misled by the effects of environmental factors on the problem. Some users note that. "When connected to database <a> the problem doesn't occur but when connected to database <b> it does". This may mislead the investigator to believe there is possible data/index corruption involved. This does not rule out the possibility of such corruption but brings to light a process (which could certainly be caused by corruption) which went down an unexpected code path and ended up stuck there.
When you find yourself in such a situation, do the following to narrow down the problem:
- Start by using CTRL-BREAK (Windows) or CTRL-C (*NIX) in order to determine what you're dealing with. Chances are it's an infinite loop or you're stuck at some WAIT-FOR
- Next start with some logging, such as 4GLTrace, to narrow down where in the code the problem might be happening
- The next step, once you know what program the problem is happening in, you want to narrow down the cause. This could be a long running database fetch operation, an infinite loop, an errant WAIT-FOR, a legitimate hang or etc, etc, etc...
If CTRL-BREAK or CTRL-C helped you at least know that it's not likely to be a database fetch operation or a legitimate hang. That's the good news because you can generally isolate the cause and fix it. If the problem is related to a long running database fetch operation you should follow the usual steps to analyze the query performance. This may put the problem on the code (e.g. inefficient index selection) or on the database (problems or not enough resource allocation).
In any event the next step is to use a combination of debug messages and the debugger to narrow down the line of code where the problem is happening.