Skip to content

Conversation

ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Aug 27, 2025

setup_signal_handlers is called once per new sandbox (this is needed due to the possibility of different sandboxes using different signal # to cancel executions). This also caused the panic hook to be set unnecessarily for each new sandbox. This PR fixes it by introducing a simple Once.

I confirmed locally that this fixes the long stacktraces we've been seeing, since it's non-trivial to add a test for it.

Closes #816

Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
Copy link
Contributor

@adamperlin adamperlin left a comment

Choose a reason for hiding this comment

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

Someone else should definitely sign off here, but from my reading this seems like a simple and reasonable fix!

Copy link
Contributor

@simongdavies simongdavies left a comment

Choose a reason for hiding this comment

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

Do you think we should add a test where we have a host that has an existing signal handler to make sure that our hooking works as expected? I realise this is not something that is needed because of your change but since we are improving/fixing this area it would be a nice thing to add

@ludfjig ludfjig merged commit 058a4de into hyperlight-dev:main Aug 28, 2025
33 checks passed
@ludfjig ludfjig deleted the fix_set_hook branch August 28, 2025 19:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Memory leak / panic nesting in setup_signal_handlers

3 participants