Skip to content

fix: Restart a shut down worker before sending it a task. - #14015

Merged
SimenB merged 6 commits into
jestjs:mainfrom
PeteTheHeat:fix-killed-worker
Apr 19, 2023
Merged

SimenB merged 6 commits into
jestjs:mainfrom
PeteTheHeat:fix-killed-worker

Conversation

@PeteTheHeat

@PeteTheHeat PeteTheHeat commented Mar 16, 2023 •

Copy link
Copy Markdown
Contributor

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
Copy Markdown
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 [email protected]. 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
Copy Markdown
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

SimenB commented Apr 8, 2023

Copy link
Copy Markdown
Member

This seems reasonable to me, thanks! 👍

@phawxby thoughts?

@phawxby

phawxby commented Apr 14, 2023

Copy link
Copy Markdown
Contributor

This looks good to me

Comment thread e2e/snapshot/__tests__/snapshot.test_copy.js Outdated

@SimenB SimenB left a comment

Copy link
Copy Markdown
Member

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
@gluxon

gluxon commented Apr 19, 2023

Copy link
Copy Markdown
Contributor

Thank you @PeteTheHeat and @SimenB!

@juan-fernandez

Copy link
Copy Markdown

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

@juan-fernandez

Copy link
Copy Markdown

do we have any idea when this will be released?

@PeteTheHeat

Copy link
Copy Markdown
Contributor Author

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

@github-actions

Copy link
Copy Markdown

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

SimenB commented Jul 7, 2023

Copy link
Copy Markdown
Member

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