microsoft / HoloLens2ForCV

Sample code and documentation for using the Microsoft HoloLens 2 for Computer Vision research.
MIT License
479 stars 144 forks source link

Access Violation when Accessing Depth Long Throw Sensor and PV #142

Open jonashein opened 1 year ago

jonashein commented 1 year ago

Hi all,

I'm randomly getting the following Access Violation Error when trying to grab the next frame from the Depth Long Throw sensor: Exception thrown at 0x00007FFDF771C480 (ResearchModeAPI.dll) in StreamRecorder.exe: 0xC0000005: Access violation reading location 0x0000000000000000. The exception is thrown in line 85 of the CameraUpdateThread function. Interestingly, the exception is not thrown instantly: Sometimes the app runs fine for >30 minutes, sometimes the exception occurs within the first 5 or 10 minutes of a recording. This bug might be related to #133, though I'm not accessing the AHAT sensor but the Depth Long Throw.

I'm running a slightly customized version of the StreamRecorderApp, without any relevant changes to the RMCameraReader. Besides the Depth Long Throw sensor, I'm also capturing PV camera, hands&eye gaze, as well as the front-facing visible light cameras. The exception does not seem to occur when I don't capture PV and Depth Long Throw simultaneously (i.e. disabling one of them), though I cannot be certain due to the inconsistent nature of this bug. According to the Windows Device Portal, there's always at least 1GB of RAM available, usually ~1.5GB.

I can reproduce the exception on two different devices, as well as under the following HoloLens OS versions that I tested:

On the following versions the bug can be reproduced as well, but I haven't tested if capturing only PV or Depth solves the issue:

Any help will be appreciated!

Best, Jonas

mahdidBagheri commented 10 months ago

Exactly!!! To be honost, I am working with Hololens2 for a bout 1.5 years and one the most astonishing issues is this one. Among 3 devices in which I've worked with, ALL 3 had the same issue in a shocking way! Reading PV and Research Mode Sensors encountered no problem for couple of early weeks that I started to work with. Suddenly, at an unknown time they start to fail on giving PV and Research Mode Sensors simultaneously! I've even tried to synchronize the threads when they request the data from their APIs but none of that worked! It seems conflict roots when they initialize! I've even not been able to watch the stream through Windows Portal!

jdibenes commented 10 months ago

I've experienced the same problem. The issue seems to go away if the research mode streams are opened and the first frame is acquired before opening the next stream. Like open front left grayscale stream and acquire first front left frame, then open depth longthrow and acquire first frame, and so on, then finally create the PV frame reader and start capturing PV frames.