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

vaDisplayIsValid random Segmentation fault #36

Open
alexge233 opened this issue Mar 16, 2017 · 9 comments
Open

vaDisplayIsValid random Segmentation fault #36

alexge233 opened this issue Mar 16, 2017 · 9 comments
Assignees

Comments

@alexge233
Copy link

alexge233 commented Mar 16, 2017

Hi,

I'm using libfreenect2 which is using libva for hardware encoding/decoding AFAIK, and I've opened an issue there as well.
System is Ubuntu 16.04 amd64, and I've got libva installed from apt-get, version 1.7.0-1.

I keep getting random segmentation faults:

[New Thread 0x7fffd178a700 (LWP 23148)]
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 8 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:5 with serial 001680660547
[Info] [Freenect2Impl] found 1 devices

Thread 1 "mario_node" received signal SIGSEGV, Segmentation fault.
0x00007fffeeda3347 in vaDisplayIsValid () from /usr/lib/x86_64-linux-gnu/libva.so.1
(gdb) bt
#0  0x00007fffeeda3347 in vaDisplayIsValid () from /usr/lib/x86_64-linux-gnu/libva.so.1
#1  0x00007ffff576a5c7 in libfreenect2::VaapiRgbPacketProcessorImpl::initializeVaapi() () from /home/mario/freenect2/lib/libfreenect2.so.0.2
#2  0x00007ffff5769408 in libfreenect2::VaapiRgbPacketProcessor::VaapiRgbPacketProcessor() () from /home/mario/freenect2/lib/libfreenect2.so.0.2
#3  0x00007ffff5756ee5 in libfreenect2::CpuPacketPipeline::CpuPacketPipeline() () from /home/mario/freenect2/lib/libfreenect2.so.0.2
#4  0x0000000000413e60 in freenect2::freenect2() ()

I took a look into their code, and the offending code appear to be:

  bool initializeVaapi()
  {
    /* Open display */
    static const char *drm_devices[] = {
      "/dev/dri/renderD128",
      "/dev/dri/card0",
      NULL,
    };
    for (int i = 0; drm_devices[i]; i++) {
      drm_fd = open(drm_devices[i], O_RDWR);
      if (drm_fd < 0)
        continue;
      display = vaGetDisplayDRM(drm_fd);
      if (vaDisplayIsValid(display))
        break;
      close(drm_fd);
      drm_fd = -1;
      display = NULL;
    }
    CHECK_COND(vaDisplayIsValid(display));

Please bear in mind the code (library) is executing under ssh but there is a gdm running, drivers are loaded, and the /dev/dri/* do exist.

@xhaihao
Copy link
Contributor

xhaihao commented Apr 20, 2017

@alexge233 sorry for slow response, all pointers are checked against NULL in vaDisplayIsValid(), so it is weird that you experienced this issue. Could you help to debug this issue with gdb when you encounter this issue again?

@alexge233
Copy link
Author

@xhaihao I can force it by re-compiling libfreenect with libva enabled. If I run it enough times it happens. Are there debug symbols in apt-get for va?

@xhaihao
Copy link
Contributor

xhaihao commented Apr 20, 2017

Thanks @alexge233 , you may try libva1-dbg or if possible, you can build the library from source code. you can download the release tarball from https://github.com/01org/libva/releases,

@alexge233
Copy link
Author

Hi @xhaihao on Ubuntu 16.04 there is no libva1-dbg, have you got a ppa repository?

@xhaihao
Copy link
Contributor

xhaihao commented Apr 23, 2017

@alexge233 Sorry I gave you wrong information. I saw libva1-dbg in the list bash-completion gave me when I typed 'apt-get install libva<TAB>', I thought libva1-dbg is available to install.

@xhaihao xhaihao self-assigned this May 31, 2017
@FocusLuo FocusLuo added P3 P4 and removed P3 labels May 31, 2017
@FocusLuo
Copy link

Assigned to P4 priority based on our bug scrub meeting

@xhaihao
Copy link
Contributor

xhaihao commented Jul 13, 2017

@alexge233 Do you have a chance to debug this problem? I don't have the environment to reproduce this issue.

@alexge233
Copy link
Author

No sorry, we've changed platform and moved on to a tegra.

@juraj-chripko
Copy link

Hi,
it looks like I'm getting same error when trying to encode webp. I have build both static and dynamic library from my sources and using that library in other program. When I use static library, everything works just fine, but using shared library I get segfault in vaDisplayIsValid, which is odd, because I thought program using libva has to be linked dynamically to load driver. I tried debugging and display variable (which i got from va_open_display() function from libva-utils/common/libva-display) is not NULL, but I cannot acces other display object variables. I can send you crash dump, or my code, but it's mostly copied from encode example from libva-utils.

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

No branches or pull requests

4 participants