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

Transform leaves process running causing CI to fail #50

Open
Deseteral opened this issue Aug 26, 2017 · 8 comments
Open

Transform leaves process running causing CI to fail #50

Deseteral opened this issue Aug 26, 2017 · 8 comments

Comments

@Deseteral
Copy link

When the build process (babel) quits and the transform was used it leaves a child process running which causes CI build to hang and eventually fail.

Code to reproduce:

const babel = require("babel-core");

const babelOpts = {
  plugins: [
    ['transform-postcss', {
      config: 'path/to/postcss.config.js'
    }]
  ]
};

const source = 'const s = require("./path/to/postcss/file.css");';

const res = babel.transform(source, babelOpts);
console.log(res.code);

postcss.config.js:

module.exports = ctx => ({
  plugins: []
});

CSS file:

.link {
  color: red;
}

The transpiled code is correct the only problem is orphaned child process.

After looking for details I found in MacOS's Activity Monitor that this process is using /tmp/bptp-<projectname>.sock file.

@Deseteral Deseteral changed the title Transform leaves process hanging causing CI to fail Transform leaves process running causing CI to fail Aug 26, 2017
@wbyoung
Copy link
Owner

wbyoung commented Sep 10, 2017

In theory, this is handled by the fact that the server is launched & unrefed.

I run this via gulp in CI and it does run fine.

Is there any chance you'd have the time to debug this a little (or even put up a repo w/ the example so it easier to just npm install and debug it)?

@GreenGremlin
Copy link

I'm curious, what is the reason for unrefing the server process? It appears every time I run babel I end up with an orphan server process.

@wbyoung
Copy link
Owner

wbyoung commented Dec 14, 2017

@GreenGremlin from the docs:

Calling unref on a server will allow the program to exit if this is the only active server in the event system. If the server is already unrefd calling unref again will have no effect.

The server should be killed on exit.

@MaxMotovilov
Copy link

Ran into the same issue: code in postcss-server.js handles 'SIGTERM' by removing the socket file but not exiting. PR to come.

MaxMotovilov added a commit to MaxMotovilov/babel-plugin-transform-postcss that referenced this issue Aug 30, 2019
MaxMotovilov added a commit to MaxMotovilov/babel-plugin-transform-postcss that referenced this issue Aug 30, 2019
@ChristopherBiscardi
Copy link

This unref situation is causing a boatload of orphaned processes to stick around on my system:

image

@MaxMotovilov
Copy link

MaxMotovilov commented Aug 20, 2020

I think @wbyoung was waiting for someone to review/confirm my PR #94. Would you like to try it and leave a review/approval there?

@wbyoung
Copy link
Owner

wbyoung commented Aug 21, 2020

Also, I'm not really doing much coding any more, so if one of you wants to take over maintaining this, let me know.

@ChristopherBiscardi
Copy link

ok thanks for the heads up @wbyoung ❤️ hope all is well

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

No branches or pull requests

5 participants