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

SDK4.2.1: SVO2 recorder hangs when enable and disable too frequently #658

Open
2 tasks done
MartinChowYW opened this issue Oct 28, 2024 · 6 comments
Open
2 tasks done
Assignees

Comments

@MartinChowYW
Copy link

Preliminary Checks

  • This issue is not a duplicate. Before opening a new issue, please search existing issues.
  • This issue is not a question, feature request, or anything other than a bug report directly related to this project.

Description

I have seen this issue from SDK 4.1 and it looks like it has not been resolved. There is a need for me to keep creating a fixed length of SVO2 recording files. I did that by calling "enableRecording" and "disableRecording" and it worked perfectly fine in SVO version one. After switching to SVO2, the SDK will hang with the below backtrack:

#0 __pthread_clockjoin_ex (threadid=281468863297792, thread_return=0x0, clockid=0, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145 #1 0x0000ffff92bb0230 in std::thread::join() () from /lib/aarch64-linux-gnu/libstdc++.so.6 #2 0x0000ffff93e88324 in MCAPWriter::close() () from /usr/local/zed/lib/libsl_zed.so #3 0x0000ffff93dba2c8 in sl::svorw::SVOGen2Writer::~SVOGen2Writer() () from /usr/local/zed/lib/libsl_zed.so #4 0x0000ffff93dba734 in sl::svorw::SVOGen2Writer::~SVOGen2Writer() () from /usr/local/zed/lib/libsl_zed.so #5 0x0000ffff93dc9f04 in sl::svorw::SVOVideo::close() () from /usr/local/zed/lib/libsl_zed.so #6 0x0000ffff94dce074 in sl::Camera::disableRecording() () from /usr/local/zed/lib/libsl_zed.so

Steps to Reproduce

  1. Write a python and C++ app to keep enabling and disabling the SVO2 recorder. I found that the faster you switch, the faster it will happen.

Expected Result

The SDK will not hang and continue to produce SVO2 file.

Actual Result

The SDK hanged with the below backtrack:
#0 __pthread_clockjoin_ex (threadid=281468863297792, thread_return=0x0, clockid=0, abstime=<optimized out>, block=<optimized out>) at pthread_join_common.c:145 #1 0x0000ffff92bb0230 in std::thread::join() () from /lib/aarch64-linux-gnu/libstdc++.so.6 #2 0x0000ffff93e88324 in MCAPWriter::close() () from /usr/local/zed/lib/libsl_zed.so #3 0x0000ffff93dba2c8 in sl::svorw::SVOGen2Writer::~SVOGen2Writer() () from /usr/local/zed/lib/libsl_zed.so #4 0x0000ffff93dba734 in sl::svorw::SVOGen2Writer::~SVOGen2Writer() () from /usr/local/zed/lib/libsl_zed.so #5 0x0000ffff93dc9f04 in sl::svorw::SVOVideo::close() () from /usr/local/zed/lib/libsl_zed.so #6 0x0000ffff94dce074 in sl::Camera::disableRecording() () from /usr/local/zed/lib/libsl_zed.so

ZED Camera model

ZED2i

Environment

aarch64
Jetson Xavier, Orin
SDK 4.1 to 4.2 all have this problem

Anything else?

No response

@Myzhar
Copy link
Member

Myzhar commented Oct 29, 2024

Hi @MartinChowYW
please share a snippet of code to reproduce this issue.
It will be useful to replicate and fix the bug.

@MartinChowYW
Copy link
Author

MartinChowYW commented Oct 29, 2024

Hi @MartinChowYW please share a snippet of code to reproduce this issue. It will be useful to replicate and fix the bug.

Thanks @Myzhar for coming back to me. I do not have the C++ code snippet at this moment but I am able to reproduce the same bug using the python script below:

Please run the provided python script to open the zed camera and start recording e.g. "./recorder.py ${PATH_TO_SVO2_FILE}"

import sys
import pyzed.sl as sl
import time
import os

zed = sl.Camera()
zed.open()
# Enable recording with the filename specified in argument
output_path = sys.argv[1]
recordingParameters = sl.RecordingParameters()
recordingParameters.compression_mode = sl.SVO_COMPRESSION_MODE.H264
recordingParameters.video_filename = output_path
err = zed.enable_recording(recordingParameters)

frame_counter = 0
zed.enable_recording(recordingParameters)

while True:
    # Each new frame is added to the SVO file
    print("Before Grab")
    if (zed.grab() == sl.ERROR_CODE.SUCCESS):
        print("Grabbed")
        time.sleep(0.1)
        frame_counter += 1

        if frame_counter == 3:
            print("Disabling recording ......")
            zed.disable_recording()
            print("Disabled recording ......")

            # Reset frame counter
            frame_counter = 0

            print("Enabling SVO recorder")
            zed.enable_recording(recordingParameters)

Changing the sleep time or the condition check on the frame_counter will the time to reproduce. I found that the shorter the sleep/frame_counter, the faster the bug will happen.

Please let me know if the python script is sufficient enough, happy to draft a C++ version of it. Hope to hear you back. Cheers.

@MartinChowYW
Copy link
Author

Hi @Myzhar, please find the above python script and it would be awesome if I can hear some feedback from you. Cheers.

@MartinChowYW
Copy link
Author

MartinChowYW commented Nov 27, 2024

It's been found that this happens to JetPack library and I've managed to reproduce it with ZedBox and another hardware platform.
JetPack I used:
[ZED SDK for JetPack 5.1.2 (L4T 35.4)] 4.2
[ZED SDK for JetPack 5.1.1 (L4T 35.3)] 4.2

@Myzhar
Copy link
Member

Myzhar commented Nov 27, 2024

Hi @MartinChowYW
Did you try using the latest ZED SDK v4.2.2?

@MartinChowYW
Copy link
Author

Hi @MartinChowYW

Did you try using the latest ZED SDK v4.2.2?

Yes I did

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants