motion crashes with "trap invalid opcode" from kernel
Question
Hi,
I'm setting up motion 3.2.7 on a Fedora Core 6 installation. Actual kernel is 2.6.19 (x86_64), not the FC6 default. Ffmpeg is is SVN-r6835.
Motion was compiled from source, only with ffmpeg, no mysql or postgres
The 1st times I noticed this crash were allways very close to midnight, so I think that it may be related to the timelapse video (
ffmpeg_timelapse_mode daily, timelapse_filename cam%t.%Y%m%d.lap
)
After I found out that motions dies I set up a watcher using cron checking if the process exists every 2 minutes, if it's not there it's is launched again.
The funny thing is that most of the times it takes 4 or 5 tries to get motion running ok.
Take a look at this log.
Motion is started at 14:45:34, dies at 14:46:30. The watcher notices this and reloads motion at 14:48:01, it crashes again at 14:49:00. The watcher reloads it at 14:50:01, and it dies again at 14:51:00. It's reloaded again at 14:52:01 and it has been running since than (now it's 15:52). I expect it do die again at about 00:00:30 and go for another crash/reload fandango.
=======================================================================
Dec 20 14:45:34 conan motion: [0] Processing thread 0 - config file /usr/local/etc/motion.conf
Dec 20 14:45:34 conan motion: [0] Processing config file /usr/local/etc/cam1.conf
Dec 20 14:45:34 conan motion: [0] Processing config file /usr/local/etc/cam2.conf
Dec 20 14:45:34 conan motion: [0] Processing config file /usr/local/etc/cam3.conf
Dec 20 14:45:34 conan motion: [0] Created process id file /var/run/motion.pid. Process ID is 17756
Dec 20 14:45:34 conan motion: [0] Motion running as daemon process
Dec 20 14:45:34 conan motion: [0] Thread 1 is from /usr/local/etc/cam1.conf
Dec 20 14:45:34 conan motion: [0] Thread 2 is from /usr/local/etc/cam2.conf
Dec 20 14:45:34 conan motion: [0] Thread 3 is from /usr/local/etc/cam3.conf
Dec 20 14:46:30 conan kernel: motion[17758] trap invalid opcode rip:415332 rsp:40ff1390 error:0
Dec 20 14:48:01 conan motion: [0] Processing thread 0 - config file /usr/local/etc/motion.conf
Dec 20 14:48:01 conan motion: [0] Processing config file /usr/local/etc/cam1.conf
Dec 20 14:48:01 conan motion: [0] Processing config file /usr/local/etc/cam2.conf
Dec 20 14:48:01 conan motion: [0] Processing config file /usr/local/etc/cam3.conf
Dec 20 14:48:01 conan motion: [0] Created process id file /var/run/motion.pid. Process ID is 17798
Dec 20 14:48:01 conan motion: [0] Motion running as daemon process
Dec 20 14:48:01 conan motion: [0] Thread 1 is from /usr/local/etc/cam1.conf
Dec 20 14:48:01 conan motion: [0] Thread 2 is from /usr/local/etc/cam2.conf
Dec 20 14:48:01 conan motion: [0] Thread 3 is from /usr/local/etc/cam3.conf
Dec 20 14:49:00 conan kernel: motion[17799] trap invalid opcode rip:415332 rsp:407f0390 error:0
Dec 20 14:50:01 conan motion: [0] Processing thread 0 - config file /usr/local/etc/motion.conf
Dec 20 14:50:01 conan motion: [0] Processing config file /usr/local/etc/cam1.conf
Dec 20 14:50:01 conan motion: [0] Processing config file /usr/local/etc/cam2.conf
Dec 20 14:50:01 conan motion: [0] Processing config file /usr/local/etc/cam3.conf
Dec 20 14:50:01 conan motion: [0] Created process id file /var/run/motion.pid. Process ID is 17830
Dec 20 14:50:01 conan motion: [0] Motion running as daemon process
Dec 20 14:50:01 conan motion: [0] Thread 1 is from /usr/local/etc/cam1.conf
Dec 20 14:50:01 conan motion: [0] Thread 2 is from /usr/local/etc/cam2.conf
Dec 20 14:50:01 conan motion: [0] Thread 3 is from /usr/local/etc/cam3.conf
Dec 20 14:51:00 conan kernel: motion[17832] trap invalid opcode rip:415332 rsp:40ff1390 error:0
Dec 20 14:52:01 conan motion: [0] Processing thread 0 - config file /usr/local/etc/motion.conf
Dec 20 14:52:01 conan motion: [0] Processing config file /usr/local/etc/cam1.conf
Dec 20 14:52:01 conan motion: [0] Processing config file /usr/local/etc/cam2.conf
Dec 20 14:52:01 conan motion: [0] Processing config file /usr/local/etc/cam3.conf
Dec 20 14:52:01 conan motion: [0] Created process id file /var/run/motion.pid. Process ID is 17860
Dec 20 14:52:01 conan motion: [0] Motion running as daemon process
Dec 20 14:52:01 conan motion: [0] Thread 1 is from /usr/local/etc/cam1.conf
Dec 20 14:52:01 conan motion: [0] Thread 2 is from /usr/local/etc/cam2.conf
Dec 20 14:52:01 conan motion: [0] Thread 3 is from /usr/local/etc/cam3.conf
=======================================================================
I'm at a loss here, motion problem or kernel problem ? I compiled this kernel myself, maybe I should try it with the default fc6. This is a 64 bits kernel but I could try with a 32 bits.
I think that this version of ffmpeg is not 100% ok, as it was impossible to use the msmpeg4 codec. Motion was dumping core during the creation of the 1st movie. As this is not a problem for me I didn't tryed to fix it but maybe it's the source of the problem.
Any clues, anyone ???
error on /var/log/messages
-----------------------------
Dec 20 14:50:01 conan motion: [0] Created process id file /var/run/motion.pid. Process ID is 17830
Dec 20 14:50:01 conan motion: [0] Motion running as daemon process
Dec 20 14:50:01 conan motion: [0] Thread 1 is from /usr/local/etc/cam1.conf
Dec 20 14:50:01 conan motion: [0] Thread 2 is from /usr/local/etc/cam2.conf
Dec 20 14:50:01 conan motion: [0] Thread 3 is from /usr/local/etc/cam3.conf
Dec 20 14:51:00 conan kernel: motion[17832] trap invalid opcode rip:415332 rsp:40ff1390 error:0
ffmpeg version
----------------------------
root@conan:/usr/local/src # ffmpeg -L
FFmpeg version SVN-r6835, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --enable-mp3lame --enable-libogg --enable-vorbis --enable-faad --enable-faac --enable-libgsm --enable-xvid --enable-x264 --enable-a52 --enable-a52bin --enable-pp --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
libavutil version: 49.0.2
libavcodec version: 51.22.0
libavformat version: 50.6.0
built on Nov 1 2006 13:08:15, gcc: 4.1.1 20061011 (Red Hat 4.1.1-30)
FFmpeg version SVN-r6835, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --prefix=/usr --incdir=/usr/include/ffmpeg --libdir=/usr/lib64 --shlibdir=/usr/lib64 --mandir=/usr/share/man --arch=x86_64 --extra-cflags=-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic --enable-mp3lame --enable-libogg --enable-vorbis --enable-faad --enable-faac --enable-libgsm --enable-xvid --enable-x264 --enable-a52 --enable-a52bin --enable-pp --disable-static --enable-shared --enable-gpl --disable-debug --disable-opts --disable-strip
libavutil version: 49.0.2
libavcodec version: 51.22.0
libavformat version: 50.6.0
built on Nov 1 2006 13:08:15, gcc: 4.1.1 20061011 (Red Hat 4.1.1-30)
FFmpeg is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
FFmpeg is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with FFmpeg; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
motion.conf
-----------------------------------------
daemon on
process_id_file /var/run/motion.pid
setup_mode off
framerate 80
minimum_frame_time 0
roundrobin_frames 1
roundrobin_skip 1
switchfilter on
threshold 1500
threshold_tune off
noise_level 32
noise_tune on
night_compensate off
despeckle EedDl
smart_mask_speed 0
lightswitch 90
minimum_motion_frames 2
pre_capture 24
post_capture 240
gap 60
max_mpeg_time 1200
low_cpu 0
output_all off
output_normal best
output_motion off
quality 75
ppm off
ffmpeg_cap_new on
ffmpeg_cap_motion off
ffmpeg_timelapse 30
ffmpeg_timelapse_mode daily
ffmpeg_bps 500000
ffmpeg_variable_bitrate 0
ffmpeg_video_codec mpeg4
ffmpeg_deinterlace off
snapshot_interval 300
locate on
text_changes on
text_event %Y%m%d-%H%M%S
text_double on
snapshot_filename cam%t-%C-snap
jpeg_filename cam%t-%C-trig
movie_filename cam%t-%C
timelapse_filename cam%t.%Y%m%d.lap
webcam_quality 50
webcam_motion off
webcam_maxrate 4
webcam_localhost off
webcam_limit 0
control_port 8080
control_localhost on
control_html_output on
track_type 0
track_auto off
track_motorx -1
track_motory -1
track_maxx 0
track_maxy 0
track_iomojo_id 0
track_step_angle_x 10
track_step_angle_y 10
track_move_wait 10
track_speed 255
track_stepsize 40
quiet on
; if filename ends with .mpg calls ffmpeg to trasncode it to avi.
; if ends in .avi does nothing
on_movie_end /data/motion/scripts/mpg2avi %f >>/data/motion/logs/transcoding.log 2>&1
thread /usr/local/etc/cam1.conf
thread /usr/local/etc/cam2.conf
thread /usr/local/etc/cam3.conf
cam1.conf
----------------------------------
netcam_url http://cam1/axis-cgi/mjpg/video.cgi?resolution=640x480
target_dir /data/motion/cams/1
text_left CAMERA 1
webcam_port 8081
cam2.conf
-----------------------------------
netcam_url http://cam2/axis-cgi/mjpg/video.cgi?resolution=640x480
target_dir /data/motion/cams/2
text_left CAMERA 2
webcam_port 8082
cam3.conf
------------------------------------
netcam_url http://cam3/axis-cgi/mjpg/video.cgi?resolution=640x480
target_dir /data/motion/cams/3
text_left CAMERA 3
webcam_port 8083
Environment
Motion version: |
3.2.7 |
ffmpeg version: |
SVN-r6835 |
Libraries: |
ffmpeg |
Server OS: |
Fedora Core 6, kernel 2.6.19 |
--
AntonioVasconcelos - 20 Dec 2006
FOLLOWUP
i have tested latest version of ffmpeg and working fine in a 32bits environment :
FFmpeg version SVN-r7322, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --enable-shared
libavutil version: 49.1.0
libavcodec version: 51.26.0
libavformat version: 51.6.0
built on Dec 16 2006 13:50:09, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
FFmpeg version SVN-r7322, Copyright (c) 2000-2006 Fabrice Bellard, et al.
configuration: --enable-shared
libavutil version: 49.1.0
libavcodec version: 51.26.0
libavformat version: 51.6.0
built on Dec 16 2006 13:50:09, gcc: 4.1.2 20061028 (prerelease) (Debian 4.1.1-19)
Linux debian 2.6.18-3-686 #1 SMP Mon Dec 4 16:41:14 UTC 2006 i686 GNU/Linux
Also i have tried with a kernel version 2.6.19-1 without problems ... so maybe the problems is the 64bits environment ...
Btw seems that you didn't compile ffmpeg with shared libraries ( --enable-shared ) try to build ffmpeg on this way first.
--
AngelCarpintero - 20 Dec 2006
FOLLOWUP
I didn't compile ffmpeg at all, just installed a RPM, then compiled motion.
root@conan:~ # uname -a
Linux conan 2.6.19.vasco.1 #2 SMP Wed Dec 6 18:16:27 WET 2006 x86_64 x86_64 x86_64 GNU/Linux
root@conan:~ # rpm -qa | grep -i ffmpeg
ffmpeg-devel-0.4.9-0.25.20061030.lvn6
gstreamer-ffmpeg-debuginfo-0.10.1-1.fc6.rf
ffmpeg-0.4.9-0.25.20061030.lvn6
gstreamer-ffmpeg-0.10.1-1.fc6.rf
By the way, no crashes at all this night... All went well.
I guess I'll have to build ffmpeg after all. I don't like very much the fact that ffmpeg don't have formal releases, normally I don't use betas or overnight builds on production servers (and this is a production machine). Is there a recommended ffmpeg version for this version of motion ?
thanks.
--
AntonioVasconcelos - 21 Dec 2006
FOLLOWUP
Reopen this question support if the problem remains.
--
AngelCarpintero - 24 Dec 2006
Answer