You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Stas Sribnyi (Jira)" <ji...@apache.org> on 2019/11/21 13:18:00 UTC
[jira] [Updated] (THRIFT-5025) Incomplete promise rejection
[ https://issues.apache.org/jira/browse/THRIFT-5025?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Stas Sribnyi updated THRIFT-5025:
---------------------------------
Description:
I have a problem while performing client requests created with Multiplexer and HttpConnection.
In case of some errors like 'ECONNREFUSED', 'Connection timed out' and some other errors http_connection *emits an error, but nothing handles it*, therefore promise does not reject and in fact just hangs, so we have memory leaks.
Looks like promise can only be rejected only with a call of clientCallback
[https://github.com/apache/thrift/blob/41f47aff7ccc1a093eb5e48250377c1178babeec/lib/nodejs/lib/thrift/http_connection.js#L140]
As far as I did not find any example of such cases (multiplexer+http connection+node), it is possible that I use it in the wrong way, but from the source code perspective it looks like a design flaw, could you please take a look into this issue?
Here is a simplified source code I use:
{code:java}
const multiplexer = new Multiplexer();
const connection = new HttpConnection({
path: '/rpc',
transport: TBufferedTransport,
protocol: TBinaryProtocol,
nodeOptions: {
host: '127.0.0.1',
port: 8989,
},
});
const client = multiplexer.createClient(
'UserClient',
UserClient,
connection
);
try {
const user = await client.registerUser({
// Some props related to user
} as any);
// this only will be executed if registerUser performs without any errors.
// perform some actions with response
} catch (error) { // this never happens in case of connection issues and some internal errors of http connection
// log error
}
{code}
was:
I have a problem while performing client requests created with Multiplexer and HttpConnection.
In case of some errors like 'ECONNREFUSED', 'Connection timed out' and some other errors http_connection *emits an error, but nothing handles it*, therefore promise does not reject and in fact just hangs, so we have memory leaks.
Looks like promise can only be rejected only with a call of clientCallback
[https://github.com/apache/thrift/blob/41f47aff7ccc1a093eb5e48250377c1178babeec/lib/nodejs/lib/thrift/http_connection.js#L140]
As far as I did not find any example of such cases (multiplexer+http connection+node), it is possible that I use it in the wrong way, but from the source code perspective it looks like a design flaw, could you please take a look into this issue?
Here is a simplified source code I use:
{code:java}
const multiplexer = new Multiplexer();
const connection = new HttpConnection({
path: '/rpc',
transport: TBufferedTransport,
protocol: TBinaryProtocol,
nodeOptions: {
host: '127.0.0.1',
port: 8989,
},
});
const client = multiplexer.createClient(
'UserClient',
UserClient,
connection
);
try {
const user = await client.registerUser({
// Some props related to user
} as any);
// perform some actions with response
} catch (error) { // this never happens in case of connection issues and some internal errors of http connection
// log error
}
{code}
> Incomplete promise rejection
> ----------------------------
>
> Key: THRIFT-5025
> URL: https://issues.apache.org/jira/browse/THRIFT-5025
> Project: Thrift
> Issue Type: Bug
> Components: Node.js - Library
> Affects Versions: 0.12.0
> Reporter: Stas Sribnyi
> Priority: Major
> Labels: critical
>
> I have a problem while performing client requests created with Multiplexer and HttpConnection.
> In case of some errors like 'ECONNREFUSED', 'Connection timed out' and some other errors http_connection *emits an error, but nothing handles it*, therefore promise does not reject and in fact just hangs, so we have memory leaks.
> Looks like promise can only be rejected only with a call of clientCallback
> [https://github.com/apache/thrift/blob/41f47aff7ccc1a093eb5e48250377c1178babeec/lib/nodejs/lib/thrift/http_connection.js#L140]
> As far as I did not find any example of such cases (multiplexer+http connection+node), it is possible that I use it in the wrong way, but from the source code perspective it looks like a design flaw, could you please take a look into this issue?
> Here is a simplified source code I use:
> {code:java}
> const multiplexer = new Multiplexer();
> const connection = new HttpConnection({
> path: '/rpc',
> transport: TBufferedTransport,
> protocol: TBinaryProtocol,
> nodeOptions: {
> host: '127.0.0.1',
> port: 8989,
> },
> });
> const client = multiplexer.createClient(
> 'UserClient',
> UserClient,
> connection
> );
> try {
> const user = await client.registerUser({
> // Some props related to user
> } as any);
> // this only will be executed if registerUser performs without any errors.
> // perform some actions with response
> } catch (error) { // this never happens in case of connection issues and some internal errors of http connection
> // log error
> }
> {code}
>
--
This message was sent by Atlassian Jira
(v8.3.4#803005)