IntelRealSense / librealsense

Intel® RealSense™ SDK
https://www.intelrealsense.com/
Apache License 2.0
7.52k stars 4.81k forks source link

Segmenation fault when using realsense-viewer on odroid xu4 with D435 latest firmware, kernel patched as described. #3230

Closed florianspy closed 5 years ago

florianspy commented 5 years ago

Required Info
Camera Model { R200 / F200 / SR300 / ZR300 / D400 }
Firmware Version (Open RealSense Viewer --> Click info)
Operating System & Version {Win (8.1/10) / Linux (Ubuntu 14/16/17) / MacOS
Kernel Version (Linux Only) (e.g. 4.14.13)
Platform PC/Raspberry Pi/ NVIDIA Jetson / etc..
SDK Version { legacy / 2.<?>.<?> }
Language {C/C#/labview/nodejs/opencv/pcl/python/unity }
Segment {Robot/Smartphone/VR/AR/others }

Issue Description

<Describe your issue / question / feature request / etc..> When i start the realsense-viewer i first get the following output in terminal: MESA-LOADER: failed to retrieve device information libGL error: unable to load driver: exynos_dri.so libGL error: driver pointer missing libGL error: failed to load driver: exynos But then the application opens. As soon as i click on the icon to activate the camera ithe application closes and i get: "Segmentation fault" displayed in console window

dorodnic commented 5 years ago

Hi @florianspy Sorry to hear. Could you please share dmesg log after the crash?

antoniovillavicencio commented 5 years ago

Have you tried setting

cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false

before you run make?

dorodnic commented 5 years ago

We did get very similar report from Nanopi-Neo4 user, but don't yet have this hardware locally. Any logs from the crash would help a lot and shorten the time to a solution.

florianspy commented 5 years ago

This is the output of dmesg after the crash: [ 437.872744] input: Intel(R) RealSense(TM) Depth Ca as /devices/platform/soc/soc:usb3-0/12000000.dwc3/xhci-hcd.3.auto/usb4/4-1/4-1.2/4-1.2:1.0/input/input16 [ 438.880316] uvcvideo: Found UVC 1.50 device Intel(R) RealSense(TM) Depth Camera 435 (8086:0b07) [ 438.880345] uvcvideo: No streaming interface found for terminal 4. [ 438.880350] uvcvideo: No streaming interface found for terminal 5. [ 438.880359] uvcvideo 4-1.2:1.0: Entity type for entity Intel(R) RealSense(TM) Depth Ca was not initialized! [ 438.880369] uvcvideo 4-1.2:1.0: Entity type for entity Processing 2 was not initialized! [ 438.880376] uvcvideo 4-1.2:1.0: Entity type for entity Intel(R) RealSense(TM) Depth Ca was not initialized! [ 438.880381] uvcvideo 4-1.2:1.0: Entity type for entity Camera 1 was not initialized! [ 438.880805] input: Intel(R) RealSense(TM) Depth Ca as /devices/platform/soc/soc:usb3-0/12000000.dwc3/xhci-hcd.3.auto/usb4/4-1/4-1.2/4-1.2:1.0/input/input17 [ 439.849179] usb 4-1.2: usbfs: process 2802 (realsense-viewe) did not claim interface 1 before use

florianspy commented 5 years ago

Hello with the tip from above cmake ../ -DBUILD_EXAMPLES=true -DBUILD_GRAPHICAL_EXAMPLES=false realsense-viewer is not builded but i can at least call rs-color and see that data is coming in terminal. Thank you alot for your help. Is there another viewer available for the streamed data except for realsense-viewer?

antoniovillavicencio commented 5 years ago

I've found some error in patch files. In patch-arch.sh on line 27, it can't find the link so I had to hardcode from https://.../patch-4.14.94.sign to ...patch-4.14.94.9.sign. Similar on patch-realsense-ubuntu-odroid.sh where it cant find .config folder under /linux-headers-...

Also, I reinstalled mali-x11 drivers with

sudo apt-get install mali-x11 --reinstall

With this, realsense-viewer opens but it crashes when trying to display some image. It launches a warning of segmentation fault. I noticed that while compiling, x11 and mesa related packages launch several warnings all of the kind ISO C forbids conversion of object pointer to function pointer and similar.

florianspy commented 5 years ago

On my raspberry pi after following the instructions given in https://github.com/IntelRealSense/librealsense/blob/master/doc/installation_raspbian.md i also get the segmenation fault as soon as i try to receive data from the realsense. Even if i use cheese the programm immediately crashes when i have the camera plugged in.

florianspy commented 5 years ago

I applied your changes in the patch file of patch-realsense-ubuntu-odroid.sh and recompiled the librealsense now when i run it seems like the realsense-viewer is not build anymore. I solved this problem by changing the cmake to cmake .. -DBUILD_GRAPHICAL_EXAMPLES=true.

antoniovillavicencio commented 5 years ago

Yes, with -DBUILD_GRAPHICAL_EXAMPLES=true you are saying that you don't want realsense-viewer to build. Segmentation fault issue is an issue of realsense-viewer, not the libraries. This means you can still build your application and it will work. I couldn't run realsense-viewer yet but I'm working normally in ROS. I read something about Odroid having OpenGLES instead of OpenGL, I guess is the same with Raspberry but I don't know more :P

florianspy commented 5 years ago

The problem is even the ROS driver seems to be broken / affected by this problem i could not get any data. Instead i am getting the following exception: [ERROR] [1549883789.649319258]: An exception has been thrown: hwmon command 0x7d failed. Error type: Invalid Command (-1). when running roslaunch realsense2_camera rs_camera.launch

florianspy commented 5 years ago

I find out that it is a problem with the latest firmware. I downgrade it to firmware version 5.10.13 and with that the ROS driver is working. So it seems like a bug in the latest firmware: https://downloadcenter.intel.com/download/28377/Latest-Firmware-for-Intel-RealSense-D400-Product-Family 5.11.1 But realsense-viewer still result in the segmentation fault and the following output: 14/02 13:15:02,352 WARNING [2846728768] (sensor.cpp:338) Unregistered Media formats : [ P UYVY Y8 ]; Supported: [ ] 14/02 13:15:02,378 WARNING [2846728768] (sensor.cpp:338) Unregistered Media formats : [ RW16 ]; Supported: [ ] On the raspberry pi i now get the following message when i run the roslaunch realsense2_camera rs_camera.launch [camera/realsense2_camera_manager-1] process has died [pid 10413, exit code -11, cmd /opt/ros/kinetic/lib/nodelet/nodelet manager name:=realsense2_camera_manager log:=/home/irobot/.ros/log/8bfe5ddc-3057-11e9-bea4-309c2389eb8b/camera-realsense2_camera_manager-1.log]. log file: /home/irobot/.ros/log/8bfe5ddc-3057-11e9-bea4-309c2389eb8b/camera-realsense2_camera_manager-1*.log and then the process closes.

RealSenseCustomerSupport commented 5 years ago

Hi @florianspy,

I don't observe the segmentation fault when opening realsense-viewer and having depth streams with D435 + 5.10.13.0 or 5.11.1.0. Let's check the correct installation and kernel patches applied first. You can try below patch which is working on my XU4 board with kernel 4.14. https://github.com/freemanlo/librealsense/blob/odroid_build_4.14/scripts/patch-realsense-ubuntu-odroid-xu4-4.14.sh And, make sure to install Intel Realsense permission scripts located in librealsense source directory. sudo cp config/99-realsense-libusb.rules /etc/udev/rules.d/ sudo udevadm control --reload-rules && udevadm trigger And, make sure to install Intel Realsense permission scripts located in librealsense source directory.

Do you also try other librealsense app like rs-capture to see the segmentation fault?

florianspy commented 5 years ago

I applied the kernel4.14 patch I applied the permission script. Still realsense-viewer gives me the segmentation fault, when trying to access the camera. rs-capture does not give me the segmentation fault.

abylikhsanov commented 5 years ago

@RealSenseCustomerSupport I can confirm that using the same script as yours did not really resolve the issues. I was able to connect D435i but sometimes I get an error that frames did not receive, here is the issue:

3374

RealSenseCustomerSupport commented 5 years ago

Hi @florianspy,

Which exact board you use for this issue? you mean both Raspberry Pi 3 B+ and XU4 have the segmentation fault issue when trying depth stream in realsense-viewer?

Hi @abylikhsanov,

you use XU4, too? and, D435i firmware 5.11.10?

abylikhsanov commented 5 years ago

@RealSenseCustomerSupport Yes, I use XU4 with kernel 4.14.102+ and 5.11.10 (The Latest) firmware.

EDIT:

Sorry, I use 5.11.01 Firmware. Strange, I thought I have downloaded the latest one...

Is it this one? https://downloadcenter.intel.com/download/28568/Latest-Firmware-for-Intel-RealSense-D400-Product-Family

If yes, I have installed that firmware and realsense-viewer shows that I have 5.11.01

EDIT 2:

It was due to power lack. See the last comment of issue #3374 if you experience a similar issue.

RealSenseCustomerSupport commented 5 years ago

Hi @abylikhsanov,

Since your issue is due to hub power issue and you don't experience the segment fault when streaming using realsense-viewer, right?

Hi @florianspy,

It looks your issue only happens on the realsense-viewer. Suggest to try the latest realsense-viewer (ex: 2.19.0). And, please enable the log severity to Debug and output log to file in "settings->General" of realsense-viewer if the issue still there on your XU4.

abylikhsanov commented 5 years ago

Hi,

I do experience the problem with the actual video streaming. I have connected to the usb power hub but as soon as I start moving the robot base I start getting to lose the frames again.

On Thu, 7 Mar 2019 at 03:29, RealSense Customer Support < notifications@github.com> wrote:


Hi @abylikhsanov https://github.com/abylikhsanov,

Since your issue is due to hub power issue and you don't experience the segment fault when streaming using realsense-viewer, right?

Hi @florianspy https://github.com/florianspy,

It looks your issue only happens on the realsense-viewer. Suggest to try the latest realsense-viewer (ex: 2.19.0). And, please enable the log severity to Debug and output log to file in "settings->General" of realsense-viewer if the issue still there on your XU4.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IntelRealSense/librealsense/issues/3230#issuecomment-470358800, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-l_bDSWlQkL4baB3t9P8b561JcHqvgks5vUHl4gaJpZM4andi1 .

-- Kind regards Abyl

RealSenseCustomerSupport commented 5 years ago

Hi @abylikhsanov,

Since you mentioned this issue happens as soon as you move the robot base, I would think if the USB connection is not solid enough. Soft connection could affect the USB transfer quality/stability. By the way, as I know, Newnex industrial grade passive USB 3.1 SuperSpeed cable is capable of connect Intel RealSense Camera series up to 5m (15 ft.) You can have a try. http://www.newnex.com/realsense-3d-camera-connectivity.php http://www.newnex.com/usb-3-1-locking-cables.php#USB3.1LockingAtoC

abylikhsanov commented 5 years ago

Hi,

So would you say that the USB which came along with the camera is not good enough? I do not think that the problem is with the USB cable as if I connect the camera to my laptop and move the robot base, I do not see any loss in the connection.

My assumption goes to the kernel patch and not due to the power lack. From the datasheet, the nominal required voltage for D435i is 5v which odroid supplies through its USB port.

чт, 7 мар. 2019 г. в 09:38, RealSense Customer Support < notifications@github.com>:


Hi @abylikhsanov https://github.com/abylikhsanov,

Since you mentioned this issue happens as soon as you move the robot base, I would think if the USB connection is not solid enough. Soft connection could affect the USB transfer quality/stability. By the way, as I know, Newnex industrial grade passive USB 3.1 SuperSpeed cable is capable of connect Intel RealSense Camera series up to 5m (15 ft.) You can have a try. http://www.newnex.com/realsense-3d-camera-connectivity.php http://www.newnex.com/usb-3-1-locking-cables.php#USB3.1LockingAtoC

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IntelRealSense/librealsense/issues/3230#issuecomment-470435298, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-l_akIVX556VXkYiZf4IoL6v5uqR2Kks5vUNASgaJpZM4andi1 .

-- Kind regards Abyl

RealSenseCustomerSupport commented 5 years ago

Hi @abylikhsanov,

  1. Need to further check the plan to support RGB and IMU streams for USB2.
  2. Any failed kernel log and librealsense log when segment fault happens? or, you mean "No frames arrived" error in realsense-viewer?
  3. Does rs-capture also have no this issue?
  4. Please save your realsense-viewer (2.19.0?) settings to a json file. Like to see if it can be reproduced on my XU4 setup.
abylikhsanov commented 5 years ago

@RealSenseCustomerSupport

  1. Ok
  2. Yes, I mean the "Frames didn't arrive within 5 seconds" which happens to be randomly after which I am unable to receive any frames.
  3. I don't think I have used it.
  4. I am away from my main computer but I did save the json file earlier and the version was 2.18.1 with firmware version 05.11.01.00 (the latest version did not make any difference).

When I use on my laptop, I never get this problem. Also, I have used this patch: https://github.com/freemanlo/librealsense/blob/odroid_build_4.14/scripts/patch-realsense-ubuntu-odroid-xu4-4.14.sh

{
    "aux-param-autoexposure-setpoint": "1536",
    "aux-param-colorcorrection1": "0.298828",
    "aux-param-colorcorrection10": "0",
    "aux-param-colorcorrection11": "0",
    "aux-param-colorcorrection12": "0",
    "aux-param-colorcorrection2": "0.293945",
    "aux-param-colorcorrection3": "0.293945",
    "aux-param-colorcorrection4": "0.114258",
    "aux-param-colorcorrection5": "0",
    "aux-param-colorcorrection6": "0",
    "aux-param-colorcorrection7": "0",
    "aux-param-colorcorrection8": "0",
    "aux-param-colorcorrection9": "0",
    "aux-param-depthclampmax": "65536",
    "aux-param-depthclampmin": "0",
    "aux-param-disparityshift": "0",
    "controls-autoexposure-auto": "True",
    "controls-autoexposure-manual": "8500",
    "controls-color-autoexposure-auto": "True",
    "controls-color-autoexposure-manual": "166",
    "controls-color-backlight-compensation": "0",
    "controls-color-brightness": "0",
    "controls-color-contrast": "50",
    "controls-color-gain": "64",
    "controls-color-gamma": "300",
    "controls-color-hue": "0",
    "controls-color-power-line-frequency": "3",
    "controls-color-saturation": "64",
    "controls-color-sharpness": "50",
    "controls-color-white-balance-auto": "True",
    "controls-color-white-balance-manual": "4600",
    "controls-depth-gain": "16",
    "controls-laserpower": "150",
    "controls-laserstate": "on",
    "ignoreSAD": "0",
    "param-autoexposure-setpoint": "1536",
    "param-censusenablereg-udiameter": "9",
    "param-censusenablereg-vdiameter": "9",
    "param-censususize": "9",
    "param-censusvsize": "9",
    "param-depthclampmax": "65536",
    "param-depthclampmin": "0",
    "param-depthunits": "1000",
    "param-disableraucolor": "0",
    "param-disablesadcolor": "0",
    "param-disablesadnormalize": "0",
    "param-disablesloleftcolor": "0",
    "param-disableslorightcolor": "0",
    "param-disparitymode": "0",
    "param-disparityshift": "0",
    "param-lambdaad": "800",
    "param-lambdacensus": "26",
    "param-leftrightthreshold": "24",
    "param-maxscorethreshb": "2047",
    "param-medianthreshold": "500",
    "param-minscorethresha": "1",
    "param-neighborthresh": "7",
    "param-raumine": "1",
    "param-rauminn": "1",
    "param-rauminnssum": "3",
    "param-raumins": "1",
    "param-rauminw": "1",
    "param-rauminwesum": "3",
    "param-regioncolorthresholdb": "0.0499022",
    "param-regioncolorthresholdg": "0.0499022",
    "param-regioncolorthresholdr": "0.0499022",
    "param-regionshrinku": "3",
    "param-regionshrinkv": "1",
    "param-robbinsmonrodecrement": "10",
    "param-robbinsmonroincrement": "10",
    "param-rsmdiffthreshold": "4",
    "param-rsmrauslodiffthreshold": "1",
    "param-rsmremovethreshold": "0.375",
    "param-scanlineedgetaub": "72",
    "param-scanlineedgetaug": "72",
    "param-scanlineedgetaur": "72",
    "param-scanlinep1": "60",
    "param-scanlinep1onediscon": "105",
    "param-scanlinep1twodiscon": "70",
    "param-scanlinep2": "342",
    "param-scanlinep2onediscon": "190",
    "param-scanlinep2twodiscon": "130",
    "param-secondpeakdelta": "325",
    "param-texturecountthresh": "0",
    "param-texturedifferencethresh": "0",
    "param-usersm": "1",
    "param-zunits": "1000",
    "stream-depth-format": "Z16",
    "stream-fps": "30",
    "stream-height": "720",
    "stream-width": "1280"
}
RealSenseCustomerSupport commented 5 years ago

Hi @florianspy, In order to check segfault of realsense-viewer, you can try the command "$ catchsegv ./realsense-viewer". Suggest to try the latest librealsense. Probably, you can have a try below patch to see how it works. https://github.com/jetsonhacks/buildLibrealsense2TX/blob/master/patches/incomplete-frame.patch

Hi @abylikhsanov, I still can't reproduce this issue "Frames didn't arrive within 5 seconds" with my setup and your settings: D435i (firmware 5.11.4.0) + librealsense 2.19.0 + Ubuntu 18.04 + kernel 4.14.102+ on XU4. Probably, Run depth + color at 720p using realsense-viewer. One issue I have is "Incomplete video frame detected!" which is due to heavy processing required to handle the frames. Probably, you can provide more hints. And, you can also try have a device reset to see if it can be recovered.

abylikhsanov commented 5 years ago

@RealSenseCustomerSupport I have just tried the 5.11.4 firmware and 2.19.1 realsense but getting that problem. Which kernel patch did you use?

RealSenseCustomerSupport commented 5 years ago

Hi @abylikhsanov,

I use the same patch. https://github.com/freemanlo/librealsense/blob/odroid_build_4.14/scripts/patch-realsense-ubuntu-odroid-xu4-4.14.sh Please show me the full librealsense log (export LRS_LOG_LEVEL=DEBUG) and kernel log when starting moving the robot base and frame lost. If you don't move the robot, frame lost will not happen?

abylikhsanov commented 5 years ago

I also bought T265 and the frames get lost after 5-7 seconds. I have decided to reinstall kernel and probably install the kernel 5.0 and see what happens.

чт, 14 мар. 2019 г. в 15:23, RealSense Customer Support < notifications@github.com>:


Hi @abylikhsanov https://github.com/abylikhsanov,

I use the same patch.

https://github.com/freemanlo/librealsense/blob/odroid_build_4.14/scripts/patch-realsense-ubuntu-odroid-xu4-4.14.sh Please show me the full librealsense log (export LRS_LOG_LEVEL=DEBUG) and kernel log when starting moving the robot base and frame lost. If you don't move the robot, frame lost will not happen?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/IntelRealSense/librealsense/issues/3230#issuecomment-472881391, or mute the thread https://github.com/notifications/unsubscribe-auth/AM-l_ff0L2orNjFA7PdsEYnW9L9yROfDks5vWltqgaJpZM4andi1 .

-- Kind regards Abyl

RealSenseCustomerSupport commented 5 years ago

Hi @abylikhsanov,

Any update? If no further question, will close this.