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

"MJPEG decoder initialization failed" on Ubuntu 18.04 #672

Closed
skalldri opened this issue Aug 23, 2019 · 6 comments · Fixed by #763
Closed

"MJPEG decoder initialization failed" on Ubuntu 18.04 #672

skalldri opened this issue Aug 23, 2019 · 6 comments · Fixed by #763
Assignees
Labels
Bug Something isn't working Linux This issue affects only Linux Triage Approved The Issue has been approved by an Azure Kinect team member.

Comments

@skalldri
Copy link
Contributor

Describe the bug

Users of the Azure Kinect ROS Driver are seeing issues where the MJPEG decoder fails to initialize. Clearing this error requires restarting the PC. The only error provided by the SDK is:

[2019-08-23 10:54:16.941] [error] [t=13655] /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/src/color/uvc_camerareader.cpp (1267): DecodeMJPEGtoBGRA32(). MJPEG decoder initialization failed

[2019-08-23 10:54:16.941] [error] [t=13656] /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/src/sdk/k4a.c (271): capturesync_get_capture(device->capturesync, capture_handle, timeout_in_ms) returned failure in k4a_device_get_capture()

Based on the code that generates the error, this appears to be a fatal error in libjpeg.

To Reproduce

We aren't 100% clear on the repro steps for this issue. The best we can tell, we just need to restart an application that uses the color camera in BGRA mode lots of times, and eventually this issue will reproduce.

Expected behavior
MJPEG decoder initialization should never fail.

Logs

Screenshots

Desktop (please complete the following information):

  • OS with Version: Ubuntu 18.04
  • SDK Version: 1.1.1
  • Firmware version:
 == Azure Kinect DK Firmware Tool == 
Device Serial Number: 000134685112
Current Firmware Versions:
  RGB camera firmware:      1.6.102
  Depth camera firmware:    1.6.75
  Depth config file:        6109.7
  Audio firmware:           1.6.14
  Build Config:             Production
  Certificate Type:         Microsoft

Additional context

@skalldri skalldri added Bug Something isn't working Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. labels Aug 23, 2019
@skalldri
Copy link
Contributor Author

It looks like libjpeg can provide more details on the error if we call tjGetErrorStr(). At a minimum, the SDK should be calling that function and providing a more verbose libjpeg error to the user.

@skalldri
Copy link
Contributor Author

I added a line to print the contents of tjGetErrorStr() and I'm getting this as the output:

[2019-08-23 11:31:25.386] [error] [t=7529] ../src/color/uvc_camerareader.cpp (1268): DecodeMJPEGtoBGRA32(). tjGetErrorStr(): Wrong JPEG library version: library is 80, caller expects 62

Any idea what this means?

@tesych tesych added Triage Approved The Issue has been approved by an Azure Kinect team member. More Info Needed More information is required before this issue can be approved and removed Triage Needed The Issue still needs to be reviewed by Azure Kinect team members. Triage Approved The Issue has been approved by an Azure Kinect team member. labels Aug 30, 2019
@skalldri
Copy link
Contributor Author

@tesych this appears to be a bug in the SDK. We've been investigating this over in the Azure Kinect ROS Driver (microsoft/Azure_Kinect_ROS_Driver#67, microsoft/Azure_Kinect_ROS_Driver#37), and I talked with @schultetwin1 about it. We're fairly sure that the SDK is exporting libjpeg-turbo symbols into the global process symbol lookup table (which it shouldn't be doing), which conflicts with other libraries that compiled against libjpeg.

I did some deep-dive investigation a few weeks back, and crashed my ROS code intentionally under GDB to see what's going on.

(gdb) backtrace
#0 0x00007ffff7b0b4e5 in jpeg_CreateCompress (cinfo=0x7fff5fffd5b0, version=80, structsize=584) at /home/vsts/work/1/s/extern/Azure-Kinect-Sensor-SDK/extern/libjpeg-turbo/src/jcapimin.c:41
#1 0x00007fffde35a82c in ?? () from /usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2
#2 0x00007fffde34d45c in cv::imencode(cv::String const&, cv::InputArray const&, std::vector<unsigned char, std::allocator >&, std::vector<int, std::allocator > const&) () from /usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2
#3 0x00007fffc2650a9d in ?? () from /opt/ros/melodic/lib//libcompressed_image_transport.so
#4 0x00007fffc265644e in ?? () from /opt/ros/melodic/lib//libcompressed_image_transport.so
#5 0x00007ffff752254d in image_transport::Publisher::publish(boost::shared_ptr<sensor_msgs::Image<std::allocator > const> const&) const () from /opt/ros/melodic/lib/libimage_transport.so
#6 0x0000555555566905 in K4AROSDevice::framePublisherThread() ()
#7 0x000055555557391c in void std::__invoke_impl<void, void (K4AROSDevice::)(), K4AROSDevice>(std::__invoke_memfun_deref, void (K4AROSDevice::&&)(), K4AROSDevice&&) ()
#8 0x000055555556eadf in std::__invoke_result<void (K4AROSDevice::)(), K4AROSDevice>::type std::__invoke<void (K4AROSDevice::)(), K4AROSDevice>(void (K4AROSDevice::&&)(), K4AROSDevice&&) ()
#9 0x000055555557cc2b in decltype (__invoke((_S_declval<0ul>)(), (_S_declval<1ul>)())) std::thread::_Invoker<std::tuple<void (K4AROSDevice::)(), K4AROSDevice> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) ()
#10 0x000055555557cbcc in std::thread::_Invoker<std::tuple<void (K4AROSDevice::)(), K4AROSDevice> >::operator()() ()
#11 0x000055555557cb80 in std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (K4AROSDevice::)(), K4AROSDevice> > >::_M_run() ()
#12 0x00007ffff633166f in ?? () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#13 0x00007ffff66046db in start_thread (arg=0x7fff5ffff700) at pthread_create.c:463
#14 0x00007ffff59ee88f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

This is wrong: based on the OpenCV source code, libopencv_imgcodecs should be calling into libjpeg.so.8, not libk4a. Ok, so lets check the loaded shared libraries:

(gdb) info sharedlibrary
From To Syms Read Shared Object Library
...
0x00007ffff7ac2aa0 0x00007ffff7b74225 Yes /usr/lib/x86_64-linux-gnu/libk4a.so.1.2
0x00007ffff77c3940 0x00007ffff7848f1c Yes /usr/lib/x86_64-linux-gnu/libk4arecord.so.1.2
....
0x00007fffdd745e10 0x00007fffdd77f7a0 Yes () /usr/lib/x86_64-linux-gnu/libjpeg.so.8
....
0x00007fffde348bb0 0x00007fffde36abbe Yes () /usr/lib/x86_64-linux-gnu/libopencv_imgcodecs.so.3.2

Ok... all the right shared libs are loaded, so why is it picking the wrong symbol still?

Lets look in libk4a:

objdump -t /usr/lib/x86_64-linux-gnu/libk4a.so.1.2 | grep jpeg_CreateDecompress
000000000007dfb0 g F .text 0000000000000136 jpeg_CreateDecompress

Ah ha. This symbol should be marked with visbility=hidden to prevent this kind of conflict, and indeed this should have been fixed by #651 . However, it's still not hidden in the binaries that are published as part of the 1.2 SDK, so this doesn't appear to have fixed the issue.

@skalldri
Copy link
Contributor Author

@schultetwin1 can you take this bug while I'm away? We have a pretty good root cause, so it would be good to get it closed.

@schultetwin1 schultetwin1 self-assigned this Sep 12, 2019
@schultetwin1
Copy link
Contributor

On it!

@schultetwin1 schultetwin1 added Linux This issue affects only Linux Triage Approved The Issue has been approved by an Azure Kinect team member. and removed More Info Needed More information is required before this issue can be approved labels Sep 12, 2019
@cpatel245
Copy link

Hello,

I was trying to connect the cameras on Intel NUC with addiitional startech PCI card . But I am running into the same error.

OS with Version: Ubuntu 18.04
SDK Version: 1.4.1
color image format: BGRA
Firmware version:
[ info ] : ******************** Device Info ********************
[ info ] : K4A SDK version: 1.4.1
[ info ] : Serial Number: 000398104412
[ info ] : RGB Sensor Version: 1.6.110
[ info ] : Depth Sensor Version:1.6.79
[ info ] : Mic Array Version: 1.6.14
[ info ] : Sensor Config: 6109.7
[ info ] : Build type: Release
[ info ] : Signature type: MSFT
[ info ] : ****************************************************

Log from the k4aviewer is attached here . k4a_log.txt

With little debugging I have found that it could be due to tjDecompress2 which comes from this libjpeg/turbojpeg

k4a

Is there a specific version for this library which could be a fix?

k4a_log.txt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Linux This issue affects only Linux Triage Approved The Issue has been approved by an Azure Kinect team member.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants