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
Node Remote Debug takes up to 1 min to attach when using Docker for Mac #69118
Comments
@roblourens do you spot anything in the traces that would explain the slow attach? |
The mac one is definitely slower but there is not one thing that is slower, it just takes a very long time to receive scriptParsed notifications from the runtime and process their sourcemaps. The windows machine is doing the same amount of work in just a couple seconds. Is the mac a fast machine with a decent amount of free memory and nothing hogging the CPU at the same time? |
My Mac is a core i9 MacBook Pro with 32 go of ram. There is 8gb of ram allocated to docker. It appears to affect all our MacBooks all 2018 and above. We are working on the same project with the windows guys and they can attach very quickly. We only have code, outlook, Skype and docker running on our Macs. Like I mentioned previously. Debugger attached is display immediately after attach then waiting for the breakpoint to be hit. |
My guess would be that the network is slow between node in Docker and the debug adapter, but I don't know enough about Docker to troubleshoot it. You could try attaching with chrome devtools to see whether it's equally slow? Navigate to http://127.0.0.1:6861 in a browser to see the available targets. I guess symptoms would be scripts and their sources showing up slowly in the "Sources" tab. |
Hi Rob, I tried using the url above but got Websocket request was expected. However, I then used chome://inspect and the node dev tools. The chrome dev tools opened instantly and displayed the sources. I could also hit a break point straight away however chrome did not show source maps so it was the raw Javascript and not the Typescript files. I see the issue #69415 posted today is also reporting the same problem. Regards, |
I guess the other one was different. I'm not sure what's going on here
Otherwise you could try taking another log to see if it picks up anything else? Really the only thing I see is that getting |
We run docker-compose up and leave everything running all day. We periodically try to attach to node to debug code changes this used to be a very quick process. So to answer your first question we definitely already have node running when we attach. In chrome dev tools the source are immediately available (without sourcemaps) and i can find the file using {Command} P and searching for compressible ... i can even browse the folders in the source tabs and see all the files. I set trace to verbose and run again to see if it has more info This is the launch config we are using -
Let me know if I can provide any more information. |
Thanks. That shows the same thing as far as I can tell. A couple random things to try, set with |
Its the same. I tried the following -
|
I inlined the sourcemaps and the source using typescript so I can see the source code now in the Chrome DevTools. I then tried debugging using the Chrome DevTools.
In VSCode these changes mode no difference. Still takes a minute or so to attach. |
That's very weird. Is it possible for you to share the project/docker setup for me to try? Alternately I could give you steps to start the debug adapter in debug mode so you can capture a perf profile to see where it's spending its time, if you are willing to do that. @weinand we could have a nice builtin way to capture profiles for node-based DAs like we do for the EH in vscode (although this is probably the first time I've wanted it!) |
Hi, I am willing to start adapter in debug mode ... I will try and create a project for you also (but will have to be done after work) .. can we try both? Regards, |
Hi Rob, I have created a minimal project and a debug trace from my computer. In a nutshell, the effect is not as bad with this project because it is small but there is still a noticeable delay. To use please do the following:
Files Hope that helps :) |
Thanks! I am able to repro this. The debug adapter is indeed taking a long time to process each script event by doing some unnecessary work. I can take it from 20s to 3s pretty easily. |
Ok please try this in tomorrow's Insiders build. It should be much faster. It is still technically still doing a lot more than it needs to be but I can't refactor too much at this point in the month but it should be usable |
Thanks for your hard work!. We look forward to giving it a try tomorrow. |
Hi @roblourens, I have been testing your fix today .. and this is what I have found.
Does this comment "It is still technically still doing a lot more than it needs to be but I can't refactor too much at this point in the month but it should be usable" mean you will be working on this further? if so, is there an github ticket to watch? Thanks for your help :) Regards, |
I have to look at this some more next week. I had to revert the change anyway. |
Alright, take 2, please try in Monday's Insiders build. |
@roblourens just wanted to say thanks for fixing this issue. It works great and attaches instantly. |
Awesome, thanks for confirming. |
Steps to Reproduce:
As soon as you run step 1, the Debugger Attached message appears in the container's console. Visual Studio Code still looks like it is trying to attach. After sometime up to 1 minute the debugger will attach and will hit the breakpoints like normal.
We have some developers who are working on the same project but using Windows. For them the debugger attach process is very fast.
I have attached a trace captured during the attached process from both Windows and Mac machines. This appears to be occurring on all our Mac machines.
Does this issue occur when all extensions are disabled?: Yes
Does the occur on Mac non-insider builds: Yes
Does this occur on Windows builds: No
debugadapter.mac.txt
debugadapter.windows.txt
The text was updated successfully, but these errors were encountered: