-
Notifications
You must be signed in to change notification settings - Fork 30.4k
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
VS Code server spams CPU when a connection on its --socket-path is closed #168194
Comments
@connor4312 I would love repro steps! . I don't think this is about the I've seen this before in microsoft/vscode-remote-release#6543 but we lost the repro because the extension changed something in the way the server is spawned. At the time, I remember we tracked it down to a change in nodejs 16, which does something better with stream errors, and which results now in async errors being produced if the console is trying to write to a broken stream. And we have an unhandled error handler ... which tries to log to the console. |
Here's the kind of code I tried which didn't repro: const path = require('path');
const fs = require('fs');
const child_process = require('child_process');
const output = path.join(__dirname, 'out.txt');
const outStream = fs.createWriteStream(output);
outStream.on('open', () => {
const server_process = child_process.spawn(
'/Users/alex/src/vscode/.build/node/v16.14.2/darwin-arm64/node',
['/Users/alex/src/vscode/out/server-main.js'],
{
stdio: ['pipe', outStream, 'pipe'],
}
);
console.log(`SPAWNED SERVER PROCESS AT ${server_process.pid}`);
setTimeout(() => {
console.log(`CLOSING STDOUT STREAM`);
outStream.close();
}, 1000);
}); |
I'll see what I can do to get better steps |
This issue has been closed automatically because it needs more information and has not had recent activity. See also our issue reporting guidelines. Happy Coding! |
from @aeschli in the private repo. And I believe this is the same issue that @chrisdias reported in #general. I believe this is the same cause. I don't always get the CPU spam, but when I do, it results in the broken state. Consistent dev steps for me:
This makes sense with the original stacktrace, since stdout/stderr for the child process would then be closed. |
Oh, this is actually the same as microsoft/vscode-remote-release#6543 |
Using the CLI I notice sometimes there are rogue VS Code server processes that are at 100% CPU. Attaching to these processes, I see infinite logs for this error:
and a profile shows that's exactly what it's doing (left heavy view)
I want to improve some of the process handling in the CLI, but the VS Code server should also probably not do this. I also suspect this could be hit in normal usage if it's triggered just by a connection on the socket path closing.
The text was updated successfully, but these errors were encountered: