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

Regression: v2.5.0 hangs in WSL #98

Closed
noinkling opened this issue Aug 19, 2018 · 5 comments
Closed

Regression: v2.5.0 hangs in WSL #98

noinkling opened this issue Aug 19, 2018 · 5 comments

Comments

@noinkling
Copy link

noinkling commented Aug 19, 2018

In WSL with 2.5.0, .toMatchImageSnapshot() hangs indefinitely. It worked in 2.4.3.

I did some debugging and it seems to be related to the change in #95 to spawn a worker process. The main process hangs at the call to spawnSync() here:

const writeDiffProcess = childProcess.spawnSync(
'node', [`${__dirname}/diff-process.js`],
{ input: Buffer.from(serializedInput), stdio: ['pipe', 'inherit', 'inherit', 'pipe'] }
);

Debugging the child process, I found the promise created by getStdin.buffer() never resolves:

getStdin.buffer().then((buffer) => {

Why doesn't the promise resolve? The get-stdin module is waiting on the end event on the stdin stream which never fires: https://github.com/sindresorhus/get-stdin/blob/496456754b3cf8faabd320181374ef0bdb664820/index.js#L48-L50 (it's worth noting that the readable handler above it does fire and the data does get through).

After a little more research it seems that spawnSync() and co. should close the stream, but this doesn't happen in WSL, which causes the process to hang. Other platforms presumably don't have this issue (at least Windows itself didn't when I tested it). Since this appears to be a WSL problem, I don't know if a workaround here is desirable or not, but this issue can serve as reference/tracking at the very least.

@noinkling
Copy link
Author

It looks like this may already be fixed in Windows insider builds: microsoft/WSL#1774 (comment). Which means it should hit the next big update due in October.

@anescobar1991
Copy link
Member

I will close this issue then since it will be fixed from Microsoft’s end.

@noinkling
Copy link
Author

I reverted to 2.4.3 and found I'm getting a similar issue when trying to write the diff file, which makes sense because it also uses spawnSync().

The weird part is that this was working before, so I don't know what's going on.

@anescobar1991
Copy link
Member

Something must have changed on WSLs end? Otherwise I’m not sure why the same code would work before but doesn’t now.

I’d test myself but I don’t have any Windows machines readily available to me.

@noinkling
Copy link
Author

noinkling commented Oct 3, 2018

Just confirming that everything seems to work fine in 2.5.0 after the new Windows update (just released).

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

2 participants