How to generate call stacks of SAP HANA threads?
In few scenarios, the information in views like M_SERVICE_THREADS is not adequate for understanding what the threads are actually doing. Additionally, it may happen that SELECTs from SAP HANA monitoring views no longer functions when SAP HANA is stuck.
In these cases, it is advisable to generate the call stacks of the active threads. This SAP doc lists which options exist for that purpose.
Solution:
The options listed below exist for generating the SAP HANA call stacks:
Approach |
Scenario |
Details |
M_SERVICE_THREAD_CALLSTACKS |
SQL connection reqired |
The SAP HANA monitoring view M_SERVICE_THREAD_CALLSTACKS can be queried for determining the call stacks of running threads. |
SQL: "HANA_Threads_Callstacks" |
SQL connection required |
This command permits to aggregate information from M_SERVICE_THREAD_CALLSTACKS in several ways. This makes it easier to determine popular call stacks which are identical for various threads. |
SAP HANA Studio |
SQL connection possible |
In SAP HANA Studio the user can check the call stacks of individual active threads by activating the appropriate check box. |
hdbcons |
no SQL connection required |
For all active threads, this hdbcons command dumps the call stacks. |
hdbcons |
no SQL connection required |
This hdbcons command generates a SAP HANA runtime dump that encompasses call stacks and other information such as thread activities and monitoring view content. |
hdbcons |
no SQL connection required |
The kernel profiler trace takes multiple snapshots of SAP HANA thread activities and also provides a DOT file with a graphical presentation of the call stack hierarchies. |
SAP HANA Studio |
no SQL connection required |
The full system info dump retrieves comprehensive system and trace information and can be used for configuring to collect implicitly also runtime dumps. |
Linux command |
no SQL connection required |
Incase all the SAP HANA related methods for capturing call stacks fail, user can then use the Linux command gstack for that purpose. |
Linux |
no SQL connection required |
User can verify the call stacks of individual threads by displaying stack information in the virtual /proc file system. User can proceed as follows: |