Configure the timeout settings

You can set appropriate timeout values for session, transaction and request of each application in the following areas:

  1. (Before deployment) In the PowerServer project painter > Build page > Basic tab.

  2. (After deployment) In the compiled Web APIs > AppConfig folder > Applications.json > "Applications" (or in the solution > UserExtensions project > AppConfig > Applications.json > "Applications").

          ...
          "Transaction": {
            "Timeout": 120,
            "TransactionException": true
          },
          "Session": {
            "Timeout": 3600
          },
          "Request": {
            "Timeout": 3600
          },
          ...

Transaction timeout

PowerServer supports COMMIT and ROLLBACK transaction management statements, and the transaction timeout setting here can force a transaction to roll back and release database resource.

The transaction timeout can be disabled by setting the timeout value to 0; it is recommended that you set the timeout interval to a small non-0 value (1 to 3600), because a small transaction timeout value can prevent:

  • Database locking. When a PowerServer Web or PowerServer mobile application closes abnormally, the active transaction in it can neither commit nor roll back.

  • Application locking. If an application is deadlocked, other applications cannot proceed.

The default value is 120 seconds. Transaction timeout should be less than session timeout.

If transaction timeout in the application database is set to 1800 seconds, then the transaction timeout here should be set to 1810 or larger. If transaction timeout in the application database is not set, then transaction timeout here should be set to a number greater than the maximum time needed to execute regular database operations for the application, suppose the most time-consuming table query operation takes 3000 seconds to complete, then transaction timeout should be set to 3010 or larger.

Session timeout

A session starts when the user sends a request to load the application, and ends if the user closes the application or has not sent any requests to the server during the "session timeout" period.

  • By default, the timeout period for a session is 3600 seconds. Session timeout period should be greater than the transaction timeout period. Generally speaking, the session timeout period should not be smaller than 3600 seconds.

  • You can set a timeout interval that is shorter or longer than the default setting. The session timeout can be disabled by setting the timeout value to 0. This is not recommended because it will eventually exhaust system resources until old sessions are cleared out when server is restarted.

Request timeout

It takes time for each request to receive response from PowerServer especially when the server is busy or the bandwidth is low. Requests will queue a while to get the server response. Set a proper request timeout value regarding to the application and network condition. Request will be aborted when the time waiting for response exceeds the value specified here.

  • By default, the timeout period for receiving data is 3600 seconds.

  • You can set a timeout interval shorter or longer than the default setting. It is required to input a whole number within the range from 60 to 7200.

Command timeout

Specify the wait time before terminating the attempt to execute a command and throwing an error. The default value is 30 seconds. You should set values based on the actual needs, for example, if the SQL query would take more than 30 seconds to parse, you should increase the timeout value accordingly, otherwise, the data operations will fail when timeout value is reached. Setting appropriate timeout period for commands can reduce the occurrence of database deadlock and block.

You can set the command timeout value for each database connection in the project painter > Database page > Basic tab > More button > Advanced dialog > Command Timeout.

You can also change the command timeout value for each database connection cache in the compiled Web APIs > AppConfig folder > Applications.json > "Connections" (or the solution > UserExtensions project > AppConfig > Applications.json > "Connections"):

  "Connections": {
    "Default": {
      "sales": {
        "ConnectionType": "Odbc",
        "OdbcName": "PB Demo DB V2025",
        "OdbcDriver": "SqlAnywhere",
        "UserID": "dba",
        "Password": "eyJQYXl******",
        "CommandTimeout": 30,
        "SecurityOptions": null,
        "OtherOptions": null,
        "DynamicConnection": false
      },
      ......