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

Add setTimeout(0) after closing Realm in Jest test to avoid Node 12 segfault #4025

Merged
merged 1 commit into from
Oct 14, 2021

Conversation

tomduncalf
Copy link
Contributor

@tomduncalf tomduncalf commented Oct 14, 2021

What, How & Why?

Our Jest test started often failing with a segmentation fault on Node 12. This issue started happening after realm/realm-core#4892 was merged. The issue only occurs when npm install is run prior to npm test and is not 100% consistent, which suggests some kind of race condition.

We are assuming that this is a very specific timing issue on Node 12 only, related to the Node environment being torn down before the Realm is properly closed, and unlikely to have any real world impact. Adding a setTimeout(0) at the end of the test appears to be enough to delay the Node environment teardown and avoid the segfault.

A follow up issue #4026 has been created in case of any further possibly related issues. The referenced doc on that ticket has full notes on the investigation.

☑️ ToDos

  • 📝 Changelog entry
  • 📝 Compatibility label is updated or copied from previous entry
  • 🚦 Tests
  • 📝 Public documentation PR created or is not necessary
  • 💥 Breaking label has been applied or is not necessary

If this PR adds or changes public API's:

  • [ ] typescript definitions file is updated
  • [ ] jsdoc files updated
  • [ ] Chrome debug API is updated if API is available on React Native

@tomduncalf tomduncalf force-pushed the td/workaround-jest-test-segfault branch from 1239234 to b772688 Compare October 14, 2021 10:52
@tomduncalf tomduncalf requested a review from kneth October 14, 2021 10:52
@tomduncalf tomduncalf marked this pull request as ready for review October 14, 2021 10:59
@tomduncalf tomduncalf merged commit 7acbac5 into master Oct 14, 2021
@tomduncalf tomduncalf deleted the td/workaround-jest-test-segfault branch October 14, 2021 13:17
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 16, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants