Motion - Bug Report 2005x 01x 10x 095715

BUG: Crash when using a netcam configuration

The configuration is working with motion version 3.1.17 but the crash occurs in the version 3.1.18.
The behaviour of motion is a little bit strange: if a set a breakpoint of netcam_connect I can see the the thread 0 is created but just after a second thread is created and causes a crash.
Can you reproduce the problem? If not I need some support to investigate this problem. In the testcase there is an output of GDB.

Test case

(gdb) b netcam_connect
Breakpoint 1 at 0x8055c28: file netcam.c, line 342.
(gdb) r
Starting program: /home/sfri/UNISON/MOTION/HTTPTEST/motion-3.1.18/motion
[Thread debugging using libthread_db enabled]
[New Thread 16384 (LWP 4758)]
Processing thread 0 - config file /home/sfri/.motion/motion.conf
Thread0 device: http://localhost/motion.jpg input: -1
[New Thread 32769 (LWP 4759)]
[New Thread 16386 (LWP 4760)]
Netcam: thread 0: starting...
[Switching to Thread 16386 (LWP 4760)]

Breakpoint 1, netcam_connect (netcam=0x8063930) at netcam.c:342
warning: Source file is more recent than executable.

342             sock = socket(PF_INET, SOCK_STREAM, 0);
(gdb) bt
#0  netcam_connect (netcam=0x8063930) at netcam.c:342
#1  0x08056929 in netcam_start (cnt=0x8060a40) at netcam.c:671
#2  0x08050291 in vid_start (cnt=0x8060a40) at video.c:568
#3  0x0804ae8f in motion_loop (arg=0x8060a40) at motion.c:355
#4  0x40049e51 in pthread_start_thread () from /lib/libpthread.so.0
#5  0x40049ecf in pthread_start_thread_event () from /lib/libpthread.so.0
#6  0x401db6ea in clone () from /lib/libc.so.6
(gdb) c
Continuing.
Netcam: jpeg file

Breakpoint 1, netcam_connect (netcam=0x8063930) at netcam.c:342
342             sock = socket(PF_INET, SOCK_STREAM, 0);
(gdb) bt
#0  netcam_connect (netcam=0x8063930) at netcam.c:342
#1  0x08056494 in netcam_single_read (netcam=0x8063930) at netcam.c:556
#2  0x0805697d in netcam_start (cnt=0x8060a40) at netcam.c:679
#3  0x08050291 in vid_start (cnt=0x8060a40) at video.c:568
#4  0x0804ae8f in motion_loop (arg=0x8060a40) at motion.c:355
#5  0x40049e51 in pthread_start_thread () from /lib/libpthread.so.0
#6  0x40049ecf in pthread_start_thread_event () from /lib/libpthread.so.0
#7  0x401db6ea in clone () from /lib/libc.so.6
(gdb) c
Continuing.
[New Thread 32771 (LWP 4763)]
Netcam: thread 0: thread PID: 4763
[Switching to Thread 32771 (LWP 4763)]

Breakpoint 1, netcam_connect (netcam=0x8063930) at netcam.c:342
342             sock = socket(PF_INET, SOCK_STREAM, 0);
(gdb) bt
#0  netcam_connect (netcam=0x8063930) at netcam.c:342
#1  0x08056494 in netcam_single_read (netcam=0x8063930) at netcam.c:556
#2  0x080559aa in netcam_loop (arg=0x8060a40) at netcam.c:254
#3  0x40049e51 in pthread_start_thread () from /lib/libpthread.so.0
#4  0x40049ecf in pthread_start_thread_event () from /lib/libpthread.so.0
#5  0x401db6ea in clone () from /lib/libc.so.6
(gdb) c
Continuing.

Program received signal SIGSEGV, Segmentation fault.
0x401d9814 in tsearch () from /lib/libc.so.6
(gdb) bt
#0  0x401d9814 in tsearch () from /lib/libc.so.6
#1  0x401eb10d in __nss_lookup_function () from /lib/libc.so.6
#2  0x401eaf43 in __nss_next () from /lib/libc.so.6
#3  0x401eea1f in gethostbyname_r () from /lib/libc.so.6
#4  0x401ee366 in gethostbyname () from /lib/libc.so.6
#5  0x08055ca2 in netcam_connect (netcam=0x8063930) at netcam.c:350
#6  0x08056494 in netcam_single_read (netcam=0x8063930) at netcam.c:556
#7  0x080559aa in netcam_loop (arg=0x8060a40) at netcam.c:254
#8  0x40049e51 in pthread_start_thread () from /lib/libpthread.so.0
#9  0x40049ecf in pthread_start_thread_event () from /lib/libpthread.so.0
#10 0x401db6ea in clone () from /lib/libc.so.6
(gdb)

Environment

Motion version: 3.1.18snap9
Shared libraries: curl, xmlrpc, ffmpeg, mysql, postgresql
Server OS: Debian SID

-- SebastienFricker - 10 Jan 2005

Follow up

First , curl is not needed with snap9 because StreamingNetcamWithoutCurl replaces it. What is your network camera ? ( strange that is pointing to localhost wink unless you are trying to emulate it).

Moreover the current patch needs to specify netcam_url and netcam_userpass.

A new patch is comming with many bug fixed.

-- AngelCarpintero - 10 Jan 2005

NetCam config

In fact I does not use a netcam. I simulate a netcam using apache.

netcam_url is set to http://localhost/motion.jpg and netcam_userpass is correctly set to the htuser/htpassword.

How can I disable curl? Is this parameter in the motion.conf file or does I need to enter a special option for ./configure command?

Follow up

You don't need to do anything with curl , motion just doesn't need it anymore and configure doesn't check for it.

I was not able to reproduce your problem setting apache/static image
 
netcam_url http://localhost/motion.jpg
netcam_userpass motion:motion

where motion:motion are htuser/htpassword .

Investigation

I will investigate on it, I think that the problem is caused by the second thread which should not be created.

Sebastien: sorry but I was not able to find the problem. The only think I could see is that the stack was corrupted.

-- AngelCarpintero - 10 Jan 2005

Fix record

Fixed with netcam-pre2 patch . Please reopen the bug if the problem remains.

-- AngelCarpintero - 14 Jan 2005
Topic revision: r10 - 30 Jan 2005, KennethLavrsen
Copyright © 1999-2024 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Please do not email Kenneth for support questions (read why). Use the Support Requests page or join the Mailing List.
This website only use harmless session cookies. See Cookie Policy for details. By using this website you accept the use of these cookies.