FPlatformProcess::GetDllHandle causes deadlock when loading opencv_world

Already reported, but was ignored: Case # 00423834

[Bug description]

FPlatformProcess::GetDllHandle(TEXT(“opencv_world454.dll”)); // DEADLOCK

LoadLibrary(TEXT(“opencv_world454.dll”)); // DEADLOCK

Reproduced with any OpenCV version.

OS: Windows 10.0.19041.1415 x64 (also reproduced on other)
UE: 5.0.0, 5.0.1, 5.0.2 (4.27 - not reproduced)

[Possible bug cause]

Use of LdrRegisterDllNotification and bugged FModuleTrace::OnDllLoaded

Commenting/bytepatching the internals of OnDllLoaded solves the problem:

void FModuleTrace::OnDllLoaded(const UNICODE_STRING& Name, UPTRINT Base) { return; }

[Minimal project]

Thanks for sharing, it would be really interesting to have a fix for this bug on 5.0.2

1 Like

Any news about this?
FModuleTrace::OnDllLoaded is still bugged on 5.0.3

as workaround you can try using already existing opencv:

UE5\Engine\Plugins\Runtime\OpenCV\Binaries\ThirdParty\Win64\opencv_world455.dll

or compile your custom opencv_world as static library

1 Like

Actually, i’m here because of your mediapipe plugin wich I can’t open, it’s stuck at 75% when I open the project. So I need to use FPlatformProcess::GetDllHandle to get the ump_shared.dll.
But thanks for your anwser!

I try opencv_world455, deleted FixDeadlock()

compilation is passed and the editor runs normally,but mediapipe not work

BP start node reurn False

Error: Unable to load: E:/2022/UE5MediaPipe/ue5-mediapipe-plugin/Plugins/MediaPipe/Binaries/Win64/ump_shared.dll

LogMediaPipe: Error: Invalid state: IUmpContext
LogWorld: Bringing up level for play took: 0.001369
LogOnline: OSS: Created online subsystem instance for: :Context_9
LogMediaPipe: Display: UMediaPipePipelineComponent::Start
LogMediaPipe: Error: Invalid state: IUmpPipeline

Need to recompile ump_shared.dll with 455?

Yeah, got the same issue, it seems that there is an error in the ump_shared.dll.
I wasn’t able to recompile it myself, so please, let me know if you manage to do it

find the FixDeadlock() function and add the follow pattern to the pattern array

“48 89 5C 24 08 55 56 57 41 54 41 55 41 56 41 57 48 8D 6C 24 D9 48 81 EC B0 00 00 00 48 8B 05 D5 B6 B5 00”

it worked well with Engine 5.0.3

1 Like

Thanks a lot!
How did you find that??

I built ue5.1 from source, modified this function.

void FModuleTrace::OnDllLoaded(const UNICODE_STRING& Name, UPTRINT Base) { return; }

It Worked.

I found the pattern with ida pro , there are many ways to find this , find the pattern in this func : FModuleTrace::OnDllLoaded and follow this plugins auther’s way to patch it

2 Likes

你在哪找到的这个指针?

Do you have a solution for non source code version engine?

Is it necessary to use the source code version of the engine to modify?

I got loading opencvworld.dll also stucked at 75%…

the game can built, can linked, but stucked at 75%

anybody got further clue how to solve it more easily?

this shouldn’t happen, since opencv is a widely used lib!

2 Likes

Build Successfully! Thank you! Brilliant!
Chinese:兄弟厉害!佩服

Hello, 重新编译ump_shared.dll, 可以吗

Hello, 你解决这个问题了吗? 我现在UE5.0.3, 与5.1版本都可以编译过,但是在加载到75%时会卡住。和楼下情况一样。

就加一行就行

没回复成,你看下楼下我的截图