question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Segfault on Linux when unloading module during cook phase

See original GitHub issue

I’m consistently getting a segfault (“Signal 11” in UE4 logs) when trying to package a project for Linux.

My environment is:

  • Gentoo Linux, kernel 5.16.1
  • Unreal Engine 4.27.2 (compiled locally)
  • UnrealCLR 1.31
  • .NET 6.0 (Gentoo package dev-dotnet/dotnetcore-sdk-bin-6.0.101::dotnet)

I can reproduce by:

  • Create a UE4 project (any template, C++ or blueprint, seems to have the issue)
  • Install UnrealCLR via the install script (dotnet run --project-path /path/to/my/project)
  • At this point, the UE4 editor won’t open the project because it needs to rebuild the UnrealCLR module; I do this with /path/to/UnrealEngine/Engine/Binaries/ThirdParty/Mono/Linux/bin/mono /path/to/UnrealEngine/Engine/Binaries/DotNET/UnrealBuildTool.exe Development Linux -Project=/path/to/UnrealTest.uproject -TargetType=Editor -Progress
  • Open the project
  • Package for Linux (via File -> Package Project -> Linux -> Linux)

The packaging process fails during the cook phase. The editor’s output log just mentions “Signal 11” and redirects me to a Log.txt file, which in turn redirects me to a Cook-<timestamp>.txt file, which says:


LogModuleManager: Shutting down and abandoning module UnrealCLR (274)
LogCore: === Critical error: ===
Unhandled Exception: SIGSEGV: invalid attempt to read memory at address 0x0000000000000008

LogCore: Fatal error!

0x00007f5a242d07a0 libc.so.6!UnknownFunction(0x3d7a0)
0x00007f5951cc4100 libUE4Editor-UnrealCLR.so!UnrealCLR::Module::ShutdownModule() [/home/captaincrutches/Projects/UnrealTest/Plugins/UnrealCLR/Source/UnrealCLR/Private/UnrealCLR.cpp:1372]
0x00007f5a2d577258 libUE4Editor-Core.so!FModuleManager::UnloadModule(FName, bool) [/home/captaincrutches/Downloads/UnrealEngine/Engine/Source/Runtime/Core/Private/Modules/ModuleManager.cpp:601]
0x00007f5a2d577eae libUE4Editor-Core.so!FModuleManager::UnloadModulesAtShutdown() [/home/captaincrutches/Downloads/UnrealEngine/Engine/Source/Runtime/Core/Private/Modules/ModuleManager.cpp:731]
0x0000000000246948 UE4Editor!FEngineLoop::Exit() [/home/captaincrutches/Downloads/UnrealEngine/Engine/Source/Runtime/Launch/Private/LaunchEngineLoop.cpp:4294]
0x0000000000246f70 UE4Editor!GuardedMain(char16_t const*) [/home/captaincrutches/Downloads/UnrealEngine/Engine/Source/Runtime/Launch/Private/Launch.cpp:193]
0x00007f5a2456f056 libUE4Editor-UnixCommonStartup.so!CommonUnixMain(int, char**, int (*)(char16_t const*), void (*)()) [/home/captaincrutches/Downloads/UnrealEngine/Engine/Source/Runtime/Unix/UnixCommonStartup/Private/UnixCommonStartup.cpp:264]
0x00007f5a242bc2fa libc.so.6!UnknownFunction(0x292f9)
0x00007f5a242bc3a8 libc.so.6!__libc_start_main(+0x77)
0x00000000002304d9 UE4Editor!_start()

Here’s the entire files, in case there’s something else significant in there: Cook-2022.01.23-01.27.18.txt Log.txt

I’m brand new to this plugin and even UE4 itself, so it’s entirely possible this is environmental or just me doing something wrong with installation, in which case please do point out my mistake. And of course, let me know if there’s any other logs/info that would help, or if I should make any local code changes to see if they help.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
nxrightherecommented, Jan 25, 2022

Great, thanks! Fixed in https://github.com/nxrighthere/UnrealCLR/commit/1f29fa2543f831021618a1efcd7e3792c855a0e0.

(There is still a manager that dies in the same place as before - but we’re no longer making another one that’s causing that UB - so I’m gonna call that OK)

Yes, I expect that.

0reactions
captaincrutchescommented, Jan 25, 2022

Excellent - that change seems to fix it. My project builds successfully on Linux and I can run the in-engine tests. Thank you!

(There is still a manager that dies in the same place as before - but we’re no longer making another one that’s causing that UB - so I’m gonna call that OK)

Read more comments on GitHub >

github_iconTop Results From Across the Web

segmentation fault when unloading library on linux #12
We observe regular segmentation faults on linux when exiting python that seem to be related to Library.unload().
Read more >
"Segmentation fault" when `rmmod` or `modprobe -r`
The kernel is compiled with module unloading (both regular and forced) support enabled. What can be the possible cause of this issue? What...
Read more >
Thread: [Modules] Segmentation fault when loading ...
Hi all, I have a module file that loads several other module files, some of which in turn load still other module files....
Read more >
How does a Segmentation Fault work under-the-hood?
SIGSEGV goes to the process that broke the rules, not its parent. The next step in the sequence, though, is to notify the...
Read more >
The Linux Kernel Module Programming Guide
A Linux kernel module is precisely defined as a code segment capable of dynamic loading and unloading within the kernel as needed. These...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found