All Products
Search
Document Center

Object Storage Service:I often encounter network exceptions when I try to access OSS buckets. How do I fix this?

Last Updated:Aug 20, 2026

Network exceptions usually happen because an incorrect endpoint is used to access Object Storage Service (OSS) or network connectivity on the client side is poor. This topic describes how to troubleshoot network exceptions in OSS.

Background information

A response from OSS, even one with an HTTP status code other than 200, confirms that your client is connected to the service. For these issues, obtain the request ID from the OSS response and use the OSS Self-service Diagnostics Tool to diagnose the problem. For more information about how to obtain a request ID, see Obtain request IDs.

In this topic, network exceptions refer to issues that cause requests to be dropped before they are received by OSS. To determine whether a request is received by OSS, you can try to retrieve its request ID. If you can retrieve its ID, the request is received by OSS.

Connection refused

Causes

  • Your client and the OSS bucket are not in the same region's Alibaba Cloud internal network. You can use an internal endpoint to access OSS only from an Alibaba Cloud service in the same region as the bucket. For example, if you have a bucket in the China (Hangzhou) region, you can access it from an ECS instance in the China (Hangzhou) region by using the oss-cn-hangzhou-internal.aliyuncs.com endpoint. For more information about endpoints, see Regions and endpoints.

  • Your client is in the same region as the bucket, but the configurations of your client may cause network exceptions. For example, specific ports are closed on the client.

  • You are accessing an OSS endpoint in the Chinese mainland from outside the Chinese mainland, or vice versa. Unstable cross-border network links can cause connection timeouts or refusals.

Solutions

  • Check whether the endpoint configured for your client is an internal endpoint (contains the word "internal"). If yes, switch the endpoint to a public endpoint. If your request is successfully sent through the public endpoint, your client does not support the use of internal endpoints.

  • Use the ping command to test the network connectivity between your client and the public endpoint for the region in which the bucket is located. For example, you can use ping oss-cn-hangzhou.aliyuncs.com to test the network connectivity between your client and OSS in the China (Hangzhou) region. If the ping fails, use the telnet command to test whether port 80 or 443 is available.

  • For cross-border access scenarios, enable Transfer Acceleration and use the transfer acceleration endpoint (oss-accelerate.aliyuncs.com) to access OSS. This improves the stability and speed of data transfer across regions. For more information, see Access OSS by using Transfer Acceleration.

ConnectionTimeOut

Causes

  • Your network is managed by an edge node of your Internet service provider (ISP), and connectivity issues cause requests to be dropped.

  • The upload of large objects is not completed within the configured timeout period.

  • The configured timeout period is too short.

Solutions

  • Enable CDN acceleration and use CDN POPs to accelerate data transfers. This reduces the impact of the ISP network on data transfer quality for mobile phones and PCs.

  • Use multipart upload or resumable upload. Set the size of each part to no more than 1 MB. For more information, see Multipart upload, Resumable upload (Java SDK V1), and Resumable upload (Python SDK V1).

  • Configure a longer timeout period and enable retries on failed uploads. For sample code in various programming languages, see Overview.

For more information about how to handle network timeouts, see Handling network timeouts.

Socket timeout or Socket closed

Cause

The connection has timed out.

Solution

Increase the timeout period. For example, you can use ClientConfiguration.setSocketTimeout in OSS SDK for Java to set the timeout period for data transmission at the socket layer. For sample code in various programming languages, see Overview.

Connection reset

Causes

  • The network connection on the client side is abnormal.

  • An incorrect endpoint is specified in your code.

  • The bucket that you want to access is moved into the sandbox due to attacks or content compliance violations.

  • The domain name of the bucket is hijacked.

Solutions

  • Check whether the network connection on the client side is normal.

    On the affected device, use the ping command to test connectivity to the OSS endpoint for the corresponding region. Alternatively, use the Alibaba Cloud DNS diagnosis tool to check for network anomalies. Resolve any network issues that you find.

  • Check the endpoint in your code.

    If the client-side network is working correctly, use the ping command to test the OSS endpoint specified in your code to verify its spelling. For more information about endpoints, see Regions and endpoints.

    Note

    The endpoint in your code must include the protocol, for example, https://oss-cn-hangzhou.aliyuncs.com.

    For sample code in various programming languages, see Overview.

  • Check whether the bucket is moved into the sandbox.

    If the bucket is moved into the sandbox, the bucket can still respond to requests, but the service quality is degraded. For more information, see OSS sandbox.

  • Capture packets for troubleshooting.

    If the preceding checks do not resolve the issue, use a tool such as Wireshark to perform a packet capture, and then contact OSS technical support with the capture file for further investigation.