Motion-Project/motionplus

Motionplus crashes when I'm trying to get JSON object with information about all movies.

ilgiznurgaliev opened this issue · 5 comments

Did you read the guide?

Yes

What is the base version number of MotionPlus being used?

0.1.x

What was the install method?

Built from source code

What is base architecture?

x86/x64

What is the distro being used?

Other

Disto version number

Alpine 3.18.3 (Docker)

Camera/Sound type(s) being used?

Network camera with RTSP

Describe the issue/problem and steps to reproduce

Motionplus crashes when I'm trying to get JSON object with information about all movies:

/ # curl -v localhost:8080/0/movies.json
* processing: localhost:8080/0/movies.json
*   Trying [::1]:8080...
* Immediate connect fail for ::1: Address not available
*   Trying 127.0.0.1:8080...
* Connected to localhost (127.0.0.1) port 8080
> GET /0/movies.json HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.2.1
> Accept: */*
>
* Empty reply from server
* Closing connection
curl: (52) Empty reply from server

After that it just crashes. Below are logs from host server (motionplus runs inside docker container):

Sep 20 17:18:25 media kernel: wc00[114278]: segfault at 380 ip 0000561bc52d1304 sp 00007fe80e368ec0 error 4 in motionplus[561bc527a000+60000] likely on CPU 0 (core 0, socket 0)
Sep 20 17:18:25 media kernel: Code: c7 e8 70 8e fa ff c7 85 f0 ee ff ff ff ff ff ff c7 85 e8 ee ff ff 00 00 00 00 eb 55 48 8b 85 d8 ee ff ff 48 8b 80 20 02 00 00 <8b> 90 80 03 00 00 48 8b 85 d8 ee ff ff 48 8b 80 18 02 00 00 48 8b
[🡕] Process 114145 (motionplus) of user 0 dumped core.

Module /usr/bin/motionplus without build-id.
Module /usr/bin/motionplus
Module /usr/lib/dri/i965_drv_video.so without build-id.
Module /usr/lib/dri/i965_drv_video.so
Module /usr/lib/libdrm_intel.so.1.0.0 without build-id.
Module /usr/lib/libdrm_intel.so.1.0.0
Module /usr/lib/libpciaccess.so.0.11.1 without build-id.
Module /usr/lib/libpciaccess.so.0.11.1
Module /usr/lib/libglib-2.0.so.0.7600.4 without build-id.
Module /usr/lib/libglib-2.0.so.0.7600.4
Module /usr/lib/libSPIRV-Tools-opt.so without build-id.
Module /usr/lib/libSPIRV-Tools-opt.so
Module /usr/lib/libSPIRV-Tools.so without build-id.
Module /usr/lib/libSPIRV-Tools.so
Module /usr/lib/libasyncns.so.0.3.1 without build-id.
Module /usr/lib/libsndfile.so.1.0.35 without build-id.
Module /usr/lib/libsndfile.so.1.0.35
Module /usr/lib/libvulkan.so.1.3.243 without build-id.
Module /usr/lib/libvulkan.so.1.3.243
Module /usr/lib/libSPIRV.so.12.1.0 without build-id.
Module /usr/lib/libSPIRV.so.12.1.0
Module /usr/lib/libglslang-default-resource-limits.so.12.1.0 without build-id.
Module /usr/lib/libshaderc_shared.so.1 without build-id.
Module /usr/lib/libshaderc_shared.so.1
Module /usr/lib/libdbus-1.so.3.32.3 without build-id.
Module /usr/lib/libdbus-1.so.3.32.3
Module /usr/lib/libzimg.so.2.0.0 without build-id.
Module /usr/lib/libzimg.so.2.0.0
Module /usr/lib/libvidstab.so.1.2 without build-id.
Module /usr/lib/libvidstab.so.1.2
Module /usr/lib/libass.so.9.2.1 without build-id.
Module /usr/lib/libass.so.9.2.1
Module /usr/lib/libplacebo.so.264 without build-id.
Module /usr/lib/libplacebo.so.264
Module /usr/lib/libfribidi.so.0.4.0 without build-id.
Module /usr/lib/libpostproc.so.57.1.100 without build-id.
Module /usr/lib/libcjson.so.1.7.15 without build-id.
Module /usr/lib/libcjson.so.1.7.15
Module /usr/lib/libmbedcrypto.so.2.28.4 without build-id.
Module /usr/lib/libmbedcrypto.so.2.28.4
Module /usr/lib/libvorbisfile.so.3.3.8 without build-id.
Module /usr/lib/libvorbisfile.so.3.3.8
Module /usr/lib/libmpg123.so.0.47.0 without build-id.
Module /usr/lib/libmpg123.so.0.47.0
Module /usr/lib/libSDL2-2.0.so.0.2600.5 without build-id.
Module /usr/lib/libSDL2-2.0.so.0.2600.5
Module /usr/lib/libpulse.so.0.24.2 without build-id.
Module /usr/lib/libpulse.so.0.24.2
Module /usr/lib/libasound.so.2.0.0 without build-id.
Module /usr/lib/libasound.so.2.0.0
Module /usr/lib/libavfilter.so.9.3.100 without build-id.
Module /usr/lib/libavfilter.so.9.3.100
Module /usr/lib/libxvidcore.so.4.3 without build-id.
Module /usr/lib/libx264.so.164 without build-id.
Module /usr/lib/libx264.so.164
Module /usr/lib/libvorbisenc.so.2.0.12 without build-id.
Module /usr/lib/libvorbis.so.0.4.9 without build-id.
Module /usr/lib/libvorbis.so.0.4.9
Module /usr/lib/libtheoradec.so.1.1.4 without build-id.
Module /usr/lib/libtheoradec.so.1.1.4
Module /usr/lib/libtheoraenc.so.1.1.2 without build-id.
Module /usr/lib/libaom.so.3.6.1 without build-id.
Module /usr/lib/libaom.so.3.6.1
Module /usr/lib/libvpx.so.8.0.0 without build-id.
Module /usr/lib/libvpx.so.8.0.0
Module /usr/lib/libswresample.so.5.0.100 without build-id.
Module /usr/lib/libswresample.so.5.0.100
Module /usr/lib/libzmq.so.5.2.4 without build-id.
Module /usr/lib/libzmq.so.5.2.4
Module /usr/lib/libssh.so.4.9.5 without build-id.
Module /usr/lib/libssh.so.4.9.5
Module /usr/lib/libsrt.so.1.5.2 without build-id.
Module /usr/lib/libsrt.so.1.5.2
Module /usr/lib/librist.so.4.2.0 without build-id.
Module /usr/lib/librist.so.4.2.0
Module /lib/libz.so.1.2.13 without build-id.
Module /lib/libz.so.1.2.13
Module /usr/lib/libbluray.so.2.4.3 without build-id.
Module /usr/lib/libbluray.so.2.4.3
Module /usr/lib/libopenmpt.so.0.4.4 without build-id.
Module /usr/lib/libopenmpt.so.0.4.4
Module /usr/lib/libxml2.so.2.11.4 without build-id.
Module /usr/lib/libxml2.so.2.11.4
Module /usr/lib/libvdpau.so.1.0.0 without build-id.
Module /usr/lib/libstdc++.so.6.0.30 without build-id.
Module /usr/lib/libstdc++.so.6.0.30
Module /usr/lib/libavdevice.so.60.1.100 without build-id.
Module /usr/lib/libavdevice.so.60.1.100
Module /usr/lib/libswscale.so.7.1.100 without build-id.
Module /usr/lib/libswscale.so.7.1.100
Module /usr/lib/libavcodec.so.60.3.100 without build-id.
Module /usr/lib/libavcodec.so.60.3.100
Module /usr/lib/libavformat.so.60.3.100 without build-id.
Module /usr/lib/libavformat.so.60.3.100
Module /usr/lib/libavutil.so.58.2.100 without build-id.
Module /usr/lib/libavutil.so.58.2.100
Module /usr/lib/libmicrohttpd.so.12.61.0 without build-id.
Module /usr/lib/libmicrohttpd.so.12.61.0
Module /usr/lib/libjpeg.so.8.2.2 without build-id.
Module /usr/lib/libjpeg.so.8.2.2
Module /usr/lib/libintl.so.8.3.0 without build-id.
Module /usr/lib/libintl.so.8.3.0
Module /lib/ld-musl-x86_64.so.1 without build-id.
Module /lib/ld-musl-x86_64.so.1
 Stack trace of thread 20:
 #0  0x0000561bc52d1304 n/a (/usr/bin/motionplus + 0x5e304)
 #1  0x0000561bc52d2194 n/a (/usr/bin/motionplus + 0x5f194)
 #2  0x0000561bc52c9871 n/a (/usr/bin/motionplus + 0x56871)
 #3  0x0000561bc52c9d6b n/a (/usr/bin/motionplus + 0x56d6b)
 #4  0x00007fe81ef0bcb6 n/a (/usr/lib/libmicrohttpd.so.12.61.0 + 0x5cb6)

Relevant MotionPlus log output (at log_level 8)

[DBG][STR][00:wc00] webu_parseurl: Sent url: /0/movies.json
[DBG][STR][00:wc00] webu_parseurl: Decoded url: /0/movies.json
[DBG][STR][00:wc00] webu_parms_edit: camid: >0< thread: >-1< cmd1: >movies.json< cmd2: >< cmd3: ><
[DBG][ALL][00:wc00] webu_hostname: Full Host:  //localhost:8080
[INF][ALL][00:wc00] webu_client_connect: Connection from: 127.0.0.1
[DBG][ALL][00:wc00] webu_hostname: Full Host:  //localhost:8080
[DBG][STR][00:wc00] webu_answer_get: processing get

Yep. Individual cameras work. Using a 0 for camid causes crash. Tested on ubuntu 20.04 wsl env.

Not related to this issues, just found out that motionplus uses much more CPU than motion.

image

This is with 4 network IP camera with RTSP, on home server with Celeron J4125 2.00GHz.

Not related to this issues, just found out that motionplus uses much more CPU than motion.

I don't think source builds are inheriting CFLAGS (into CXXFLAGS) at the moment.

Weirdly, it's something I noticed earlier today myself and was going to put in a bug report on once I'd tracked down the cause.

You can tack '-g -O2' onto the end of CXXFLAGS in motionplus/src/Makefile as a work around though.

You can tack '-g -O2' onto the end of CXXFLAGS in motionplus/src/Makefile as a work around though.

Hi @jimtuck. There is no such file motionplus/src/Makefile. I found (by grep-ing) CXXFLAGS in motionplus/configure.ac only.

Is it right place?

$ grep -R CXXFLAGS .
./configure.ac:CXXFLAGS="$CXXFLAGS -std=c++17"

Hi @jimtuck. There is no such file motionplus/src/Makefile. I found (by grep-ing) CXXFLAGS in motionplus/configure.ac only.

The makefiles only exist after you've run 'autoreconf -fiv' and './configure', but you can add '-g -O2' to configure.ac before running them and they'll be included in the makefiles.