Failed to read SQL trace by user XXX – Internal Error

Symptoms

The customer is seeing the following error with the ABAP agent. In the controller, SQL traces for some snapshots can be seen.

Reason and prerequisites

Firstly, we need confirmation from the customer that SQL traces were in snapshots of Business Transactions coming from the affected system. If the BT comes from a different system, it could mean that tracing does not work on this system at all. We will ask to try the following:

  • Check on the affected system if it is possible to start, stop and display SQL trace using t-code ST05
    •  This will rule out any potential SAP basis issues
    •  If the previous step worked as intended, authorization profile for role /DVD/APPD_USER needs to be regenerated (in the t-code PFCG enter role name /DVD/APPD_USER and press edit, go to Authorizations tab, press Change authorization data, and finally Generate (Shift+F5))
    •  A screenshot of the User tab to compare this list with logs should be included

Solution

It looks like SDK manager and HTTP SDK instances were running; they were either turned off or restarted. This terminated the SDK manager and HTTP SDK instances. ABAP agent of the affected system (and possibly other systems) is not able to operate correctly. In the meantime, we have deactivated the integration in this system to reduce the number of generated log messages. Next steps to be followed:

  1. Check that server itdt121lx.na.paccar.com is active
  2. Start SDK manager (starting it with default parameters should also start all previously running HTTP SDK instances)
  3. Check on the affected system -> /DVD/APPD_STATUS if connection and process statuses are green
  4. Go to /DVD/APPD_CUST -> Edit mode -> Activate integration

This does not have anything to do with trace issues other than the ABAP agent did not attempt to start, stop, and read any traces after HTTP SDK instances were terminated. We have concluded that the SQL read error might come from the system itself. We found performance trace files (ST05 -> Display Trace Directory -> All Traces during some time period). Trace files on the list correspond to user names from application logs where the 'read SQL trace' error message was present. When application log error time is compared to the content of performance log files, trace records for that user are not available around the error timestamp. With this in mind, it looks like a standard SQL trace logic does not provide correct return codes when function modules 'ST05_ACTIVATE_TRACE' and 'ST05_DEACTIVATE_TRACE' are executed. The SQL trace read part is carried out only when both of these function modules are executed successfully with return code (subrc) = 0. Instead of 'read failed', you should see messages like 'trace already started by another user', 'failed to start trace', etc. already when activating or deactivating the trace. In the current state and according to return codes, SQL trace was activated and deactivated, but when the ABAP agent tried to read the trace file, it contained no data. This led to the error message 'Failed to read SQL trace by user XYZ – internal error'. Please check with your basis team there is no trace-related known issues on your kernel and SP level.

More details

After opening the OSS incident, we found out that the authorization role /DVD/APPD_USER for the user is missing. We asked to regenerate the authorization profile for role /DVD/APPD_USER. Any 'cannot start SQL trace' or 'failed to delete ABAP trace' messages are related to the authorization role not being assigned to that user.