Segment violation when switching to Motion

I’m very new to bluecherry but today I encountered a bug which crashed the server. It occurred when I introduced motion into a specific device’s schedule for the first time. Previously all of my cameras were set to continuous always.

log file section:

Jan  1 22:49:44 bluecherry bc-server[16961]: I(2/Garage): Applying configuration changes
Jan  1 22:51:22 bluecherry bc-server[16961]: I(2/Garage): Last message repeated 1 times!
Jan  1 22:51:22 bluecherry bc-server[16961]: I(2/Garage): Switching to new recording schedule 'motion'
Jan  1 22:51:22 bluecherry bc-server[16961]: BUG: Segment violation at 0x0000000000000008
Jan  1 22:51:22 bluecherry bc-server[16961]: Call trace:
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x0000000000420580]  @ /usr/sbin/bc-server
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cb1ce4b0]  @ /lib/x86_64-linux-gnu/libc.so.6
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd1d6513] av_buffer_ref+0x00000000 @ /usr/lib/bluecherry/libavutil.so.56
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x0000000000424af8]  @ /usr/sbin/bc-server
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd57d518]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd5fabbd]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd5fba84]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd600822]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd60410a]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd57ba0b]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd57c678] avcodec_send_packet+0x00000000 @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cd57ebc7]  @ /usr/lib/bluecherry/libavcodec.so.58
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x000000000042245e]  @ /usr/sbin/bc-server
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00000000004228c9]  @ /usr/sbin/bc-server
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2caf836ba]  @ /lib/x86_64-linux-gnu/libpthread.so.0
Jan  1 22:51:22 bluecherry bc-server[16961]: [0x00007ff2cb2a041d] clone+0x00000000 @ /lib/x86_64-linux-gnu/libc.so.6

I’m also new, and also using motion detection, and seeing similar segfaults, on Ubuntu 18.04.3.

Jan  1 00:27:45 gwmobo bc-server[10368]: BUG: Segment violation at 0x00007f0000bffc90
Jan  1 00:27:45 gwmobo bc-server[10368]: Call trace:
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x0000559d5502208a]  @ /usr/sbin/bc-server
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda4dadf20]  @ /lib/x86_64-linux-gnu/libc.so.6
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda6d8a03c] av_buffer_pool_get+0x00000000 @ /usr/lib/bluecherry/libavutil.so.55
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda724d444] avcodec_default_get_buffer2+0x00000000 @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda724dd2b]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda7223bf7]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda70f5b0e]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda70fa749]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda70a92f6]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda70aafef]  @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda724eefa] avcodec_decode_video2+0x00000000 @ /usr/lib/bluecherry/libavcodec.so.57
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x0000559d550240aa]  @ /usr/sbin/bc-server
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x0000559d550245c9]  @ /usr/sbin/bc-server
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda4b576db]  @ /lib/x86_64-linux-gnu/libpthread.so.0
Jan  1 00:27:45 gwmobo bc-server[10368]: [0x00007fdda4e9088f] clone+0x00000000 @ /lib/x86_64-linux-gnu/libc.so.6

Can you please tell which version of Bluecherry server do you run?

Yes, I should have included that in my first post. I am running 3.0.0 built from master, on Ubuntu Server 16.04.6.

In my case, version 2.8.8 installed from http://ubuntu.bluecherrydvr.com

Should be fixed now, please try to pull latest changes from the master branch and rebuild/reinstall

Can you please provide some more details? Like, what camera do you use, stream settings? Does it crash every time when motion detection is enabled or sometimes?

For me, the crashes are sporadic - happens maybe once every 2-3 days, and not obviously tied to motion detection events (there’s nothing in the log immediately preceding the crash). I’m streaming RTSP from a couple of Wyze V2 cams (for now - still evaluating options for “real” cams)

It might be a couple of days before I can try to replicate it, I had deleted that VM. It’s just speculation but I recall that before adding cameras I had set the global schedule to ‘Off’ -> ‘Fill All’ and was then intending on setting individual schedules as I added each camera.

The cameras are Wyze Cam v2 with RTSP firmware re-flash. Currently running without issue on my production DVR (bluecherry 2.8.8).

I have been unable to reproduce the issue after trying various combinations of camera and global motion settings for a newly added camera.