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

4.0.0-alpha.3 - Reproduce: Node.js process not exiting when Dexie.js is imported #1576

Closed
wants to merge 1 commit into from

Conversation

pubkey
Copy link
Contributor

@pubkey pubkey commented May 30, 2022

When Dexie.js is imported in a JavaScript file and run via Node.js, just importing the dexie.js library will prevent the process from exiting.

This happens with node.js >= 18.
It is not a problem with node.js 16 and below.

I think there is some side-effect like a setTimeout or setInterval that prevents the process from ever being finished.

I have this problem when using 4.0.0-alpha.3 in a test suite that is run via Node.js for faster test runs.

@pubkey pubkey mentioned this pull request May 30, 2022
4 tasks
@pubkey
Copy link
Contributor Author

pubkey commented May 30, 2022

Travis seems to fail because it is not capable of using node.js 18 https://travis-ci.community/t/the-command-npm-config-set-spin-false-failed-and-exited-with-1-during/12909/5 related nodejs/node#42351

@pubkey
Copy link
Contributor Author

pubkey commented May 30, 2022

Would you accept a PR to switch to github actions?

@pubkey pubkey changed the title Add test for Node.js process not exiting when Dexie.js is imported 4.0.0-alpha.3 - Add test for Node.js process not exiting when Dexie.js is imported May 30, 2022
@pubkey pubkey changed the title 4.0.0-alpha.3 - Add test for Node.js process not exiting when Dexie.js is imported 4.0.0-alpha.3 - Reproduce: Node.js process not exiting when Dexie.js is imported May 30, 2022
@dfahlander
Copy link
Collaborator

Thanks for the PR. There's no setTimeout or setInterval going on in the repo in any root code so it's a mystery how it keeps the process alive by just requiring "dexie". I suppose debugging the paths taken in enable-broadcast.ts and propagate-locally.ts when run in node 18 could be something to debug, in case node 18 exposes APIs that used to be DOM specific, like BroadcastChannel or addEventListener.

Would you accept a PR to switch to github actions?

Go ahead if you like, but I can't answer right away whether I would merge it as it would needs some more investigation in regards to action minutes per month.

@pubkey
Copy link
Contributor Author

pubkey commented May 30, 2022

@dfahlander thank you for that hint.
Indeed, commenting out the BroadcastChannel usage solves my issue.

// const bc = new BroadcastChannel(STORAGE_MUTATED_DOM_EVENT_NAME);

I will work on a fix.

@pubkey
Copy link
Contributor Author

pubkey commented May 30, 2022

I am proposing a fix here: #1577
I see no risk in merging the fix, but the test in #1576 should not be merched until travis supports Node.js 18 or until we switch to a different CI provider.

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

Successfully merging this pull request may close these issues.

2 participants