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

Fail test suite on unhandled promise rejection [API-1604] #636

Open
puzpuzpuz opened this issue Oct 7, 2020 · 4 comments
Open

Fail test suite on unhandled promise rejection [API-1604] #636

puzpuzpuz opened this issue Oct 7, 2020 · 4 comments

Comments

@puzpuzpuz
Copy link
Contributor

In the past I faced several places where we weren't handling promise rejections properly. In future version of node, it's very likely that it will start throwing on unhandled promise rejections, so, we need to make sure that there are no such places in the library code base, as well as in the test suite. The proper way should be to log details of the rejection and stop the process with an error code.

@mdumandag
Copy link
Contributor

mdumandag commented Oct 9, 2020

I have identified two places in which we might have this problem while taking a look at the test logs for the #638. The failures were unrelated to that PR.

One of them is https://github.com/hazelcast/hazelcast-nodejs-client/blob/master/src/listener/ListenerService.ts#L154.
This failed with the log below in one of the ListenersOnReconnectTests.

16:58:49 (node:750) UnhandledPromiseRejectionWarning: Error: Client is shutting down.
16:58:49     at new ClientNotActiveError (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/core/HazelcastError.js:18:1281)
16:58:49     at InvocationService.rejectIfNotRetryable (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/invocation/InvocationService.js:60:226)
16:58:49     at InvocationService.notifyError (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/invocation/InvocationService.js:53:6774)
16:58:49     at InvocationService.invokeSmart (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/invocation/InvocationService.js:53:2041)
16:58:49     at InvocationService.invoke (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/invocation/InvocationService.js:35:4036)
16:58:49     at registrationsOnUserKey.forEach (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/listener/ListenerService.js:18:2403)
16:58:49     at Map.forEach (<anonymous>)
16:58:49     at ListenerService.deregisterListener (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/listener/ListenerService.js:18:1969)
16:58:49     at client.getInvocationService.invokeUrgent.then.then.catch.e (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/listener/ListenerService.js:18:1245)

The other one is probably here. https://github.com/hazelcast/hazelcast-nodejs-client/blob/master/src/nearcache/RepairingTask.ts#L99
This one failed on MigratedDataTest.

17:03:48 (node:750) UnhandledPromiseRejectionWarning: Error: null
17:03:48     at new NullPointerError (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/core/HazelcastError.js:18:15872)
17:03:48     at ClientErrorFactory.register (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/protocol/ErrorFactory.js:16:6522)
17:03:48     at ClientErrorFactory.createError (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/protocol/ErrorFactory.js:16:13854)
17:03:48     at ClientErrorFactory.createErrorFromClientMessage (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/protocol/ErrorFactory.js:16:13314)
17:03:48     at InvocationService.processResponse (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/invocation/InvocationService.js:53:1463)
17:03:48     at processResponseCallback (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/network/ClientConnectionManager.js:36:3047)
17:03:48     at Socket.socket.on.buffer (/home/jenkins/jenkins_slave/workspace/NodeJS-pr-builder/lib/network/ClientConnection.js:41:521)
17:03:48     at Socket.emit (events.js:198:13)
17:03:48     at addChunk (_stream_readable.js:288:12)
17:03:48     at readableAddChunk (_stream_readable.js:269:11)
17:03:48     at Socket.Readable.push (_stream_readable.js:224:10)
17:03:48     at TCP.onStreamRead [as onread] (internal/stream_base_commons.js:94:17)

@puzpuzpuz
Copy link
Contributor Author

@mdumandag that's a good finding. Thanks.

I'm going to take a look at those failures once I'm back from vacation.

@puzpuzpuz
Copy link
Contributor Author

Lowering the priority for this one as #686 fixed all known issues in the client code base and added an eslint rule to detect floating promises.

@puzpuzpuz puzpuzpuz modified the milestones: 4.1, Backlog Dec 24, 2020
@srknzl srknzl added the to-jira label Sep 29, 2022
@github-actions github-actions bot changed the title Fail test suite on unhandled promise rejection Fail test suite on unhandled promise rejection [API-1604] Sep 29, 2022
@github-actions
Copy link

Internal Jira issue: API-1604

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants