Common errors

更新时间:
复制 MD 格式

This topic describes common errors in PTS, their causes, and solutions.

Common error messages

class java.net.ConnectException:null

This error indicates that a request failed to establish a TCP connection with the server under test or was rejected by it. Check the health of the backend server and for any bottlenecks in the network connection layer.

org.apache.http.ConnectionClosedException:Connection closed

This error indicates that the server actively terminated the connection.

org.apache.hc.core5.http.ConnectionClosedException:Connection is closed

This error occurs when a request is sent over a connection that has already been closed by the server. Check for bottlenecks in gateway bandwidth or the number of connections.

java.io.IOException:Connection reset by peer

This error indicates that the connection was reset by the backend server. If you are using an SLB instance, check its configuration.

org.apache.http.ConnectionClosedException:Connection closed unexpectedly

This error indicates that the connection was closed before all data was received. Possible causes include the server not responding in time or premature termination of the debugging or performance test.

java.lang.RuntimeException:java.net.UnknownHostException

This error indicates that the specified domain name could not be resolved. Verify that the domain name is registered and resolves correctly. If the domain name is not registered, ensure that you have configured a domain name binding.

org.apache.http.client.CircularRedirectException

This error indicates that the request encountered a circular redirect (for example, A -> B -> C -> A) or exceeded the maximum of 10 redirects (for example, A1 -> A2 -> ... -> A10 -> A11). To troubleshoot, disable 302 redirection and run the test again to inspect the original request information. You can also use the timing waterfall to view the specific redirect path.

  • Disable 302 redirects: On the Scene Configuration page, turn off the **Allow 302 Redirection** switch.vr

  • View the redirect path in the timing waterfall: In the performance test report, you can find the timing waterfall in the sampling log details. For more information, see View Sampling Logs.

org.apache.hc.core5.http.ProtocolException:Header 'key: value' is illegal for HTTP/2 messages

This error occurs when the server prioritizes the HTTP/2 protocol, but the scene configuration includes headers that are not supported by HTTP/2. Remove the unsupported headers and try again. Common headers not supported by HTTP/2 include: Connection, Keep-Alive, Proxy-Connection, Transfer-Encoding, Host, and Upgrade.

java.nio.channels.CancelledKeyException:null

This error indicates that, under the HTTP/2 protocol, the backend server actively terminated the connection. Investigate the backend server for potential issues.

java.util.concurrent.TimeoutException:null

Connection timeout. This error indicates that a request failed to establish a TCP connection with the server under test or was rejected. You can use the timing waterfall to check if the connection phase is excessively long. As shown in the figure, the timing waterfall indicates a long connection phase. In this case, check the health of the backend server and for any bottlenecks in the network connection layer.

org.apache.hc.core5.http2.H2StreamResetException:Timeout due to inactivity (5000 MILLISECONDS) * class

Response timeout. This error indicates that the server response timed out. The default request timeout in PTS is 5 seconds. You can set a longer request timeout on the Advanced Settings tab of the scene creation page. For more information, see General Settings.

java.net.SocketTimeoutException:null

Response timeout. This error indicates that the request timed out while waiting for a response or during an idle period while receiving data. Check the backend server's health and ensure the API's request timeout is adequate. This error can also be caused by bottlenecks in the server's processing capacity.

java.lang.RuntimeException: Could not find the TestPlan class!

The JMeter script is incompatible with the JMeter version supported by PTS. Edit the script using JMeter 5.0.

java.lang.SecurityException: class "xxx"'s signer information does not match signer information of other classes in the same package

The ApacheJMeter_core or ApacheJMeter_java dependency used by the Java Sampler in the JMeter script is incompatible with the JMeter 5.0 version supported by PTS. Repackage the JAR file using JMeter 5.0 dependencies and try again.

Attempt to resolve method: xxx() on undefined variable or class name:

This error indicates that a class required by the BeanShell Sampler in the JMeter script was not uploaded. Upload the required JAR files and try again.

class java.lang.IllegalArgumentException:forbidden uri, uri host must match vpc cidr pattern 10.0.0.0/8, 172.16.0.0/12 or 192.168.0.0/16

This error indicates that you are performing performance testing within a VPC, but the domain name in the test URL resolves to an IP address outside the allowed private CIDR blocks. You must use a private IP address for the test, or configure DNS resolution in the PTS console to map the domain name to a private IP address.

Common response error codes

403 (Forbidden)

A 403 status code usually indicates that the server received the request but rejected it due to insufficient permissions.

Possible cause 1

Your backend server's authentication settings are rejecting the request. In this case, the error is caused by your application's business logic.

Solution: Check your application's authentication mechanism.

Possible cause 2

The server's gateway performs strict validation of the User-Agent (UA) in the request header and rejects requests with an invalid UA. By default, requests from PTS include a special identifier in the UA to help applications distinguish test traffic for statistical or throttling purposes.

Solution

  1. Log on to the PTS console. In the navigation pane on the left, choose performance testing > scene list.

  2. Find your test scene and click Edit in the Actions column. On the Scene Configuration page, go to the Header Definition tab and add a generic UA header, as shown below.

    • Key: User-Agent

    • Value: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/72.0.3626.109 Safari/537.36

    we

  3. Click Debug Scenario and check the Request Details page to see if the request is successful. If the request is successful after you change the UA, the error was caused by UA validation. You can proceed with the performance test by using the modified UA.

Possible cause 3

The request was blocked by a Web Application Firewall (WAF), though this is an uncommon cause for a 403 error.

Solution

If you use a WAF allowlist, configure rules to allow traffic from PTS. For more information, see What do I do if performance test traffic from PTS cannot directly access my web application due to security policies?.

Possible cause 4

The domain name used for the test does not have an ICP filing, or it resolves to another domain name that does not have an ICP filing.

Solution: You can determine whether the domain name has an ICP filing based on the response. If you receive a 403 error with the following HTML content, the cause is a missing ICP filing. Complete the ICP filing for your domain name before proceeding.

<html>
<head>
<meta http-equiv="Content-Type" content="textml;charset=UTF-8" />
   <style>body{background-color:#FFFFFF}</style>
<title>TestPage184</title>
  <script language="javascript" type="text/javascript">
         window.onload = function () {
           document.getElementById("mainFrame").src= "http://****.aliyun.com/alww.html";
            }
</script>
</head>
  <body>
    <iframe style="width:860px; height:500px;position:absolute;margin-left:-430px;margin-top:-250px;top:50%;left:50%;" id="mainFrame" src="" frameborder="0" scrolling="no"></iframe>
    </body>
</html>

405 (Method Not Allowed)

A 405 error can occur for several reasons:

  1. A POST request is followed by a 302 redirect. Because a 302 redirect can change the request method, the server might not recognize the new method and returns a 405 error.

  2. The server directly validates the request method. The response header may contain a field such as Allow: GET.

  3. A load balancer or web server modified the request method during forwarding, causing the backend server to reject it.

406 (Not Acceptable)

This client error indicates that the server cannot generate a response matching the types specified in the request's Accept headers.

Possible cause

If a 406 error occurs during debugging, it is usually because the Accept field is incorrectly set in the Header definition.

  • Accept: Specifies the data types that the client (in this case, PTS) is willing to accept.

  • Content-Type specifies the data type of the entity data sent by the sender (PTS). The Content-Type set in the Body Definition on the PTS Scene Configuration page is automatically synchronized to the Header Definition. If the Accept header in the Header Definition does not match the expected value, a 406 error is returned.

ru

Solution

Confirm which Accept types your server supports by testing different values. The following table lists common Accept format types and their matching order for your reference.

Table 1. Accept application rules

Format type

Description

text/html

HTML format

text/plain

Plain text format

text/xml

XML format

image/gif

GIF image format

image/jpeg

JPG image format

image/png

PNG image format

application/xhtml+xml

XHTML format

application/xml

XML data format

application/atom+xml

Atom XML syndication format

application/json

JSON data format

application/pdf

PDF format

application/msword

Word document format

application/octet-stream

Binary stream data, such as for file downloads.

application/x-www-form-urlencoded

The default encType in <form encType="">. Form data is encoded as key/value pairs and sent to the server. This is the default format for form submissions.

When the Accept header is application/xml, text/html, application/json

The produces media types are matched in the following order:

application/xml > text/html > application/json

When the Accept header is application/xml;q=0.3, application/json;q=0.8, text/html

The produces media types are matched in the following order:

text/html > application/json > application/xml

Note

The q parameter is a quality factor for the media type. A higher number (from 0 to 1) indicates a higher priority.

When the Accept header is */*, text/*, text/html

The produces media types are matched in the following order:

text/html > text/* > */*

503 (Service Unavailable)

Possible cause 1

The backend server is overloaded and refusing new requests.

Solution: Check the backend server for relevant error logs.

Possible cause 2

As shown in the following figure, you may see a large number of 503 errors in the PTS sampling log details, but no corresponding information on the backend server.

The error is returned by the SLB instance if your performance testing scenario meets all the following conditions:

  • The API uses HTTP or HTTPS.

  • The entry point for the test environment is an SLB instance, which can be a public-facing SLB or an internal SLB.

  • The backend service did not return a 503 error and may not have logged the requests.

  • The 503 error message is identical to the following:

    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <html>
    <head><title>503 Service Temporarily Unavailable</title></head>
    <body bgcolor="white">
    <h1>503 Service Temporarily Unavailable</h1>
    <p>The server is temporarily unable to service your request due to maintenance downtime or capacity problems. Please try again later.</body>
    </html>

This issue can occur when a limited number of source IPs are used, which may trigger the per-proxy throttling limit of the SLB cluster. It can also be caused by the default use of persistent connections, which may prevent the SLB instance from distributing the load evenly when source IPs are scarce.

Note

By default, PTS and your server use persistent connections.

Solution

There are several solutions:

  1. Upgrade your PTS resource pack. The purchased resource pack may provide too few source IPs for your needs. For example, the trial resource pack provides only one source IP. Upgrading to a different resource pack provides more source IPs for performance testing. For more information about resource pack versions, see Resource Plan Pricing.

  2. Use the IP expansion feature provided by PTS. For more information, see Expand Stressors.

  3. Set a higher target for concurrency or RPS. For more information, see Stress Model.

  4. On the Scene Configuration page, go to the Header Definition tab and add the Connection: close header. After you save the configuration, this setting applies by default to any new APIs added to the scene. You can modify it as needed.qr

504 (Gateway Timeout)

Possible cause

The backend server timed out while responding.

Solution

Verify that the backend server is functioning correctly. You can then extend the timeout period at the gateway or set a custom request timeout on the Advanced Settings tab of the scene creation page.