This document covers typical procedures that are helpful during APS application troubleshooting and debugging.
As mentioned in the Task Manager section, a scheduled APS process may contain initiating, provisioning/unprovisioning, and finalizing tasks.
When a process over a resource is started, the APS controller changes the resource status
from the aps:ready
to another, typically aps:provisioning
or aps:unprovisioning
. This protects the resource
from starting another process with it. The APS controller returns the resource status back to aps:ready
by means of the finalizing task. It means you cannot do any operations with the resource until that final task is completed.
For example, if you need to remove a resource because an operation with it failed, try to complete at least
the finalizing task in that failed process. You will be able to do anything with the resource until the finalizing
task is complete.
Note
Be careful when canceling tasks. It is better to cancel failed tasks one by one, than to cancel the whole tree of tasks that depend on each other. This may allow you to complete at least the finalizing task so that you remove the resource.
Diagnostics may consist of several steps. You can finish it on any of the following steps after you clarify the cause of an error.
In the provider control panel, navigate to Operations > Tasks and identify whether there is a task related to your issue. There are many search and sort criteria that you can use:
Status
allows you to find tasks by their status, for example, to find all Rescheduled
or Failed
tasks.
Name
contains the APS application name, allowing you to use a partial name pattern to filter the tasks.
Sorting by ID
helps you to find the latest tasks.
Queue name
helps you filter all APS tasks by the aps_application_instance
prefix. It also contains the
instance ID and subscription ID for narrowing your search.
Investigate closely the execution output of the task. Do not close the screen with this output if you think that some key words in it may help you in your further investigation of backend logs.
Get connected to the management node through SSH.
Investigate the respective REST operations in the apsc.http.log
file. If you can repeat the operation, usually by
running the failed task, print out
the log tail with the new appended data. The following command will capture all new log messages and save them in
the test.log
file:
# tail -fn0 /var/log/pa/apsc.http.log > test.log
After the traced operation is finishes, stop the above command execution by pressing the CTRL+C combination on
your keyboard and then open the test.log
file to investigate the collected data.
Keep in mind the log structure and use the following recommendations:
Search by words or phrases from the task execution message.
Search by the REST operation: “POST”, “PUT”, “GET”, or “DELETE”.
If a REST response contains “500 Internal Server Error”, the fault is on the application endpoint side.
To narrow your search, you can send a REST request in the command line interface from the management node.
Get connected to the endpoint host through SSH.
Investigate the Apache error log. Try to identify which custom PHP method caused the issue.
Search for the incorrect code in the suspected PHP file located in the application endpoint folder. To get more details in the error log, use the Development Mode in the PHP script. To localize the error, print more custom data by using the APS PHP Logger class.
To narrow your search, you can send a REST request in the command line interface from the endpoint host.
If you experience a UI issue other than a navigation issue, follow these typical diagnostic steps. Most of them require the Debugging Tools in Browser. In the Chrome DevTools, it looks as follows.
On the Console tab, search for an error message.
Usually, an error message contains a link to the line in the source JavaScript code that caused the error.
On the Network tab, search for failed REST requests. If you find such a request, open its detailed profile and investigate its request and response.
On the Source tab, find the JavaScript file that requires investigation. It is inside one of subfolders
of the /aps/2/packages/
folder.
Use Breakpoints, Data Watch, and Console Commands to isolate the issue in the JavaScript code.
When debugging a code, you must do many edit-and-test operations. The usual application update process is too time consuming. This section explains how to update the code on the system in the most efficient way before you release the APS package.
Preliminarily, it requires that:
ref:debug_tools_mn_devmode is enabled on the system.
The Package Location on the management node is identified.
The Package Location on the endpoint host is identified.
Note
If you change an APS type, you must go through the normal application update process.
Changes in the presentation logic can be done by editing the respective files directly on the management node, in the Package Location:
Metadata in the APP-META.xml
file, for example, navigation section
JavaScript and related files, for example, JSON files, in the ui/
folder
Images, for example, icons, and other custom files, for example, the deployment guide
If you changed metadata or JavaScript code, you need to refresh the user panel on the browser for it to take effect.
If you change the provisioning logic of the APS application instance in the scripts/
folder, apply the changes directly
in the Package Location on the endpoint host.
If the changes do not take effect immediately, remove the typeCache/
subfolder.