Closed dannys4 closed 9 months ago
Cannot reproduce in a very similar setup (ARM Mac with silkeh/clang:12
container). It seems /etc/security/limits.conf
can be used to set nproc, did you change that from its defaults?
okay I've made a simpler setup that reproduces my issue. First, some system information:
Chip: Apple M2 Pro
Total Number of Cores: 10 (6 performance and 4 efficiency)
Memory: 32 GB
Then, a very simple devcontainer.json
:
{
"image": "silkeh/clang:12"
}
behavior in vs code terminal (when opened in the devcontainer):
root@1dee5381db00:/workspaces/<my_folder># nproc
1
behavior in external terminal
dannys4 ~ % docker ps
1dee5381db00 silkeh/clang:12 "/bin/sh -c 'echo Co…" 2 minutes ago Up 2 minutes adoring_shannon
dannys4 ~ % docker exec -it 1dee bash
root@1dee5381db00:/# nproc
10
If you can't reproduce this, then I'm not really sure what's going on. This is entirely clean image, I'm not modifying anything. I'm not entirely sure what you mean about limits.conf
, but it's entirely unchanged from the base image in my container in this example. This isn't entirely high-stakes, but I want this documented in case anyone else has the same issue on a different container. Very strange that it's only doing this on this particular image.
What do you get for nproc --all
and taskset -p $$
in the two terminals?
Fascinating, it looks like it just thinks all other cores are offline.
Dev container integrated terminal:
root@1dee5381db00:/workspaces# nproc --all
10
root@1dee5381db00:/workspaces# taskset -p $$
pid 895's current affinity mask: 10
external shell:
root@1dee5381db00:/# nproc --all
10
root@1dee5381db00:/# taskset -p $$
pid 54256's current affinity mask: 3ff
Adding here that if I use lscpu
in the dev container, I actually get something weirder where it says the CPUs are actually online:
root@674b16f1071e:/workspaces# lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit
Byte Order: Little Endian
CPU(s): 10
On-line CPU(s) list: 0-9
Thread(s) per core: 1
Core(s) per socket: 10
....
Could you try running taskset 3ff bash
in the VS Code terminal and then check with nproc
if you get all CPUs? Something appears to have changed the CPU affinity mask for the VS Code terminal process and maybe other processes too. Not sure if this is something VS Code could have done. /cc @deepak1556 In case this sounds familiar.
Yes, this mitigates the problem. I'm not really sure whether to close this issue since whatever this is a symptom of hasn't really changed, but this is fine enough for me (feel free to close if you think this is fixed).
That has happened to me since some weeks ago. Something was off as build took so long. Yesterday I check with top and saw only one core building. Then with nproc inside VSCode I got the result of 1 but in a docker terminal outside of VSCode i got 10. Very weird!
I am in an Apple M1 Pro with Sonoma 14.2.1 and VSCode 1.83.1.
user@18a6c862a42c:~$ nproc
1
user@18a6c862a42c:~$ nproc --all
10
user@18a6c862a42c:~$ taskset -p $$
pid 56686's current affinity mask: 4
user@18a6c862a42c:~$ taskset 3ff bash
user@18a6c862a42c:~$ nproc
10
user@18a6c862a42c:~$ taskset -p $$
pid 31257's current affinity mask: 3ff
As with the OP, if I run a terminal in docker or use the Docker Desktop terminal, nproc is 10. But using the VSCode terminal as it is created, I get 1.
I am not aware of change on either Node.js or in the node-pty module that would change the affinity value in the integrated terminal. This sounds like a value inherited from the parent process. I am also unable to repro with the image silkeh/clang:12
on my M1 mac.
@dannys4 if you can still repro can you try the following in the container,
$ ps -ax | grep server-main.js # get the pid of process that is running server-main.js via node
$ taskset -p <pid from above command>
Very odd! I'd hazard a guess that there's something different about my dev environment that I'm missing (maybe some kind of option on the system I inadvertently either enabled or disabled)
root@674b16f1071e:/workspaces# nproc
1
root@674b16f1071e:/workspaces# ps -ax | grep server-main.js
741 ? Sl 0:03 /rosetta/rosetta /vscode/vscode-server/bin/linux-x64/8b3775030ed1a69b13e4f4c628c612102e30a681/node /vscode/vscode-server/bin/linux-x64/8b3775030ed1a69b13e4f4c628c612102e30a681/node --no-opt /vscode/vscode-server/bin/linux-x64/8b3775030ed1a69b13e4f4c628c612102e30a681/out/server-main.js --log debug --force-disable-user-env --server-data-dir /root/.vscode-server --use-host-proxy --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /root/.vscode-server/data/Machine/.connection-token-8b3775030ed1a69b13e4f4c628c612102e30a681 --extensions-download-dir /root/.vscode-server/extensionsCache --start-server --disable-websocket-compression
1459 pts/0 R+ 0:00 /rosetta/rosetta /bin/grep grep server-main.js
root@674b16f1071e:/workspaces# taskset -p 741
pid 741's current affinity mask: 100
user@18a6c862a42c:~$ nproc
1
user@18a6c862a42c:~$ ps -ax | grep server-main.js
3217 ? Sl 2:18 /rosetta/rosetta /home/user/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/node /home/user/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/node --no-opt /home/user/.vscode-server/bin/f1b07bd25dfad64b0167beb15359ae573aecd2cc/out/server-main.js --log debug --force-disable-user-env --server-data-dir /home/user/.vscode-server --telemetry-level all --accept-server-license-terms --host 127.0.0.1 --port 0 --connection-token-file /home/user/.vscode-server/data/Machine/.connection-token-f1b07bd25dfad64b0167beb15359ae573aecd2cc --extensions-download-dir /home/user/.vscode-server/extensionsCache --start-server
85286 pts/1 R+ 0:00 /rosetta/rosetta /usr/bin/grep grep --color=auto server-main.js
user@18a6c862a42c:~$ taskset -p 3217
pid 3217's current affinity mask: 4
Maybe a side-effect of using x64 emulation on ARM. Make sure you are using the latest Docker Desktop for Mac and are on the latest version of macOS to ensure you have all the latest bug fixes for these.
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!
Steps to Reproduce:
docker run -itd silkeh/clang:12
, which is what I'm working with)echo $(nproc)
Notes:
docker exec ... bash
or use theexec
tab of Docker Desktop, then doecho $(nproc)
, I get 10 (what I expect).debian:bullseye
, which I think this image is based on)Does this issue occur when you try this locally?: No Does this issue occur when you try this locally and all extensions are disabled?: No
This also doesn't happen if I disable all extensions in the remote.