Skip to content

Getting segfault when device starts #5

Open

Description

@paul-shuvo

I'm getting the following error when the device starts. Any idea?

Connected to pydev debugger (build 202.8194.15)
[Info] [Freenect2Impl] enumerating devices...
[Info] [Freenect2Impl] 10 usb devices connected
[Info] [Freenect2Impl] found valid Kinect v2 @2:3 with serial 008752665047
[Info] [Freenect2Impl] found 1 devices
libva info: VA-API version 1.7.0
libva error: vaGetDriverNameByIndex() failed with unknown libva error, driver_name = (null)
[Error] [VaapiRgbPacketProcessorImpl] vaInitialize(display, &major_ver, &minor_ver): unknown libva error
[Info] [Freenect2DeviceImpl] opening...
[Info] [Freenect2DeviceImpl] transfer pool sizes rgb: 20*16384 ir: 60*8*33792
[Info] [Freenect2DeviceImpl] opened
[Info] [Freenect2DeviceImpl] starting...
[Info] [Freenect2DeviceImpl] submitting rgb transfers...
[Info] [Freenect2DeviceImpl] submitting depth transfers...
[Info] [Freenect2DeviceImpl] started
From cffi callback <function frame_listener_callback at 0x7f98b998ef28>:
Traceback (most recent call last):
  File "/home/vision/anaconda3/envs/alphapose/lib/python3.6/site-packages/freenect2/__init__.py", line 77, in frame_listener_callback
    callable_(FrameType(type_), frame)
  File "/home/vision/anaconda3/envs/alphapose/lib/python3.6/site-packages/freenect2/__init__.py", line 98, in __call__
    self.queue.put_nowait((frame_type, frame))
  File "/home/vision/anaconda3/envs/alphapose/lib/python3.6/queue.py", line 184, in put_nowait
    return self.put(item, block=False)
  File "/home/vision/anaconda3/envs/alphapose/lib/python3.6/queue.py", line 130, in put
    raise Full
queue.Full

Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

Activity

  1. xialuoke4062 commented on Jun 15, 2021

    @xialuoke4062

    Hi, I have encountered the same problem and have not been able to single out the cause. Any advice will be greatly appreciated!

    macOS Big Sur Version 11.4
    python 3.7

  2. paul-shuvo commented on Jun 16, 2021

    @paul-shuvo
    Author

    @xialuoke4062 as it says in the error the queue is full. You can probably increase the queue size. You can find the following piece of code in freenect2/__init__.py in line 93.

    class QueueFrameListener(object):
        def __init__(self, maxsize=16):
            self.queue = Queue(maxsize=maxsize)
        def __call__(self, frame_type, frame):
            self.queue.put_nowait((frame_type, frame))
        def get(self, timeout=False):
            return self.queue.get(True, timeout)

    Change the maxsize. For my case, I just saved the last 6/12/18 frames, so that if my program is slow, it doesn't crash.

  3. xialuoke4062 commented on Jun 16, 2021

    @xialuoke4062

    @paul-shuvo Thank you so much for the advice! Changing the maxsize definitely helps a bit. However, my program is indeed slow and I want to do some real-time analysis on the live stream (increasing maxsize isn't sufficient enough). When you said

    For my case, I just saved the last 6/12/18 frames

    how did you manage to achieve that inside the live-stream for loop
    for type_, frame in device:
    Thank you for your help in advance!

  4. paul-shuvo commented on Jun 16, 2021

    @paul-shuvo
    Author

    From what I remember, I did something of the following:

    class QueueFrameListener(object):
        def __init__(self, maxsize=16):
            self.queue = Queue(maxsize=maxsize)
        def __call__(self, frame_type, frame):
            # you can also check is the queue is full using .full method
            if self.queue.qsize() >= 12: # change the number of frames you want to use 
                # basically remove an item to accomodate the newer frames
                _ = self.get() # or, self.queue.get(True, timeout)
            self.queue.put_nowait((frame_type, frame))
        def get(self, timeout=False):
            return self.queue.get(True, timeout)

    Let me know if it solves your problem.

  5. xialuoke4062 commented on Jun 16, 2021

    @xialuoke4062

    Works like a charm and that makes perfect sense! Can't say thank you enough - I really appreciate your help!

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions