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

[Bug?]: Process hangs with parallel-prettier #4354

Open
1 task
AllanZhengYP opened this issue Apr 13, 2022 · 7 comments
Open
1 task

[Bug?]: Process hangs with parallel-prettier #4354

AllanZhengYP opened this issue Apr 13, 2022 · 7 comments
Labels
bug Something isn't working esm upholded Real issues without formal reproduction

Comments

@AllanZhengYP
Copy link

AllanZhengYP commented Apr 13, 2022

Self-service

  • I'd be willing to implement a fix

Describe the bug

We use the dependency @mixer/parallel-prettier to prettify our huge codebase in parallel. However, formatting process hangs if the dependency co-exists with some other dependencies(i.e. concurrently). I looked into the source code, it looks normal, other than it uses cluster module.

To reproduce


Playground

await packageJsonAndInstall({
    devDependencies: {
        "@mixer/parallel-prettier": "^2.0.1",
        "concurrently": "7.0.0" // <==== this is causing the process to hang. Removing this the app runs properly again.
    },
    scripts: {
        "format": "pprettier --write ./package.json"
    },
    packageManager: "yarn@3.2.0",
});


expect(await yarn('run', 'format')).toBeDefined();

Environment

System:
    OS: macOS 12.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 14.19.1 - /private/var/folders/28/yhtzwdv94rg8cf93ncdjc02h0000gr/T/xfs-2f0d5096/node
    Yarn: 3.2.0 - /private/var/folders/28/yhtzwdv94rg8cf93ncdjc02h0000gr/T/xfs-2f0d5096/yarn
    npm: 6.14.16 - ~/.nvm/versions/node/v14.19.1/bin/npm

Additional context

I did a search in our other dependencies, it seems like many other dependencies will cause the same issue like concurrently:

    "@commitlint/cli": "^11.0.0",
    "@typescript-eslint/eslint-plugin": "5.15.0",
    "@typescript-eslint/parser": "5.15.0"
    "concurrently": "7.0.0",
    "eslint": "8.11.0",
    "lerna": "3.22.1",
    "lint-staged": "^10.0.1",
    "mocha": "^8.0.1",
    "ts-jest": "27.1.4"
    "strip-comments": "2.0.1"
    "esprint": "3.3.0"
    "jest": "27.4.5",
    "karma": "^5.1.0",
    "karma-typescript": "5.5.3"

I don't think they share a lot commonalities.

@merceyz
Copy link
Member

merceyz commented Apr 13, 2022

I'm guessing this is the same issue as #4157, can you test with Node.js v16.14 or v17.4?

@merceyz merceyz added the waiting for feedback Will autoclose in a while unless more data are provided label Apr 13, 2022
@AllanZhengYP
Copy link
Author

@merceyz Thank you for the response. I tested on v16.14 but still got no luck:

  System:
    OS: macOS 12.2.1
    CPU: (12) x64 Intel(R) Core(TM) i7-9750H CPU @ 2.60GHz
  Binaries:
    Node: 16.14.2 - /private/var/folders/28/yhtzwdv94rg8cf93ncdjc02h0000gr/T/xfs-79ab10bc/node
    Yarn: 3.2.0 - /private/var/folders/28/yhtzwdv94rg8cf93ncdjc02h0000gr/T/xfs-79ab10bc/yarn
    npm: 8.5.0 - ~/.nvm/versions/node/v16.14.2/bin/npm

@AllanZhengYP
Copy link
Author

@merceyz The issue still exists, can you take another look?

@yarnbot

This comment was marked as outdated.

@yarnbot yarnbot added the stale Issues that didn't get attention label May 16, 2022
@RDIL
Copy link
Member

RDIL commented May 20, 2022

I attempted to reproduce the issue, but didn't have any luck. Are you able to provide a repository that allows for a minimal reproduction of the behavior?

@yarnbot yarnbot removed the stale Issues that didn't get attention label May 20, 2022
@merceyz
Copy link
Member

merceyz commented May 20, 2022

I can reproduce with the following commands

docker run --rm -it node:16.15.0 bash
mkdir foo
cd foo
corepack enable
corepack prepare yarn@3.2.1 --activate
yarn init
yarn add @mixer/parallel-prettier@2.0.1 concurrently@7.0.0
yarn pprettier --write ./package.json

@merceyz merceyz added upholded Real issues without formal reproduction and removed waiting for feedback Will autoclose in a while unless more data are provided labels May 20, 2022
@RDIL
Copy link
Member

RDIL commented Sep 6, 2022

Interesting discovery... after running yarn config set pnpEnableEsmLoader false, it starts working. I wonder if this is some type of dynamic import type issue, or the issue Node.js had for a while with child_processes not being ready when loaded under ESM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working esm upholded Real issues without formal reproduction
Projects
None yet
Development

No branches or pull requests

4 participants