-
Notifications
You must be signed in to change notification settings - Fork 9
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
Unclosed Resources (timers and socket) #90
Comments
* introduce CliCoreBase.ts to remove all Node repl dependencies, allowing future REPL to be built without using Node REPL. Small change to stringify so that Timer objects are recognized in Bun. Add couple Bun detectors in tests to work around Jest specialties that are not availavle in Bun. Add github actions so that all tests run on Bun as well as node. * fix bun:run script * make workaround for bug in pulsar-flex. Issue submitted: ayeo-flex-org/pulsar-flex#90
* introduce CliCoreBase.ts to remove all Node repl dependencies, allowing future REPL to be built without using Node REPL. Small change to stringify so that Timer objects are recognized in Bun. Add couple Bun detectors in tests to work around Jest specialties that are not availavle in Bun. Add github actions so that all tests run on Bun as well as node. * fix bun:run script * make workaround for bug in pulsar-flex. Issue submitted: ayeo-flex-org/pulsar-flex#90 * v0.1.35
is anyone active on this project to triage issues? |
Yes sorry I missed this, would you like to open a PR for this? |
sure thing. Not sure I can get to it this weekend but will do. |
I have a pr @galrose, can i get permission to open a PR? |
@galrose can i get permission to push a PR? cc @danielsinai |
@geoffhendrey sorry we had a holiday here, did you try to fork and open a PR from there? |
@galrose do you think the test is failing because |
spamming everyone because I cannot get any response from anyone on this project @danielsinai @galrose @ronfarkash @sOfekS |
Hi @geoffhendrey sry for this, I will make sure its handled tomorrow. |
please publish a new version to NPM so we can pickup the changes in the merged branch |
First, thanks for making this library. It is great to have a native JS client for Pulsar to use in Bun.js, especially because the
pulsar-client
does not work (hard to diagnose failure) in Bun.jsDescribe the bug
A Jest test (essentially a cut-n-paste of the example in README.md) leaves dangling resources. This manifests itself in 2 ways:
node --experimental-vm-modules node_modules/jest/bin/jest.js Pulsar.test.js --detectOpenHandles
results in the program never finishing, and node reporting open handles like this:this is because --detectOpenHandles is finding a Timeout that has not fired. This is due to this line where a Timeout 10 seconds is setup to reject the promise in case there is never a resolve() (when autoResolve is false).
THis is not in itself a huge problem, it can be worked around by simply waiting at least 10 seconds yourself before allowing the Jest test to finish (i.e. inserting this at the end of your test method:
await new Promise(resolve => setTimeout(resolve, 11000));
)producer._client.getCnx().close();
Consequently the producer socket remains open and 'ping' and 'pong' continue indefinitely. And the program never exits.Reproduce
node_modules/jest/bin/jest.js
)node --experimental-vm-modules node_modules/jest/bin/jest.js Pulsar.test.js --detectOpenHandles
Expected behavior
Test immediately passes and Node exits normally. No open handles detected.
Observed behavior
Environment:
Additional context
Congrats, you are the only option for accessing Pulsar from Bun.js because the pulsar-client fails in Bun.js.
You can find the solution to this bug by uncommenting two lines at the bottom of this test. To incorporate those into product, you want to make sure you close the connection from within
Producer.close
, and you will want a way to preemptively kill this timeout when the Producer closes (otherwise Jest will still report there is an open 'handle' (a Timeout) when a test exits, even when the test has gracefully closed the producer before finishing.The text was updated successfully, but these errors were encountered: