-
Notifications
You must be signed in to change notification settings - Fork 4.8k
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
Segfault in align with a debug build #4469
Comments
@knicos I tried the latest SDK v2.28 and FW 5.11.11.100 and didn't get the issue. Could you please try the latest SDK and FW to see if any luck? Thanks! |
@knicos Could you please update if you still get issue with the latest SDK and FW? Thanks! |
I updated to 2.28.1 and the latest FW update but I do still have the segfault in the debug build. It does not appear to be resolved for me. |
@knicos , is this reproducible with the SDK tools/examples, such as |
The examples do work correctly. We are using it as a part of a much larger application that has a lot of threading with no guarantee that it is the same thread calling align.process for each frame. The application also uses OpenCV and CUDA extensively in case this matters. Unfortunately I don't have time to construct an example to reproduce it and can't provide our full source. In a class constructor:
And in a process frame method:
The last line is the problem in debug mode. |
Ok, please ignore my previous comment. The examples DO NOT WORK if -D_DEBUG is passed to compiler. |
Did you append a cmake generated makefile to add the -D_DEBUG flag? I want to reproduce the segfault you're seeing |
@knicos If you're thinking to build debug version, -D_DEBUG flag is not the right one. I think you should build with **-DCMAKE_BUILD_TYPE=Debug ** |
I do use -DCMAKE_BUILD_TYPE=Debug, and that alone seems ok. However, other code we have, in libraries that are not our own, uses _DEBUG and we need to enable it. |
#2567 |
@knicos Could you please try gdb to get the core dump information about the Segfault? Thanks! |
@knicos Did you get chance to try gdb to get the core dump information? Looking forward to your update. Thanks! |
@RealSenseCustomerSupport Have you checked my gdb log or try to combine Realsense with OpenVINO on Raspberry Pi 3/4? |
@whatisor Your issue seems closed on github. Please create another new issue if it's not resolved. Thanks! |
@knicos Any update from your side? Thanks! |
Any idea how to compile rs-align? Don't remember what I did last time but 2.31.1 doesn't compile on my machine, it fails to find libusb (it is installed), attempts to compile an internal version which also fails (missing config.h). I can't spend time on this so if it doesn't work I can't help further. I can give you this from our own application which still crashes in debug (with _DEBUG) but the error is different (stack smashing detected).
|
Just taking another look. Is this not the problem? Lines 623 in rs_frame.hpp (release 2.31.1)
If your debug build is without _DEBUG but I have _DEBUG then the rs2::frame class is of a different size and hence will corrupt the stack as I'm seeing. |
@knicos Did you install "libusb-1.0-0-dev" for libusb? And did you build SDK from source code or use the DKMS binary? What's CPU of your setup? |
@whatisor have you tried wrapping the C API in your C++ program? I've run into the same segfaults everyone else has but I've found success in wrapping the C API align functions in my C++ application |
@ThomasBrandonD thanks for response. |
I was adding _DEBUG to my own cmake for my own purposes, not rebuilding realsense SDK with it. Hence the conflict. |
It is, but you can still use C in your C++ app, check out https://stackoverflow.com/questions/1041866/what-is-the-effect-of-extern-c-in-c I'm assuming you're using some API to modify your the image frames you're getting from the realsense (like OpenCV). You can just use the Realsense C API to get the data into a cv::Mat If that makes sense give it a shot or I can make a small example EDIT: Just realized you may have meant you're unfamiliar with the C API, here's a link to some functions that may help you get started if this is the case |
@ThomasBrandonD , Do you mean issue only occurs for C++ API of realsense? |
@whatisor Yep, it doesn't exactly "solve" the issue of this ticket but if you need a solution, using the C API is one work-around you might try which worked for me |
Hi, Will you be needing further help with this? If we don’t hear from you in 7 days, this issue will be closed. Thanks |
The issue doesn't reproduce in latest version. |
The problem code is still present in the master branch, I just checked. I'm confident I could therefore reproduce it. Nonetheless, it isn't an issue for me right now. |
Issue Description
When using a debug build with -D_DEBUG, align frames to depth (or colour) results in a segmentation fault whilst performing an atomic operation inside a shared pointer of a stream profile. The relevant file is rs_frame.hpp line 376 (
profile = other.profile;
). In release mode there are no problems.The text was updated successfully, but these errors were encountered: