fix(infinity): avoid hangs with pooled connections and bounded timeouts (#17287)

### Summary

**Issue**
When calling Infinity under concurrent load, one shared connection was
reused across concurrent operations, it just hangs.
 

**Solution**
Avoid hangs with pooled connections and bounded timeouts
This commit is contained in:
qinling0210
2026-07-23 20:37:38 +08:00
committed by GitHub
parent 4dfa5b145b
commit a84d2ae3d2
10 changed files with 461 additions and 129 deletions

View File

@@ -21,63 +21,65 @@ import "errors"
type ErrorCode int
const (
CodeSuccess ErrorCode = 0
CodeLackResources ErrorCode = 1
CodeNotEffective ErrorCode = 10
CodeExceptionError ErrorCode = 100
CodeArgumentError ErrorCode = 101
CodeDataError ErrorCode = 102
CodeOperatingError ErrorCode = 103
CodeTimeoutError ErrorCode = 104
CodeConnectionError ErrorCode = 105
CodeRunning ErrorCode = 106
CodeResourceExhausted ErrorCode = 107
CodePermissionError ErrorCode = 108
CodeAuthenticationError ErrorCode = 109
CodeParamError ErrorCode = 110
CodeLicenseValid ErrorCode = 320
CodeLicenseInactiveError ErrorCode = 321
CodeLicenseExpiredError ErrorCode = 322
CodeLicenseDigestError ErrorCode = 323
CodeLicenseTimeRollback ErrorCode = 324
CodeLicenseNotFound ErrorCode = 325
CodeLicenseUnexpectedError ErrorCode = 326
CodeBadRequest ErrorCode = 400
CodeUnauthorized ErrorCode = 401
CodeForbidden ErrorCode = 403
CodeNotFound ErrorCode = 404
CodeConflict ErrorCode = 409
CodeServerError ErrorCode = 500
CodeNotImplemented ErrorCode = 501
CodeSuccess ErrorCode = 0
CodeLackResources ErrorCode = 1
CodeNotEffective ErrorCode = 10
CodeExceptionError ErrorCode = 100
CodeArgumentError ErrorCode = 101
CodeDataError ErrorCode = 102
CodeOperatingError ErrorCode = 103
CodeTimeoutError ErrorCode = 104
CodeConnectionError ErrorCode = 105
CodeRunning ErrorCode = 106
CodeResourceExhausted ErrorCode = 107
CodePermissionError ErrorCode = 108
CodeAuthenticationError ErrorCode = 109
CodeParamError ErrorCode = 110
CodeConnectionPoolExhausted ErrorCode = 111
CodeLicenseValid ErrorCode = 320
CodeLicenseInactiveError ErrorCode = 321
CodeLicenseExpiredError ErrorCode = 322
CodeLicenseDigestError ErrorCode = 323
CodeLicenseTimeRollback ErrorCode = 324
CodeLicenseNotFound ErrorCode = 325
CodeLicenseUnexpectedError ErrorCode = 326
CodeBadRequest ErrorCode = 400
CodeUnauthorized ErrorCode = 401
CodeForbidden ErrorCode = 403
CodeNotFound ErrorCode = 404
CodeConflict ErrorCode = 409
CodeServerError ErrorCode = 500
CodeNotImplemented ErrorCode = 501
)
var errorMessages = map[ErrorCode]string{
CodeSuccess: "Success",
CodeNotEffective: "Not effective",
CodeExceptionError: "System exception",
CodeArgumentError: "Invalid argument",
CodeDataError: "Data error",
CodeOperatingError: "Operation error",
CodeTimeoutError: "Timeout",
CodeConnectionError: "Connection error",
CodeRunning: "System running",
CodeResourceExhausted: "Resource exhausted",
CodePermissionError: "Permission denied",
CodeAuthenticationError: "Authentication failed",
CodeParamError: "Invalid parameters",
CodeLicenseValid: "License valid",
CodeLicenseInactiveError: "License inactive",
CodeLicenseExpiredError: "License expired",
CodeLicenseDigestError: "License digest error",
CodeLicenseTimeRollback: "License time rollback detected",
CodeLicenseNotFound: "License not found",
CodeLicenseUnexpectedError: "Unexpected license error",
CodeBadRequest: "Bad request",
CodeUnauthorized: "Unauthorized",
CodeForbidden: "Forbidden",
CodeNotFound: "Resource not found",
CodeConflict: "Resource conflict",
CodeServerError: "Internal server error",
CodeSuccess: "Success",
CodeNotEffective: "Not effective",
CodeExceptionError: "System exception",
CodeArgumentError: "Invalid argument",
CodeDataError: "Data error",
CodeOperatingError: "Operation error",
CodeTimeoutError: "Timeout",
CodeConnectionError: "Connection error",
CodeRunning: "System running",
CodeResourceExhausted: "Resource exhausted",
CodePermissionError: "Permission denied",
CodeAuthenticationError: "Authentication failed",
CodeParamError: "Invalid parameters",
CodeConnectionPoolExhausted: "Connection pool exhausted",
CodeLicenseValid: "License valid",
CodeLicenseInactiveError: "License inactive",
CodeLicenseExpiredError: "License expired",
CodeLicenseDigestError: "License digest error",
CodeLicenseTimeRollback: "License time rollback detected",
CodeLicenseNotFound: "License not found",
CodeLicenseUnexpectedError: "Unexpected license error",
CodeBadRequest: "Bad request",
CodeUnauthorized: "Unauthorized",
CodeForbidden: "Forbidden",
CodeNotFound: "Resource not found",
CodeConflict: "Resource conflict",
CodeServerError: "Internal server error",
}
func (e ErrorCode) Message() string {