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

Fix linux segfault #2090

Merged
merged 2 commits into from
May 1, 2024
Merged

Fix linux segfault #2090

merged 2 commits into from
May 1, 2024

Conversation

SniperJoe
Copy link
Contributor

Problem: on linux, when GetRawZeroPose is called in alvr_server.cpp, the code first checks if OpenVR is initialized. If it is, GetRawZeroPose is called. But in between the check and the call something can call ShutdownOpenvrClient concurrently (and that's what's happening on my machine), and this leads to SEGFAULT because vr::VRCompositor() or vr::VRChaperoneSetup() in GetInvZeroPose returns NULL and the further calls happen on NULL objects.

Solution: add GetRawZeroPose ability to return nullptr if OpenVR is not initialized and do nothing in this case. Also add the same lock to GetInvZeroPose as all the functions above it use.

Solution 2: just an idea and not implemented in this PR. The whole ChaperoneUpdater can be separated to a class and be used atomically/with mutex.

P.S. My previous PR which is not merged yet is included into this one, so it has a bit more code than it should have.

@zmerp zmerp requested a review from galister April 28, 2024 19:13
@zmerp
Copy link
Member

zmerp commented Apr 28, 2024

@SniperJoe now needs rebasing

Copy link
Collaborator

@galister galister left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Haven't ran into this myself, but makes sense. Solution 2 would be more proper, but as soon as we get the last piece we need from valve for the direct mode driver, we won't need any of the raw pose hacks, so let's just go with this for now.

@zmerp zmerp merged commit de235ea into alvr-org:master May 1, 2024
6 checks passed
@zmerp zmerp mentioned this pull request May 4, 2024
@sol8712 sol8712 mentioned this pull request May 5, 2024
4 tasks
galister added a commit that referenced this pull request May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants