Show TOC

Procedure documentationDebugging On Demand Locate this document in the navigation structure

 

Debugging is quite a common task for developers. Often bugs do not occur during development but are found later when the program is delivered. Sometimes it is not even possible to reproduce the error condition on a different test system, and the error has to be analyzed in the original system.

With standard Java virtual machines a developer has to perform the following steps to debug a productive application:

  • Start a VM in debug mode

  • Try to reproduce the problem on this VM

  • Attach the debugger and find the bug

There are two superfluous steps, which make it hard to reproduce the problem. First of all, a VM needs to be started in debug mode. The second problem is that the error condition has to be reproduced, which is difficult because the restarted VM may behave differently.

The SAP JVM greatly facilitates support. If an error occurs, it is possible to analyze this misbehavior directly. No additional steps are required, because the SAP JVM is designed so that it is always prepared to be debuggable. Normally it is running as if debugging is turned off and the performance is (nearly) not affected. When debugging is requested, the debugger backend is started and debug ports are opened. An external debugger can be attached and used.

The benefit of this “on-the-fly” debugging is that the VM can be debugged at any moment of time. If an error occurs, the VM can be switched to debug mode, a debugger can be attached and the situation can be inspected.

The need to set up special debugging VMs as imposed by other virtual machines may be seen as a little overhead that can be done in error cases, but it is important to mention that some bugs cannot be found in a special debugging environment (for example, race conditions). Therefore, the ability to perform on-the-fly debugging can help to solve problems that are normally very hard to detect.

Note Note

Opening a debugger port implicates a great security risk because an attached debugger can read potentially confidential data and follow or even alter the control flow of the program. Where necessary, this port should therefore be protected with a firewall. Refer to note 1029914 for more information.

End of the note.

Procedure

To switch the SAP JVM to debug mode right-click on the suspicious server node in the Management Console and enable debugging in the context menu that appears. Afterwards, the Management Console should indicate that the server node is mow in debug mode. Also, the port number to be used for attaching your Java debugger is shown.

More information: Monitoring and Management Tools