alvr-org / ALVR

Stream VR games from your PC to your headset via Wi-Fi
MIT License
5.41k stars 482 forks source link

When I enable the ext_hand_tracking extension, it seems to cause a memory corruption or pointer error #2456

Open xujunjie12345 opened 1 week ago

xujunjie12345 commented 1 week ago

Description

When using ALVR 20.6.1 on the gen1 platform based on qcom algorithms, everything works normally. However, when I enable the ext_hand_tracking extension, calling xrGetActionStatePose results in an XR_ERROR_PATH_UNSUPPORTED error. Additionally, I noticed that the isActive field of XrActionStatePose is a random number, such as -651485936.

Therefore, I suspect there might be issues like memory corruption or pointer errors

Envirments

qcom gen1

Installation

ALVR Version:20.6.1

zmerp commented 1 week ago

Isn't ext_hand_tracking already enabled? You're saying the precompiled ALVR apk crashes? What headset are you testing on?

xujunjie12345 commented 1 week ago

Isn't ext_hand_tracking already enabled? You're saying the precompiled ALVR apk crashes? What headset are you testing on?

"If ext_hand_tracking is not enabled, everything works normally. However, if it is enabled, the XR_ERROR_PATH_UNSUPPORTED error occurs. I am using the gen1 platform based on Qualcomm algorithms: pancake1."

xujunjie12345 commented 1 week ago

Qualcomm algorithms (https://spaces.qualcomm.com/), based on OpenXR version 1.0.31

zmerp commented 1 week ago

Is this an unreleased headset? In any case what you are reporting seems to be a runtime bug, nothing we can do about. Also mind that we use the openxr loader 1.0.34, you should probably downgrade it

xujunjie12345 commented 1 week ago

Is this an unreleased headset? In any case what you are reporting seems to be a runtime bug, nothing we can do about. Also mind that we use the openxr loader 1.0.34, you should probably downgrade it

This VR device has already been released.(https://www.skyworthxr.com/views/prodduct/pancake1.html?did=38803&page=NaN)。

I have tried lowering or raising the Rust version of OpenXR, but neither approach worked. However, when I implement the hand tracking functionality (ext_hand_tracking) using C++ code, this issue does not occur.

Therefore, I suspect there might be compatibility issues between the Rust OpenXR library and the Qualcomm Space SDK, which could lead to memory problems.

We only enable ext_hand_tracking.

    // exts.bd_controller_interaction = available_extensions.bd_controller_interaction;
    // exts.ext_eye_gaze_interaction = available_extensions.ext_eye_gaze_interaction;
    exts.ext_hand_tracking = available_extensions.ext_hand_tracking;
    // exts.fb_color_space = available_extensions.fb_color_space;
    // exts.fb_display_refresh_rate = available_extensions.fb_display_refresh_rate;
    // exts.fb_eye_tracking_social = available_extensions.fb_eye_tracking_social;
    // exts.fb_face_tracking2 = available_extensions.fb_face_tracking2;
    // exts.fb_foveation = available_extensions.fb_foveation;
    // exts.fb_foveation_configuration = available_extensions.fb_foveation_configuration;
    // exts.fb_swapchain_update_state = available_extensions.fb_swapchain_update_state;
    // exts.htc_facial_tracking = available_extensions.htc_facial_tracking;
    // exts.htc_vive_focus3_controller_interaction =
    //     available_extensions.htc_vive_focus3_controller_interaction;
xujunjie12345 commented 1 week ago

I found another similar issue: when I only press the system button on the right controller, the boolean values of other buttons also become random numbers. (1)Modify the debug implementation of Bool32 openxrs\sys\src\lib.rs

 impl fmt::Debug for Bool32 {
     fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
-        (*self != FALSE).fmt(fmt)
+        write!(fmt, "{}", self.0)
     }
 }

(2)Add logs openxrs\openxr\src\action.rs

 pub struct Action<T: ActionTy> {
     inner: Arc<ActionInner>,
@@ -204,6 +205,8 @@ impl ActionInput for bool {
                 out.as_mut_ptr(),
             ))?;
             let out = out.assume_init();
+            info!("jie12 1   current_state :{:?} , is_active : {:?} ",out.current_state , out.is_active);
+
             Ok(ActionState {
                 current_state: out.current_state.into(),
                 changed_since_last_sync: out.changed_since_last_sync.into(),

alvr\client_openxr\src\lib.rs

@@ -405,7 +405,7 @@ pub fn update_buttons(
                 let Ok(state) = action.state(xr_session, xr::Path::NULL) else {
                     continue;
                 };
-
+                info!("jie12  path : {:?}   current_state :{:?} , is_active : {:?}",BUTTON_INFO.get(id).unwrap().path,state.current_state, state.is_active);
                 if state.changed_since_last_sync {
                     button_entries.push(ButtonEntry {
                         path_id: *id,

When I press the system button on the right controller, you can see that many buttons show random values:

         28471: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/right/input/trigger/touch"   current_state :true , is_active : true
     28473: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12 1   current_state :4284943296 , is_active : 355258728 
     28474: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/left/input/menu/click"   current_state :true , is_active : true
     28476: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12 1   current_state :4284943296 , is_active : 355258728 
     28477: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/right/input/a/touch"   current_state :true , is_active : true
     28479: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12 1   current_state :4284943296 , is_active : 355258728 
     28480: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/left/input/trigger/touch"   current_state :true , is_active : true
     28482: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12 1   current_state :4284943296 , is_active : 355258728 
     28483: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/left/input/x/touch"   current_state :true , is_active : true
     28485: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12 1   current_state :4284943296 , is_active : 355258728 
     28486: 10-15 17:43:35.744  9459  9956 I [ALVR NATIVE-RUST]: jie12  path : "/user/hand/right/input/a/click"   current_state :true , is_active : true
      。。。
zmerp commented 1 week ago

You could try to make a minimal example to reproduce the problem and raise the issue to openxrs

xujunjie12345 commented 1 week ago

You could try to make a minimal example to reproduce the problem and raise the issue to openxrs

Okay, thank you for your response.