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: Restart a shut down worker before sending it a task. #14015

Merged
merged 6 commits into from Apr 19, 2023

Conversation

PeteTheHeat
Copy link
Contributor

@PeteTheHeat PeteTheHeat commented Mar 16, 2023

Summary

This is a first attempt at trying to fix #13976.

The issue:

  • A jest worker is killed (something like a sigkill from linux oom-killer, or a process.kill like the tests in this PR)
  • The else case in process shutdown code is hit, the child doesn't restart.
  • WorkerPool and Farm have no idea one of the workers died, and tries to schedule more work on this worker.
  • This work never completes, jest hangs forever.

This PR:

  • Before attempting to schedule work on a worker, restart it if it's shut down.

Not sure if this is the best approach, open to feedback.

Test plan

yarn jest e2e/__tests__/workerRestartBeforeSend.test.ts

Before this PR, jest hangs forever. After, it completes.

@facebook-github-bot
Copy link
Contributor

Hi @PeteTheHeat!

Thank you for your pull request.

We require contributors to sign our Contributor License Agreement, and yours needs attention.

You currently have a record in our system, but the CLA is no longer valid, and will need to be resubmitted.

Process

In order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA.

Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with CLA signed. The tagging process may take up to 1 hour after signing. Please give it that time before contacting us about it.

If you have received this in error or have any questions, please contact us at cla@meta.com. Thanks!

@PeteTheHeat PeteTheHeat changed the title Fix killed worker fix: Restart a shut down worker before sending it a task. Mar 16, 2023
@facebook-github-bot
Copy link
Contributor

Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks!

@SimenB
Copy link
Member

SimenB commented Apr 8, 2023

This seems reasonable to me, thanks! 👍

@phawxby thoughts?

@phawxby
Copy link
Contributor

phawxby commented Apr 14, 2023

This looks good to me

Copy link
Member

@SimenB SimenB left a comment

Choose a reason for hiding this comment

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

thanks!

@SimenB SimenB merged commit 25d59f3 into jestjs:main Apr 19, 2023
79 checks passed
@gluxon
Copy link
Contributor

gluxon commented Apr 19, 2023

Thank you @PeteTheHeat and @SimenB!

@juan-fernandez
Copy link

thank you indeed! ❤️ . Do we know if this is going to go in the next release?

@juan-fernandez
Copy link

do we have any idea when this will be released?

@PeteTheHeat
Copy link
Contributor Author

Whenever the next release is, I don't know what that cadence is.

@github-actions
Copy link

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
Please note this issue tracker is not a help forum. We recommend using StackOverflow or our discord channel for questions.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 18, 2023
@SimenB
Copy link
Member

SimenB commented Jul 7, 2023

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

Successfully merging this pull request may close these issues.

[Bug]: Worker exits but jest process never finishes (continuation)
6 participants