Skip to content

feat: add out-of-memory callback with stderr log #805

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

Merged
merged 3 commits into from
Jun 19, 2024
Merged

Conversation

guybedford
Copy link
Contributor

This adds an out of memory callback to SpiderMonkey to log the error to stderr.

The message logged is Critical Error: out of memory.

@LeslieCarr
Copy link

@jaskiratr

@guybedford guybedford requested a review from elliottt June 18, 2024 23:37
Copy link
Contributor

@elliottt elliottt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! It's not clear how easily we could test this, as our test suite would only be able to observe a 500. Does the OOM callback also terminate the instance?

@guybedford
Copy link
Contributor Author

The error does not result in a panic unless the code handling it chooses to panic. For normal JS code it becomes a JS exception with the message being out of memory.

Yeah without a nice stdout filtering test handler it's a bit tricky, but I did verify it on a simple over-allocation case.

@guybedford guybedford merged commit a1bd16c into main Jun 19, 2024
20 checks passed
@guybedford guybedford deleted the out-of-memory-cb branch June 19, 2024 00:41
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.

3 participants