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

[macOS] Segfault on quit #1651

Open
shinra-electric opened this issue Apr 5, 2024 · 16 comments
Open

[macOS] Segfault on quit #1651

shinra-electric opened this issue Apr 5, 2024 · 16 comments
Labels
Bug The issue in the run-time.

Comments

@shinra-electric
Copy link

Describe the bug
OpenXRay will segfault when trying to quit, either via in-game menu or Command+Q

If the game is run from the command line, closing the terminal window may force-quit it. But if the app is run from an app bundle, trying to force-quit or kill -9 PID doesn't work and a restart is required.

To Reproduce
Try to quit the game

Expected behavior
It should quit cleanly

BugTrap error report
Terminal Saved Output.txt

Desktop (please complete the following information):

  • OS: macOS 14.4.1 Sonoma
  • OpenXRay build version: From dev branch
@shinra-electric shinra-electric added the Bug The issue in the run-time. label Apr 5, 2024
@AMS21
Copy link
Contributor

AMS21 commented Apr 5, 2024

Possible duplicate of #1586 although that one is for Linux and not macOS

@Xottab-DUTY Xottab-DUTY added Duplicate and removed Bug The issue in the run-time. labels Apr 16, 2024
@Xottab-DUTY
Copy link
Member

The issue should have been fixed, please test!

Duplicate of #1586.

@shinra-electric
Copy link
Author

Yes, it quits properly now. Thanks!

@shinra-electric
Copy link
Author

Actually, the issue is not fully fixed.

I was able to quit successfully when on the game menu, but I just tried quitting from in-game and got another segfault.

Terminal Saved Output.txt

@Xottab-DUTY Xottab-DUTY added Bug The issue in the run-time. and removed Duplicate labels Apr 16, 2024
@Xottab-DUTY
Copy link
Member

Actually, the issue is not fully fixed.

I was able to quit successfully when on the game menu, but I just tried quitting from in-game and got another segfault.

Terminal Saved Output.txt

That is another issue, not related to #1586 then (though, with similar reasons and symptoms).
I'll remove "duplicate" label and reopen this issue to track it.

@Xottab-DUTY Xottab-DUTY reopened this Apr 16, 2024
@Xottab-DUTY
Copy link
Member

Xottab-DUTY commented May 6, 2024

@shinra-electric, please, test it now with the latest dev branch.

In f97fedd I've made the changes that should hide the crash from the user.
At least, xrDebug window won't be shown, but I guess you still may see something in the terminal.

@Xottab-DUTY
Copy link
Member

Actually, the issue is not fully fixed.

I was able to quit successfully when on the game menu, but I just tried quitting from in-game and got another segfault.

Terminal Saved Output.txt

Stack trace for me:

xrDebug::GatherInfo(char*, unsigned long, ErrorLocation const&, char const*, char const*, char const*, char const*)
xrDebug::Fail(bool&, ErrorLocation const&, char const*, char const*, char const*, char const*)
segmentation_fault_handler(int)
3   libsystem_platform.dylib            0x00000001971bf584 _sigtramp + 56
4   ???                                 0xffff8001970ba8a8 0x0 + 18446603343050287272
std::__1::recursive_mutex::lock()
ScopeLock::ScopeLock(Lock*)
ISpatial_DB::remove(ISpatial*)
SpatialBase::spatial_unregister()
light::~light()
std::__1::vector<resptr_core<IRender_Light, resptrcode_light>, xalloc<resptr_core<IRender_Light, resptrcode_light>>>::__destroy_vector::operator()[abi:ue170006]()
CLight_DB::~CLight_DB()
CRender::~CRender()
13  libsystem_c.dylib                   0x000000019704bf2c __cxa_finalize_ranges + 476
14  libsystem_c.dylib                   0x000000019704bcb4 exit + 44
dyld4::LibSystemHelpers::getenv(char const*) const
16  dyld                                0x0000000196e0612c start + 2436
! Failed to copy text to the clipboard: Video subsystem must be initialized to set clipboard text

The reason is that, during Device.Destroy(), not all renderer elements are destroyed. (almost similar to #804, but e.g. there's no function that clears LightsDB)

@shinra-electric
Copy link
Author

After trying again I get a crash on launch:

crash_report.txt

But I've noticed that there have been many changes since I tried it last, so it may be unrelated to the crash fix PR.

@Xottab-DUTY
Copy link
Member

After trying again I get a crash on launch:

crash_report.txt

But I've noticed that there have been many changes since I tried it last, so it may be unrelated to the crash fix PR.

What's the log from the engine?

@shinra-electric
Copy link
Author

The error was Can't setup renderer

terminal_output.txt

@Xottab-DUTY
Copy link
Member

Xottab-DUTY commented May 6, 2024

The error was Can't setup renderer

terminal_output.txt

The reason why full log is needed is because the error Can't setup renderer is not the reason of the error (sounds funny :)), while the reason is stated somewhere in the log.
So, yea, the reason is this:

~ Cannot create helper window for OpenGL: NSWindow should only be instantiated on the main thread!

I've added multithreaded renderer library initialization, it works on Windows, but does not work on Linux.
Will fix.

Xottab-DUTY added a commit that referenced this issue May 11, 2024
@Xottab-DUTY
Copy link
Member

@shinra-electric, I've fixed that issue, please, test it again!

@shinra-electric
Copy link
Author

Same error with NSWindow:

terminal output.txt

@Xottab-DUTY
Copy link
Member

Same error with NSWindow:

terminal output.txt

Fixed.

@shinra-electric
Copy link
Author

The NSWindow error is gone, but it's still crashing on launch:

terminal output.txt

@shinra-electric
Copy link
Author

Just for further information, this log has more information about the crash on launch:

Terminal Saved Output.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug The issue in the run-time.
Projects
Status: To do
Development

No branches or pull requests

3 participants