Skip to content

Crash / Race Condition within FUltraleapDevice::CaptureAndEvaluateInput #152

@protowlf

Description

@protowlf

Hi there, the Unreal Ultraleap plugin unfortunately has a crash within FUltraleapDevice::CaptureAndEvaluateInput that appears to be a race condition in which a _LEAP_TRACKING_EVENT pointer gets stomped mid-evaluation.

I'm observing this crash in UE5.4 with an Ultraleap 2 on Windows 10. I'm unsure if the engine version matters for reproducing it.

The reason I believe it gets stomped with a race condition is that I actually already implemented a sanity check at the top of CaptureAndEvaluateInput to try and detect a bad frame and abort. As demonstrated in the attached screenshots, the sanity check was passed, and afterwards partway through evaluation the contents of the frame became corrupt. This suggests a race condition.

I noticed that all the GetDeviceProperties() functions in the plugin attempt to lock the device info before returning it. However, they simply return a pointer and do not perform a copy. It appears that this lock does not accomplish anything (although I have only a cursory understanding of the plugin's code, so take this with a grain of salt). It appears to me that either a copy should be performed before evaluation, or the lock should be active for the full duration of the evaluation.

I've attached the relevant log and callstack when the crash was reproduced. I also attached a screenshot of my sanity check (that was passed before the crash occured), and a screenshot of the contents of the frame when the crash occured.

reproducing the crash:

  • Install the Ultraleap plugin to a new project.
  • Plug in an Ultraleap device to the PC.
  • Run the editor.
  • Select a map and Play In Editor, or open an Animation Blueprint. (NOTE: I'm not sure if this is necessary, but it seems to crash during PIE or when working on an Animation Blueprint).
  • Wait for the race condition to occur.
  • (It seems to happen more often when hands come in-and-out of tracking visibility, but I have not narrowed down a specific way to reproduce it).

Thanks!

UltraleapPluginCrash_log.txt
Image
Image
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions