Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix memory leak bug #137

Merged
merged 1 commit into from
Nov 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [3.7, 3.8, 3.9]
python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"]

steps:
- uses: actions/checkout@v2
Expand Down
4 changes: 4 additions & 0 deletions csharp/core/Client.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1723,8 +1723,10 @@ public Dictionary<string, object> DoRequest(Params params_, OpenApiRequest reque
}
else
{
string anything = AlibabaCloud.TeaUtil.Common.ReadAsString(response_.Body);
return new Dictionary<string, object>
{
{"body", anything},
{"headers", response_.Headers},
{"statusCode", response_.StatusCode},
};
Expand Down Expand Up @@ -1987,8 +1989,10 @@ public async Task<Dictionary<string, object>> DoRequestAsync(Params params_, Ope
}
else
{
string anything = AlibabaCloud.TeaUtil.Common.ReadAsString(response_.Body);
return new Dictionary<string, object>
{
{"body", anything},
{"headers", response_.Headers},
{"statusCode", response_.StatusCode},
};
Expand Down
4 changes: 2 additions & 2 deletions csharp/core/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,5 @@
// Build Number
// Revision
//
[assembly : AssemblyVersion("0.1.6.0")]
[assembly : AssemblyFileVersion("0.1.6.0")]
[assembly : AssemblyVersion("0.1.7.0")]
[assembly : AssemblyFileVersion("0.1.7.0")]
4 changes: 2 additions & 2 deletions csharp/core/client.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
<PackageReference Include="AlibabaCloud.TeaUtil" Version="0.1.15"/>
<PackageReference Include="AlibabaCloud.TeaUtil" Version="0.1.17"/>
<PackageReference Include="Aliyun.Credentials" Version="1.3.2"/>
<PackageReference Include="AlibabaCloud.OpenApiUtil" Version="1.1.1"/>
<PackageReference Include="Tea" Version="1.0.11"/>
<PackageReference Include="AlibabaCloud.GatewaySpi" Version="0.0.2"/>
<PackageReference Include="AlibabaCloud.TeaXML" Version="0.0.3"/>
<PackageReference Include="AlibabaCloud.TeaXML" Version="0.0.5"/>
</ItemGroup>
</Project>
9 changes: 7 additions & 2 deletions golang/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,13 @@
package client

import (
"io"

spi "github.com/alibabacloud-go/alibabacloud-gateway-spi/client"
openapiutil "github.com/alibabacloud-go/openapi-util/service"
util "github.com/alibabacloud-go/tea-utils/v2/service"
xml "github.com/alibabacloud-go/tea-xml/service"
"github.com/alibabacloud-go/tea/tea"
credential "github.com/aliyun/credentials-go/credentials"
"io"
)

type GlobalParameters struct {
Expand Down Expand Up @@ -1476,8 +1475,14 @@ func (client *Client) DoRequest(params *Params, request *OpenApiRequest, runtime
}, &_result)
return _result, _err
} else {
anything, _err := util.ReadAsString(response_.Body)
if _err != nil {
return _result, _err
}

_result = make(map[string]interface{})
_err = tea.Convert(map[string]interface{}{
"body": tea.StringValue(anything),
"headers": response_.Headers,
"statusCode": tea.IntValue(response_.StatusCode),
}, &_result)
Expand Down
2 changes: 1 addition & 1 deletion java/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
<dependency>
<groupId>com.aliyun</groupId>
<artifactId>tea-util</artifactId>
<version>0.2.16</version>
<version>0.2.21</version>
</dependency>
<dependency>
<groupId>com.aliyun</groupId>
Expand Down
108 changes: 70 additions & 38 deletions java/src/main/java/com/aliyun/teaopenapi/Client.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ public class Client {
public String _endpointRule;
public java.util.Map<String, String> _endpointMap;
public String _suffix;
public String _key;
public String _cert;
public String _ca;
public Integer _readTimeout;
public Integer _connectTimeout;
public String _httpProxy;
Expand All @@ -41,6 +38,9 @@ public class Client {
public java.util.Map<String, String> _headers;
public com.aliyun.gateway.spi.Client _spi;
public GlobalParameters _globalParameters;
public String _key;
public String _cert;
public String _ca;
/**
* Init client with Config
* @param config config contains the necessary information to create a client
Expand Down Expand Up @@ -79,9 +79,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
this._method = config.method;
this._regionId = config.regionId;
this._userAgent = config.userAgent;
this._key = config.key;
this._cert = config.cert;
this._ca = config.ca;
this._readTimeout = config.readTimeout;
this._connectTimeout = config.connectTimeout;
this._httpProxy = config.httpProxy;
Expand All @@ -93,8 +90,23 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
this._signatureVersion = config.signatureVersion;
this._signatureAlgorithm = config.signatureAlgorithm;
this._globalParameters = config.globalParameters;
this._key = config.key;
this._cert = config.cert;
this._ca = config.ca;
}

/**
* Encapsulate the request and invoke the network
* @param action api name
* @param version product version
* @param protocol http or https
* @param method e.g. GET
* @param authType authorization type e.g. AK
* @param bodyType response body type e.g. String
* @param request object of OpenApiRequest
* @param runtime which controls some details of call api, such as retry times
* @return the response
*/
public java.util.Map<String, ?> doRPCRequest(String action, String version, String protocol, String method, String authType, String bodyType, OpenApiRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
TeaModel.validateParams(request, "request");
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
Expand Down Expand Up @@ -123,7 +135,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

TeaRequest _lastRequest = null;
Exception _lastException = null;
TeaResponse _lastResponse = null;
long _now = System.currentTimeMillis();
int _retryTimes = 0;
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
Expand Down Expand Up @@ -221,7 +232,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

_lastRequest = request_;
TeaResponse response_ = Tea.doAction(request_, runtime_, interceptorChain);
_lastResponse = response_;

if (com.aliyun.teautil.Common.is4xx(response_.statusCode) || com.aliyun.teautil.Common.is5xx(response_.statusCode)) {
Object _res = com.aliyun.teautil.Common.readAsJSON(response_.body);
Expand Down Expand Up @@ -286,17 +296,24 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
continue;
}
throw e;
} finally {
if (!com.aliyun.teautil.Common.isUnset(_lastResponse)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response.body())){
_lastResponse.response.close();
}
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}

/**
* Encapsulate the request and invoke the network
* @param action api name
* @param version product version
* @param protocol http or https
* @param method e.g. GET
* @param authType authorization type e.g. AK
* @param pathname pathname of every api
* @param bodyType response body type e.g. String
* @param request object of OpenApiRequest
* @param runtime which controls some details of call api, such as retry times
* @return the response
*/
public java.util.Map<String, ?> doROARequest(String action, String version, String protocol, String method, String authType, String pathname, String bodyType, OpenApiRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
TeaModel.validateParams(request, "request");
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
Expand Down Expand Up @@ -325,7 +342,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

TeaRequest _lastRequest = null;
Exception _lastException = null;
TeaResponse _lastResponse = null;
long _now = System.currentTimeMillis();
int _retryTimes = 0;
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
Expand Down Expand Up @@ -398,7 +414,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

_lastRequest = request_;
TeaResponse response_ = Tea.doAction(request_, runtime_, interceptorChain);
_lastResponse = response_;

if (com.aliyun.teautil.Common.equalNumber(response_.statusCode, 204)) {
return TeaConverter.buildMap(
Expand Down Expand Up @@ -470,17 +485,24 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
continue;
}
throw e;
} finally {
if (!com.aliyun.teautil.Common.isUnset(_lastResponse)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response.body())){
_lastResponse.response.close();
}
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}

/**
* Encapsulate the request and invoke the network with form body
* @param action api name
* @param version product version
* @param protocol http or https
* @param method e.g. GET
* @param authType authorization type e.g. AK
* @param pathname pathname of every api
* @param bodyType response body type e.g. String
* @param request object of OpenApiRequest
* @param runtime which controls some details of call api, such as retry times
* @return the response
*/
public java.util.Map<String, ?> doROARequestWithForm(String action, String version, String protocol, String method, String authType, String pathname, String bodyType, OpenApiRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
TeaModel.validateParams(request, "request");
java.util.Map<String, Object> runtime_ = TeaConverter.buildMap(
Expand Down Expand Up @@ -509,7 +531,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

TeaRequest _lastRequest = null;
Exception _lastException = null;
TeaResponse _lastResponse = null;
long _now = System.currentTimeMillis();
int _retryTimes = 0;
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
Expand Down Expand Up @@ -583,7 +604,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

_lastRequest = request_;
TeaResponse response_ = Tea.doAction(request_, runtime_, interceptorChain);
_lastResponse = response_;

if (com.aliyun.teautil.Common.equalNumber(response_.statusCode, 204)) {
return TeaConverter.buildMap(
Expand Down Expand Up @@ -653,17 +673,23 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
continue;
}
throw e;
} finally {
if (!com.aliyun.teautil.Common.isUnset(_lastResponse)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response.body())){
_lastResponse.response.close();
}
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}

/**
* Encapsulate the request and invoke the network
* @param action api name
* @param version product version
* @param protocol http or https
* @param method e.g. GET
* @param authType authorization type e.g. AK
* @param bodyType response body type e.g. String
* @param request object of OpenApiRequest
* @param runtime which controls some details of call api, such as retry times
* @return the response
*/
public java.util.Map<String, ?> doRequest(Params params, OpenApiRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
TeaModel.validateParams(params, "params");
TeaModel.validateParams(request, "request");
Expand Down Expand Up @@ -693,7 +719,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

TeaRequest _lastRequest = null;
Exception _lastException = null;
TeaResponse _lastResponse = null;
long _now = System.currentTimeMillis();
int _retryTimes = 0;
while (Tea.allowRetry((java.util.Map<String, Object>) runtime_.get("retry"), _retryTimes, _now)) {
Expand Down Expand Up @@ -801,7 +826,6 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {

_lastRequest = request_;
TeaResponse response_ = Tea.doAction(request_, runtime_, interceptorChain);
_lastResponse = response_;

if (com.aliyun.teautil.Common.is4xx(response_.statusCode) || com.aliyun.teautil.Common.is5xx(response_.statusCode)) {
java.util.Map<String, Object> err = new java.util.HashMap<>();
Expand Down Expand Up @@ -861,7 +885,9 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
new TeaPair("statusCode", response_.statusCode)
);
} else {
String anything = com.aliyun.teautil.Common.readAsString(response_.body);
return TeaConverter.buildMap(
new TeaPair("body", anything),
new TeaPair("headers", response_.headers),
new TeaPair("statusCode", response_.statusCode)
);
Expand All @@ -873,17 +899,23 @@ public Client(com.aliyun.teaopenapi.models.Config config) throws Exception {
continue;
}
throw e;
} finally {
if (!com.aliyun.teautil.Common.isUnset(_lastResponse)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response)
&& !com.aliyun.teautil.Common.isUnset(_lastResponse.response.body())){
_lastResponse.response.close();
}
}
}
throw new TeaUnretryableException(_lastRequest, _lastException);
}

/**
* Encapsulate the request and invoke the network
* @param action api name
* @param version product version
* @param protocol http or https
* @param method e.g. GET
* @param authType authorization type e.g. AK
* @param bodyType response body type e.g. String
* @param request object of OpenApiRequest
* @param runtime which controls some details of call api, such as retry times
* @return the response
*/
public java.util.Map<String, ?> execute(Params params, OpenApiRequest request, com.aliyun.teautil.models.RuntimeOptions runtime) throws Exception {
TeaModel.validateParams(params, "params");
TeaModel.validateParams(request, "request");
Expand Down
Loading
Loading