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

HandBrake fails to launch if multiple GPUs from the same vendor are present #5317

Closed
Xaymar opened this issue Aug 15, 2023 · 15 comments · Fixed by #5504
Closed

HandBrake fails to launch if multiple GPUs from the same vendor are present #5317

Xaymar opened this issue Aug 15, 2023 · 15 comments · Fixed by #5504
Assignees
Labels
Milestone

Comments

@Xaymar
Copy link

Xaymar commented Aug 15, 2023

Problem Description

When multiple GPUs of the same vendor are present, HandBrake will fail to launch entirely. The only working work-around is to disable one of the GPUs, sacrificing other applications which were offloaded to that GPU for HandBrake.

Activity Log, Crash Log or any other details

Event Viewer
Faulting application name: HandBrake.exe, version: 1.6.1.0, time stamp: 0x63558578
Faulting module name: ucrtbase.dll, version: 10.0.22621.608, time stamp: 0xf5fc15a3
Exception code: 0xc0000409
Fault offset: 0x000000000007f61e
Faulting process ID: 0x0x173C
Faulting application start time: 0x0x1D9CF7AFD7C7F4F
Faulting application path: C:\Program Files\HandBrake\HandBrake.exe
Faulting module path: C:\Windows\System32\ucrtbase.dll
Report ID: df714fbc-b987-4718-a009-367837905d5c
Faulting package full name: 
Faulting package-relative application ID: 
Activity Log
HandBrake 1.6.1 (2023012300)
OS: Microsoft Windows NT 10.0.22621.0
CPU: 12th Gen Intel(R) Core(TM) i7-12650H
Ram: 65157 MB, 
GPU Information:
  NVIDIA GeForce RTX 3070 Laptop GPU - 31.0.15.3699
  NVIDIA GeForce RTX 4070 - 31.0.15.3699
  Intel(R) UHD Graphics - 31.0.101.3962
Screen: 2560x1440
Temp Dir: C:\Users\Xaymar\AppData\Local\Temp\
Install Dir: C:\Program Files\HandBrake\
Data Dir: C:\Users\Xaymar\AppData\Roaming\HandBrake

-------------------------------------------
[15:18:33] Compile-time hardening features are enabled

What Operating System are you running?

Windows 11

What version of HandBrake are you running?

1.6.1

Where did you download HandBrake from?

Handbrake.fr

@Xaymar
Copy link
Author

Xaymar commented Aug 15, 2023

Alternative work-around, set Windows to force HandBrake to launch on the iGPU. That for some reason makes it work too. Any other setting will cause it to not launch.

@sr55
Copy link
Contributor

sr55 commented Aug 15, 2023

You might want to try updating to the latest Intel driver for that part. The one your running is quite old.

We've seen this before with mixed GPU setups behaving strangely and it's been driver related issues causing it.

@galinart
Copy link
Contributor

Does iGPU disabling help?

@Xaymar
Copy link
Author

Xaymar commented Aug 15, 2023

No, disabling the iGPU does not help. According to Intel, this is the newest Intel driver - it does not offer any newer version, so I'm not sure how you came to the conclusion that the problem is the Intel driver?

@sr55
Copy link
Contributor

sr55 commented Aug 15, 2023

Intel(R) UHD Graphics - 31.0.101.3962

Newest is 31.0.101.4577 or 78 (beta)
https://www.intel.com/content/www/us/en/products/sku/226066/intel-core-i712650h-processor-24m-cache-up-to-4-70-ghz/downloads.html

I'm not saying the problem is the Intel driver. It could be a problem on the Nvidia side but you are recent there in drivers.

@Xaymar
Copy link
Author

Xaymar commented Aug 15, 2023

Intel(R) UHD Graphics - 31.0.101.3962

Newest is 31.0.101.4577 or 78 (beta) https://www.intel.com/content/www/us/en/products/sku/226066/intel-core-i712650h-processor-24m-cache-up-to-4-70-ghz/downloads.html

image

This is what Intel's own tool installed. I do believe this is the version you are talking about. This still won't address the issue that Handbrake only crashes if multiple of the same GPUs are installed - it works fine if forced to run on the iGPU, it works fine if one of the two NVIDIA gpus are disabled in Device Manager.

@sr55
Copy link
Contributor

sr55 commented Aug 15, 2023

I don't suppose your able to create a debug build and run HB within GDB to take a look see what's going on?

@galinart
Copy link
Contributor

Intel(R) UHD Graphics - 31.0.101.3962
Newest is 31.0.101.4577 or 78 (beta) https://www.intel.com/content/www/us/en/products/sku/226066/intel-core-i712650h-processor-24m-cache-up-to-4-70-ghz/downloads.html

image

This is what Intel's own tool installed. I do believe this is the version you are talking about. This still won't address the issue that Handbrake only crashes if multiple of the same GPUs are installed - it works fine if forced to run on the iGPU, it works fine if one of the two NVIDIA gpus are disabled in Device Manager.

So I suppose this is not related to iGPU driver if disabling iGPU does not help. The issue might be on dGPUs side.

@Xaymar
Copy link
Author

Xaymar commented Aug 16, 2023

I don't suppose your able to create a debug build and run HB within GDB to take a look see what's going on?

Is GDB available on Windows (without messing up other tools, like MingW and MSYS2 do)? If not, then no.

@galinart
Copy link
Contributor

@sr55
Copy link
Contributor

sr55 commented Aug 18, 2023

You can probably build and run HandBrake under MSYS/MinGW. We typically use WSL2/Ubuntu or a VM but I believe MSYS may be fine too.

https://handbrake.fr/docs/en/latest/developer/install-dependencies-ubuntu.html

@Xaymar
Copy link
Author

Xaymar commented Aug 18, 2023

Well, I've been trying to run the debug builds with the gdb.exe the guide produces. I've made no progress on figuring out what happens, only that enabling NVENC is the cause. Enabling QSV is fine.

@Xaymar
Copy link
Author

Xaymar commented Sep 7, 2023

Unfortunately still haven't found any reason for it happening, and ultimately ended up just moving the GPU to a PC instead. It's not unlikely that Windows 11 was causing the problem, considering the crashes occured in nt.dll and similar system files. Why exactly it would start working when forced onto the iGPU is unclear to me - possibly the UI and the worker getting different GPU assignments?

Anyway, if someone does intend to figure it out and has more skills in non-Windows debugging tools, the steps for repro are:

  1. Install Windows 10 or 11 on a Laptop that has an iGPU and a dGPU.
  2. Install an eGPU of the same brand and type in the eGPU, i.e. 3070 and 4070.
  3. Install HandBrake
  4. Optional for release builds: Enable all available encoders and decoders in HandBrake
  5. Crash to Desktop

The fact that step 4 is optional only for released builds is weird, but in debug builds its required to enable the hardware encoders for the crash to desktop to occur. The only information I have is that the crash appears to occur in non-Handbrake code, at least according to WerFault.

Probably can be closed with Won't Fix?

@sr55
Copy link
Contributor

sr55 commented Sep 18, 2023

Why exactly it would start working when forced onto the iGPU is unclear to me - possibly the UI and the worker getting different GPU assignments?

The underlying API/Drivers we use enumerate the GPUs to detect capabilities. Changing the device order is probably sufficient to bypass whatever problem is occurring.

The fact that step 4 is optional only for released builds is weird, but in debug builds its required to enable the hardware encoders for the crash to desktop to occur.

When you say debug, do you mean running from within Visual studio?

It shouldn't behave any differently. However, there may be differences between the head of the main branch and 1.6.1

Can you confirm if starting HandBrake.exe from a command line as follows works:
"HandBrake.exe --no-hardware"

Just to confirm, did you try a development snapshot build? https://github.com/HandBrake/HandBrake-snapshots

Cheers

@Xaymar
Copy link
Author

Xaymar commented Sep 19, 2023

When you say debug, do you mean running from within Visual studio?

By debug i mean with a hb.dll built for debugging and running via gdb. This for some reason changed the behaviour of the crash.

Just to confirm, did you try a development snapshot build?

I built from the main branch at the latest commit when i wrote the last comment. I did not try a snapshot build.

Can you confirm

As stated above, I moved the eGPU to be a dGPU in a PC, so I can't confirm. However, it likely has the same effect as deleting settings.json, which means the released version works fine (no hardware encoder = no gpu used), but debugged builds still crash in weird places.

@galinart galinart self-assigned this Nov 16, 2023
galinart added a commit to galinart/HandBrake that referenced this issue Nov 16, 2023
It should fix HandBrake#5317 and HandBrake#5177 where system contains more than one GPU card
@sr55 sr55 added Bug and removed Not Reproducible labels Nov 20, 2023
@sr55 sr55 added this to the 1.7.1 milestone Nov 20, 2023
galinart added a commit to galinart/HandBrake that referenced this issue Nov 20, 2023
It should fix HandBrake#5317 and HandBrake#5177 where system contains more than one GPU card
galad87 pushed a commit that referenced this issue Nov 21, 2023
It should fix #5317 and #5177 where system contains more than one GPU card
galad87 pushed a commit that referenced this issue Nov 21, 2023
It should fix #5317 and #5177 where system contains more than one GPU card

(cherry picked from commit 8204c0d)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

Successfully merging a pull request may close this issue.

3 participants