R2 connection reset by peer

We have been using AWS S3 for years, but now we plan to gradually switch to R2. Since the R2 API is compatible with S3, the code update required is minimal, and we only need to modify our AWS SDK v1 Golang connection code. However, after a few days of running, we have noticed a significant increase in the number of “connection reset by peer” errors while uploading data. This issue was rare when using AWS S3.

The connection code:

cfg = &aws.Config{
	Endpoint:    aws.String(Conf.R2Endpoint),
	Region:      aws.String("us-east-1"),
	Credentials: credentials.NewStaticCredentials(Conf.R2AccessKey, Conf.R2SecretKey, ""),
svc := session.Must(session.NewSession(cfg))

Anyone has similar experience?