elsampsa / valkka-live

OpenSource Video Surveillance Program
GNU Affero General Public License v3.0
31 stars 12 forks source link

Segmentation fault #15

Closed rams3350 closed 8 months ago

rams3350 commented 9 months ago

@elsampsa

Installed valkka-live successfully and able to run the single camera in the video grid.While trying to add more cameras its show valkka image ideally after some time it crashed with the following error.Could you please help on this

/home/rams/.local/bin/valkka-live: line 9: 9941 Segmentation fault (core dumped) run-valkka-live "$@"


Segfault when executing Valkka : are you running on tested hardware and drivers? See: http://www.valkka.fi/ * It could also be about your machine vision plugins *


elsampsa commented 9 months ago

Could you please post some more information:

Finally, you could run valkka-live against gdb with:

gdb --args python3 run-valkka-live
run
bt # once the segfault has occurred

and post here the backtrace (bt)

Thanks for the report!

rams3350 commented 9 months ago

@elsampsa Thanks for the Quick Response Here is the information please check

After changing the time sync and resolution of cameras able to view the live for 3 cameras but its getting segfault while viewing the live stream

  1. Your Ubuntu version -- Ubuntu 22.04
  2. What cameras brands and models you are using? ---- IMOU Bullet 2C-D
  3. Number of cameras and cameras' characteristics (resolution, framerate) -----

Right-now configured with 3 cameras.In future we are planning more cameras. 1920x1080 resolution, 25 framerate

  1. What graphics driver are you using? Intel or nvidia? Driver versions would be nice to know.------- need to run on both GPU's because i have a another system with Nvidia and Intel Arc present Gpu is "NVIDIA GeForce RTX 4050"

  2. Did the segfault occur while running with analytics or while just viewing the live stream(s)? ---- while just viewing the live streams

Output of quicktest.py

rams@Asus-i5-RTX:~$ python3 quicktest.py

Loading Valkka Valkka loaded ok Version 1.6.1 Core loaded from /usr/lib/python3/dist-packages/valkka/core/init.py

Testing Valkka classes Valkka classes ok

Checking Valkka python examples version: 1.6.1

Checking valkka.onvif and valkka.discovery onvif & discovery loaded ok onvif loaded from : /home/rams/valkka-onvif/valkka/onvif/base.py discovery loaded from : /home/rams/valkka-onvif/valkka/discovery/base.py

Checking valkka.multiprocess loaded from : /usr/lib/python3/dist-packages/valkka/multiprocess/base.py

Loading numerical python Numpy loaded ok Numpy loaded from : /home/rams/.local/lib/python3.10/site-packages/numpy/init.py Numpy version : 1.21.5 libValkka was compiled
with numpy version : 1.21.5

Loading OpenCV OpenCV loaded ok Version 4.8.0-dev Loaded from /usr/lib/python3/dist-packages/cv2/init.py

Loading PySide2 Version 5.15.2.1 Loaded from /home/rams/.local/lib/python3.10/site-packages/PySide2/init.py

Checking Shapely shapely ok

Loading setproctitle setproctitle ok

Checking for VAAPI hardware acceleration WARNING: Command vainfo failed! check that you have installed VAAPI drivers correctly Please run: LIBVA_DRIVER_NAME=i965 vainfo VAAPI acceleration available: you can use valkka.core.VAAPIThread instead of valkka.core.AVThread

Checking for NVIDIA/CUDA hardware acceleration CUDA acceleration available: you can use valkka.nv.NVThread instead of AVThread

Taking a look at your X11 DISPLAY variable Weird X11 DISPLAY env variable :1 WARNING: Some valkka example / test programs assume :0.0 (aka :0 or :.0)

Taking a look at current user's groups

backtrace (bt) output

rams@Asus-i5-RTX:~$ gdb --args python3 run-valkka-live GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1 Copyright (C) 2022 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later http://gnu.org/licenses/gpl.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: https://www.gnu.org/software/gdb/bugs/. Find the GDB manual and other documentation resources online at: http://www.gnu.org/software/gdb/documentation/.

For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from python3... Reading symbols from /usr/lib/debug/.build-id/08/d0fd215a9a98d5333fda7e5a9a46c923148415.debug... (gdb) run Starting program: /usr/bin/python3 run-valkka-live [Thread debugging using libthread_db enabled] Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1". /usr/bin/python3: can't open file '/home/rams/run-valkka-live': [Errno 2] No such file or directory [Inferior 1 (process 21975) exited with code 02] (gdb) (gdb) bt No stack. (gdb)

elsampsa commented 9 months ago

Thanks for the report. At this stage can't really say why this happens..

Let's try a few things more

(1) As you can see, you didn't run valkka-live with the gdb debugger at all (No such file or directory). Please try again. Start with:

whereis run-valkka-live

And then based on that, run

gdb --args python3 /home/sampsa/.local/bin/run-valkka-live
run
bt  # once the crash has occurred

(i.e., substitute that /home/sampsa/etc with your location of the run-valkka-live python script)

(2) Just checking: you are not using VAAPI acceleration, aren't you? (i.e. starting run-valkka-live with --vaap=true)

(3) Is this description of the situation correct?

Or does the segfault happen while you are doing something? (closing/opening a window, manipulating cameras, exiting valkka-live, etc?) .. to clarify this, it's important to see the terminal output. So please run valkka live like this:

run-valkka-live &> dump.txt

Then you can attach dump.txt here as a file (don't copy-paste as there will be too much text!)

(4) Let's check if you're using X11 or that newfangled Wayland window manager with

printf 'Session is: %s\n' "${DISPLAY:+X11}${WAYLAND_DISPLAY:+WAYLAND}"

It should tell if you're in X11 or Wayland

(5) Based on your explanation, I'm not sure through which GPU valkka is streaming to the screen.. intel or nvidia?

Finally, if everything else fails, I need to replicate this behaviour by myself somehow..

elsampsa commented 8 months ago

OK, this segfault originates from valkka filesystem callbacks: they send information about new blocks from C++ to python.

Valkkafs is supposed to be experimental feature, but accidentally it is enabled by default when you start valkka live..!

In the latest commit the default option is set to --playback=false

Here's the backtrace (will debug someday):

Thread 64 "valkka-live" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffe70e76640 (LWP 5557)]
0x0000555555677db8 in PyTuple_New ()
(gdb) bt
#0  0x0000555555677db8 in PyTuple_New ()
#1  0x00007ffff573442c in ValkkaFS::callPyFunc (this=0x5555562ae230, msg="", use_gil=true) at /home/sampsa/C/valkka/src/valkkafs.cpp:182
#2  0x00007ffff5734d13 in ValkkaFS::writeBlock (this=0x5555562ae230, pycall=true, use_gil=true) at /home/sampsa/C/valkka/src/valkkafs.cpp:306
#3  0x00007ffff573665b in ValkkaFSWriterThread::saveCurrentBlock (this=0x555557400210, pycall=true, use_gil=true) at /home/sampsa/C/valkka/src/valkkafs.cpp:643
#4  0x00007ffff5736216 in ValkkaFSWriterThread::run (this=0x555557400210) at /home/sampsa/C/valkka/src/valkkafs.cpp:576
#5  0x00007ffff5729112 in Thread::mainRun (this=0x555557400210) at /home/sampsa/C/valkka/src/thread.cpp:76
#6  0x00007ffff57291ae in Thread::mainRun_ (p=0x555557400210) at /home/sampsa/C/valkka/src/thread.cpp:84
#7  0x00007ffff7c94ac3 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
#8  0x00007ffff7d26850 in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81