realm-js: node does not exit if realm-js is imported
Goals
Use realm in a cli program.
Expected Results
The program does its job and exits.
Actual Results
Node does not exit.
Steps to Reproduce
- Import realm-js
Code Sample
require('realm');
console.log('hello');
It prints hello and hangs.
Version of Realm and Tooling
- Realm JS SDK Version: the issue first appeared in
1.12.0 - Node or React Native: Node 6.11.3
- Client OS & Version: macOS 10.12.6 and Debian 8
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 4
- Comments: 19 (8 by maintainers)
Commits related to this issue
- Adding jest-cli to run tests Also added the flag that is required since there's a bug inside Realm that prevents the process from exiting correctly whenever is importer: https://github.com/realm/re... — committed to stigi/realm-react-redux by stigi 6 years ago
- Adds a process.exit to the CLI application There's some sort of bug on the realm library which causes the node process to never exit whenever the library is imported. https://github.com/realm/realm-... — committed to diogoosorio/realm-exporter by diogoosorio 6 years ago
Any news on this one ? I can reproduce the described behavior with realm-js 2.3.1 and my jest tests won’t terminate without adding the --forceExit hack.
This also prevents jest from exiting after finishing all tests.
Now this is a major annoyance as it prevents us from running tests agains in memory realms (or importing realm at all in our tests).I created a demo project to demonstrate the issue: https://github.com/stigi/realm-require-issue
Edit: The workaround for jest is, running jest with the
--forceExitflag. This triggersprocess.exitwhen all tests have been run.I tried to debug the issue and I suspect the problem is within the AdminRealmListener changes but couldn’t narrow down the issue yet.
I think we’re also hitting this in Jest.
@kneth can we reopen this since it still appears to be happening? Or would you prefer we raise a new bug for it?
it still happen at versión v10.5.0
Looks like still occurs in
10.4.2@stigi Thanks for that. Same here. The issue prevents Jest from exiting.