electron: desktopCapturer.getSources() with 'screen' type causes crash. (v3.0.0)
- Output of
node_modules/.bin/electron --version
: v3.0.0 - Operating System (Platform and Version): Windows 10 v1803
- Output of
node_modules/.bin/electron --version
on last known working Electron version (if applicable): v2.0.8
Expected Behavior Get ‘screen’ sources by calling desktopCapturer.getSources({types: [‘screen’]}, (error, sources) => {…}).
Actual behavior Electron crashes.
To Reproduce In the dev console of any Electron app using v3.0.0: require(“electron”).desktopCapturer.getSources({types: [‘screen’]}, (error, sources) => {})
Additional Information This was working fine before updating from v2.0.8 to v3.0.0. After updating, trying to get screen sources crashes immediately. I was able to reproduce this with the quick start app using v3.0.0.
I tried unplugging my external monitor to see if that made a difference, but it didn’t.
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 8
- Comments: 24 (9 by maintainers)
it works, but we don’t know why…
This solution may help you if your users would not update their NVIDIA driver to the latest.
@ajmacd I got this working. For me, it was an issue with the NVIDIA drivers.
Following my previous hunch, I was going to force every application to use the dedicated GPU. You can do this in Control Panel - NVIDIA Control Panel. When I tried to open it, though, I got an error saying, “NVIDIA Display settings are not available. You are not currently using a display attached to an NVIDIA GPU.”
I wasn’t having any issues with the GPU in any other applications, though. So yeah, weird.
I installed the latest drivers from NVIDIA, and now everything’s fine.
@exKAZUu @embirico Do you also have dual display adapters? Are you able to open the NVIDIA Control Panel (if they’re NVIDIA cards)? Does installing the latest drivers have any effect?
Just to chime in here, we are also seeing this issue in the wild.
One of our users is seeing this crash:
Our user is also using the aforementioned graphics card:
Intel® UHD Graphics 620
Updating their graphics drivers does not seem to help.
I don’t know if it’s related or not, but the issue seems to occur more frequently if they have Adobe Reader opened 😕
@ajmacd Hmm, my peer confirmed there was no error now (i.e. he cannot reproduce the bug anymore) though he doesn’t remember whether he upgraded the NVIDIA driver or not.
@Jay-Rad Thank you for sharing the solution! @ajmacd Unfortunately, I’m now unable to use the PC where this issue occured. I’ve asked a peer and he said he would test it day after tomorrow. I will share the result here.
@Jay-Rad Can you post the stack trace from the crash? If one isn’t appearing in your command line just set
ELECTRON_ENABLE_STACK_DUMPING=true
andELECTRON_ENABLE_LOGGING=true
as environment variables.