gatsby build leaves dangling jest-worker child

Created on 21 Aug 2018  路  4Comments  路  Source: gatsbyjs/gatsby

Description

After running gatsby build, there's a jest-worker child that doesn't exit with the parent.

Steps to reproduce

git clone -b without-page-creator https://github.com/gzzo/guido.nyc.git
cd guido.nyc
yarn
gatsby build
ps aux | grep jest

Expected result

There should be no jest workers running

Actual result

There is a jest worker still left running after a successful build.

Environment

  System:
    OS: macOS Sierra 10.12.6
    CPU: x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
    Shell: 5.2 - /bin/zsh
  Binaries:
    Node: 8.11.3 - ~/.nvm/versions/node/v8.11.3/bin/node
    Yarn: 1.7.0 - /usr/local/bin/yarn
    npm: 5.6.0 - ~/.nvm/versions/node/v8.11.3/bin/npm
  Browsers:
    Chrome: 68.0.3440.106
    Firefox: 59.0.2
    Safari: 11.1.2
  npmPackages:
    gatsby: next => 2.0.0-beta.105
    gatsby-cli: ^1.1.58 => 1.1.58
    gatsby-paginate: ^1.0.16 => 1.0.16
    gatsby-plugin-google-analytics: next => 2.0.0-beta.5
    gatsby-plugin-manifest: ^2.0.2-rc.0 => 2.0.2-rc.0
    gatsby-plugin-offline: next => 2.0.0-beta.9
    gatsby-plugin-page-creator: ^2.0.0-beta.5 => 2.0.0-beta.5
    gatsby-plugin-react-helmet: next => 3.0.0-beta.4
    gatsby-plugin-remove-trailing-slashes: next => 2.0.0-beta.3
    gatsby-plugin-sass: next => 2.0.0-beta.10
    gatsby-plugin-sharp: next => 2.0.0-beta.7
    gatsby-remark-autolink-headers: ^2.0.0-beta.5 => 2.0.0-beta.5
    gatsby-remark-copy-linked-files: next => 2.0.0-beta.3
    gatsby-remark-images: next => 2.0.1-beta.10
    gatsby-remark-prismjs: next => 3.0.0-beta.7
    gatsby-remark-responsive-iframe: next => 2.0.0-beta.3
    gatsby-remark-smartypants: next => 2.0.0-beta.3
    gatsby-source-filesystem: next => 2.0.1-beta.10
    gatsby-transformer-remark: next => 2.1.1-beta.6
    gatsby-transformer-sharp: next => 2.1.1-beta.7
  npmGlobalPackages:
    gatsby-cli: 1.1.58

File contents (if changed)

gatsby-config.js: https://github.com/gzzo/guido.nyc/blob/v2/gatsby-config.js
package.json: https://github.com/gzzo/guido.nyc/blob/v2/package.json
gatsby-node.js: https://github.com/gzzo/guido.nyc/blob/v2/gatsby-node.js
gatsby-browser.js: N/A
gatsby-ssr.js: N/A

Most helpful comment

FYI: This can prevent netlify builds from finishing if you use a version of gatsby before this was fixed.

All 4 comments

Looks like calling setInterval on componentWillMount was causing the issue, since it wasn't getting cleared on componentWillUnmount somehow. I changed it to componentDidMount and am no longer seeing the issue.

FYI: This can prevent netlify builds from finishing if you use a version of gatsby before this was fixed.

I still have the issue on the latest gatsby version (2.0.18). I have a setInterval() call which causes a jest-worker child process running.

For now I've worked my way around it by executing the setInterval in a client-only code with

 if (typeof window !== 'undefined') {
    setInterval(() => {...})
}

I had issues with @aws/amplify and some of other packages, containing setInterval in the code

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dustinhorton picture dustinhorton  路  3Comments

hobochild picture hobochild  路  3Comments

brandonmp picture brandonmp  路  3Comments

signalwerk picture signalwerk  路  3Comments

rossPatton picture rossPatton  路  3Comments