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

Instant crash when accessing navigator.getUserMedia #400

Closed
loadpixels opened this issue Mar 18, 2020 · 31 comments
Closed

Instant crash when accessing navigator.getUserMedia #400

loadpixels opened this issue Mar 18, 2020 · 31 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Milestone

Comments

@loadpixels
Copy link

Attempting to access the camera or microphone either through code or the console will result in the chrome instance crashing

  • VS Code Version: 1.43.0
  • Chrome Version 80
  • Log file (set "trace": true in launch config):

Steps to reproduce:

  1. Start a Chrome instance using VS Code Chrome Debug
  2. Open console and paste in this line: navigator.getUserMedia({video:true},devices=>{console.log('hello')},err=>{console.log(err)})
  3. Allow access to the camera
  4. Chrome will crash without a trace
@roblourens roblourens transferred this issue from microsoft/vscode-chrome-debug Mar 19, 2020
@roblourens
Copy link
Member

  • old debug adapter: crash
  • chrome devtools: works
  • js-debug: I don't get the prompt from Chrome for camera access

@connor4312
Copy link
Member

This works for me in js-debug. Did you previously deny camera access on localhost:N? That would prevent it from prompting again.

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Mar 19, 2020
@roblourens
Copy link
Member

Maybe, I changed the url to google.com and then I get the crash with js-debug too.

@connor4312
Copy link
Member

hm, still works for me there. Can you or loadpixels get a trace log?

@roblourens
Copy link
Member

The log shows a normal launch then disconnection, I don't think there's anything interesting. I tried with "userDataDir": false, setting a port to use that instead of the debug pipe, and commenting out all the flags we set when we spawn Chrome.

One thing I noticed, if I start Chrome from the terminal and do this, then after I click Allow, I get a macOS prompt to allow iTerm access to the camera. So maybe vscode/Electron doesn't want to allow access to the camera.

@roblourens
Copy link
Member

@loadpixels what OS are you on?

@loadpixels
Copy link
Author

@roblourens MacOS

echoing @connor4312 there's no tracelog to speak of, it just crashes

it happens as soon as I click the Allow button on the permissions dialog

@thovden
Copy link

thovden commented Mar 29, 2020

I experience the same problem. MacOS. I accept camera, and chrome immediately exits. Under VS Code debug only, works well in browser.

@roblourens
Copy link
Member

You can use an "attach" type config to work around this. I don't have anything better, sorry.

@connor4312
Copy link
Member

Doesn't seem to happen on Windows. Tracking upstream with: https://bugs.chromium.org/p/chromium/issues/detail?id=1066155

@connor4312 connor4312 added upstream and removed info-needed Issue requires more information from poster labels Mar 30, 2020
@connor4312 connor4312 added this to the Backlog milestone Mar 30, 2020
@connor4312 connor4312 self-assigned this Apr 6, 2020
@connor4312 connor4312 modified the milestones: Backlog, April 2020 Apr 6, 2020
@connor4312
Copy link
Member

This will be fixed in microsoft/vscode#94728

@connor4312
Copy link
Member

After discussion in the Chromium issue, we have opened a feature request here: https://bugs.chromium.org/p/chromium/issues/detail?id=1070364

Once that is ready we will need to do a small amount of work to support it.

@connor4312 connor4312 modified the milestones: April 2020, Backlog Apr 25, 2020
@dimagimburg
Copy link

Hi, any updates on this? browser crashes for me too when trying to allow microphone permissions.

@connor4312
Copy link
Member

We're still waiting on work from the Chromium team for this

@jacksonlauder
Copy link

Hi, still no updates on this? My browser crashes for me too when trying to allow microphone permissions.

@amnporter
Copy link

What's the workaround here?

@murray-minito
Copy link

Work around:

Start Chrome with debug enabled

OSX:

/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome --remote-debugging-port=9222

use attach in launch.json

"name": "Chrome",
"type": "chrome",
"request": "attach",
"port": 9222,
"webRoot": "${workspaceFolder}/src",

@Odame
Copy link

Odame commented Oct 18, 2020

Perhaps helpful:

Starting chrome with debug enabled still crashes on MacOS once navigator.mediaDevices.getUserMedia is invoked.

Google Chrome 86.0.4240.80 (Official Build) (x86_64)
OS macOS Version 10.15.7
Command Line /Applications/Google Chrome.app/Contents/MacOS/Google Chrome --remote-debugging-port=9222 --flag-switches-begin --flag-switches-end
Debug Extension v4.12.11

@robclouth
Copy link

Has anyone found any reasonable workaround? It's difficult to debug applications that use MediaDevices.

@amnporter
Copy link

@robclouth, use the suggestion from @murray-minito above. Not ideal, but works for now.

@Tereshka
Copy link

Chrome: Version 87.0.4280.67 (Official Build) (x86_64)
OS: macOS Catalina 10.15.7
the problem is still here((

@robclouth
Copy link

robclouth commented Nov 21, 2020

@amnporter it doesn't work. Still crashes when getUserMedia is called as @Odame has said, even when not debugging.

@amnporter
Copy link

It's been working for me since trying it

@robclouth
Copy link

On chrome 87.0.4280.67 if I start with --remote-debugging-port=9222 and run navigator.getUserMedia({video:true},devices=>{console.log('hello')},err=>{console.log(err)}) from the console it crashes, even without connecting vscode.

@robclouth
Copy link

I think this is chrome issue, not vscode

@robclouth
Copy link

[1121/143318.062403:WARNING:process_memory_mac.cc(93)] mach_vm_read(0x7ffee480b000, 0x2000): (os/kern) invalid address (1)
[1121/143318.177972:WARNING:crash_report_exception_handler.cc(240)] UniversalExceptionRaise: (os/kern) failure (5)

@abhay-agarwal
Copy link

This happens with the firefox VSCode debugger as well. It looks like running the debugging server on either FF or Chrome doesn't have the correct 'entitlements' on Mac OS, due to notarization changes with 10.14+. Any user media permissions will instantly crash the application.

The only way out seems to be a separately notarized app dedicated to running as a debug server, with all these entitlements enabled.

@isometriq
Copy link

isometriq commented Jan 5, 2021

I was able by allowing vscode permissions for camera and microphone, but I had to create these entitled permissions in first place.

Have a look at this:
microsoft/vscode#95062 (comment)

Now all works for me when started directly from vscode!

MacOS Catalina (10.15.7)

@Tereshka
Copy link

Tereshka commented Jan 8, 2021

@isometriq thank you, I tried the solution you provided, and it works!

but I had to change the inserted code, because there were some other required fields in my access table:

INSERT into access (service, client, client_type, allowed, prompt_count) VALUES ("kTCCServiceCamera","com.microsoft.VSCode",0, 1, 0);
INSERT into access (service, client, client_type, allowed, prompt_count) VALUES ("kTCCServiceMicrophone","com.microsoft.VSCode",0, 1, 0);

@isometriq
Copy link

@Tereshka hey you're right, I add to tweak some fields and value

@connor4312
Copy link
Member

connor4312 commented Apr 29, 2021

This'll work in the next VS Code stable release microsoft/vscode#119787 (comment)

@connor4312 connor4312 modified the milestones: Backlog, April 2021 Apr 29, 2021
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug verified Verification succeeded and removed upstream labels Apr 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue identified by VS Code Team member as probable bug verified Verification succeeded
Projects
None yet
Development

No branches or pull requests