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

fix: properly tear down partially initialized executors #2348

Merged
merged 3 commits into from
Apr 23, 2024

Conversation

FrederikBolding
Copy link
Member

@FrederikBolding FrederikBolding commented Apr 19, 2024

Refactor execution timeout logic to fix a problem where the execution worker would not be torn down correctly when failing to initialize. This PR also moves the entire initialization timeout logic to the AbstractExecutionService, simplifying the SnapController. Moving the timeout logic fixes problems where job initialization was not cancelled properly resulting in "Snap is already being executed", since execution of the async functions inside AbstractExecutionService would continue even after the timeout.

The ExecutionService gets an optional maxInitTime constructor argument that can be set to define init time for the specific service. This timeout value is spread between initiating the execution job and running the first execution of the Snap. If the execution environment fails to initiate we attempt to tear it down in case it has partially started (this is at least the case for iframes). We make sure that the timeout is applied to initEnvStream which has the smallest possible footprint and worry for side-effects. Additionally in case an error happens when terminating a Snap we catch that error an move on.

@FrederikBolding FrederikBolding marked this pull request as ready for review April 22, 2024 11:33
@FrederikBolding FrederikBolding requested a review from a team as a code owner April 22, 2024 11:33
@FrederikBolding FrederikBolding changed the title Refactor execution timeout logic fix: properly tear down partially initialized executors Apr 22, 2024
@FrederikBolding FrederikBolding merged commit ed4771f into main Apr 23, 2024
148 checks passed
@FrederikBolding FrederikBolding deleted the fb/refactor-execution-timeout branch April 23, 2024 09:42
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.

None yet

3 participants