#184: bug branch 0.5

Support forum for minisatip
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

hi try to compile with DVBCA
```
make DVBCA=yes
cc -ggdb -fPIC -c -o ca.o ca.c
In file included from ca.h:4:0,
from ca.c:65:
tables.h:51:10: error: conflicting types for crc32
uint32_t crc32(const uint8_t *data, int datalen);
^
In file included from /usr/include/libucsi/section.h:31:0,
from /usr/include/libucsi/mpeg/pmt_section.h:30,
from /usr/include/libdvben50221/en50221_app_ca.h:34,
from ca.c:48:
/usr/include/libucsi/crc32.h:43:24: note: previous definition of crc32 was here
static inline uint32_t crc32(uint32_t crc, uint8_t* buf, size_t len)
^
ca.c:134:5: error: conflicting types for dvbca_process_pmt
int dvbca_process_pmt(adapter *ad, void *arg)
^
In file included from ca.c:65:0:
ca.h:7:5: note: previous declaration of dvbca_process_pmt was here
int dvbca_process_pmt(uint8_t *b, adapter *ad);
^
ca.c: In function dvbca_init:
ca.c:523:27: warning: assignment from incompatible pointer type
dvbca.action[CA_DEL_PMT] = &dvbca_del_pmt;
^
ca.c:524:9: error: dvbapi undeclared (first use in this function)
ca_add(dvbapi);
^
ca.c:524:9: note: each undeclared identifier is reported only once for each function it appears in
Makefile:64: recipe for target ca.o failed
make: *** [ca.o] Error 1
```
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

and crash by try to access status.html
```
[30/10 12:23:47.3992721][main]: opened html//status.html fd 8 at 290f3000 - 11400 bytes
[30/10 12:23:47.3992721][main]: processing_file 290f3000 len 11400:
[30/10 12:23:47.3992727][main]: reply -> 7 (192.168.178.129:53884) CL:6261 :
HTTP/1.0 200 OK^M
Date: Fri, Oct 30 11:23:47 2015 GMT^M
CACHE-CONTROL: no-cache^M
Content-type: text/html^M
Server: minisatip/0.5.1^M
Content-Length: 6261^M
^M





Minisatip/0.5.1 on 192.168.178.129:8080

This page will refresh every 5 seconds.

handle 7, sid -1
[30/10 12:23:47.3992728][main]: minisatip.c:838 get_sid returns NULL for s_id = -1
[30/10 12:23:47.3992728][main]: Requested stream close -1 timeout -1 type -1
[30/10 12:23:47.3992728][main]: closing stream -1
[30/10 12:23:47.3992728][main]: stream.c:300 Mutex not enabled 0x639dc0
[30/10 12:23:47.3992729][main]: sockets_del: 4 Last open socket is at index 9 current_handle 7
[30/10 12:23:47.3992729][main]: utils.c:959 Unlock NULL mutex
[30/10 12:23:47.3992729][main]: Delete socket 4 done: sid -1
[30/10 12:23:48.3993698][main]: sockets_add: handle 7 (type 1) returning socket index 4 [192.168.178.129:53886] read: 0x4070d0
[30/10 12:23:48.3993698][main]: read HTTP from 7 sid: -1: GET /favicon.ico HTTP/1.1^M
Host: 192.168.178.129:8080^M
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0^M
Accept: image/png,image/*;q=0.8,*/*;q=0.5^M
Accept-Language: en-US,en;q=0.5^M
Accept-Encoding: gzip, deflate^M
Connection: keep-alive^M
^M

[30/10 12:23:48.3993698][main]: Could not open file html//favicon.ico
[30/10 12:23:48.3993698][main]: reply -> 7 (192.168.178.129:53886) CL:0 :
HTTP/1.0 404 Not Found^M
Date: Fri, Oct 30 11:23:48 2015 GMT^M
Public: OPTIONS, DESCRIBE, SETUP, PLAY, TEARDOWN^M
Server: minisatip/0.5.1^M
^M

[30/10 12:23:48.3993798][main]: sockets_del: 4 -> handle 7, sid -1
[30/10 12:23:48.3993798][main]: minisatip.c:838 get_sid returns NULL for s_id = -1
[30/10 12:23:48.3993798][main]: Requested stream close -1 timeout -1 type -1
[30/10 12:23:48.3993798][main]: closing stream -1
minisatip: ../nptl/pthread_mutex_lock.c:117: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0 failed.
[30/10 12:23:48.3993798][main]: RECEIVED SIGNAL 6 - SP=0 IP=0

[30/10 12:23:48.3993799][main]: Obtained 10 stack frames.

[30/10 12:23:48.3993799][main]: 0x419250 :
print_trace at /usr/src/satip/minisatip-0.5/utils.c:418
[30/10 12:23:48.3993808][main]: 0x419397 :
posix_signal_handler at /usr/src/satip/minisatip-0.5/utils.c:452 (discriminator 1)
[30/10 12:23:48.3993814][main]: 0x7f7128cc8d10 :
?? ??:0
[30/10 12:23:48.3993819][main]: 0x7f7128508267 :
?? ??:0
[30/10 12:23:48.3993824][main]: 0x7f7128509eca :
?? ??:0
[30/10 12:23:48.3993828][main]: 0x7f712850103d :
?? ??:0
[30/10 12:23:48.3993832][main]: 0x7f71285010f2 :
?? ??:0
[30/10 12:23:48.3993837][main]: 0x7f7128cc1efa :
?? ??:0
[30/10 12:23:48.3993843][main]: 0x41b3ff :
mutex_lock1 at /usr/src/satip/minisatip-0.5/utils.c:934
[30/10 12:23:48.3993850][main]: 0x40a9fd :
close_stream at /usr/src/satip/minisatip-0.5/stream.c:301
```
catalinii
Posts: 0
Joined: Wed Nov 18, 2015 5:41 am

Post by catalinii »

Hi,

can you try now ... ca compilation issue should be fixed.

Are you using additional CFLAGS ?

Thanks
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

no no additonal CFLAGS, compiles now fine
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

the http issue in gdb
```
[30/10 13:00:33.87403][main]: select_and_execute[4]: Close on socket 7 (sid:-1) from 192.168.178.133:51542 - type http errno 0
[30/10 13:00:33.87403][main]: sockets_del: 4 -> handle 7, sid -1
[30/10 13:00:33.87403][main]: minisatip.c:838 get_sid returns NULL for s_id = -1
[30/10 13:00:33.87403][main]: Requested stream close -1 timeout -1 type -1
[30/10 13:00:33.87403][main]: closing stream -1
[30/10 13:00:33.87403][main]: stream.c:300 Mutex not enabled 0x63d280
[30/10 13:00:33.87404][main]: sockets_del: 4 Last open socket is at index 9 current_handle 7
[30/10 13:00:33.87404][main]: utils.c:959 Unlock NULL mutex
[30/10 13:00:33.87404][main]: Delete socket 4 done: sid -1
[30/10 13:00:34.88102][main]: sockets_add: handle 7 (type 1) returning socket index 4 [192.168.178.133:51543] read: 0x407e0a
[30/10 13:00:34.88103][main]: read HTTP from 7 sid: -1: GET /favicon.ico HTTP/1.1
Host: 192.168.178.129:8080
User-Agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:41.0) Gecko/20100101 Firefox/41.0
Accept: image/png,image/*;q=0.8,*/*;q=0.5
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Connection: keep-alive


[30/10 13:00:34.88103][main]: Could not open file html//favicon.ico
[30/10 13:00:34.88103][main]: reply -> 7 (192.168.178.133:51543) CL:0 :
HTTP/1.0 404 Not Found
Date: Fri, Oct 30 12:00:34 2015 GMT
Public: OPTIONS, DESCRIBE, SETUP, PLAY, TEARDOWN
Server: minisatip/0.5.2


[30/10 13:00:34.88204][main]: sockets_del: 4 -> handle 7, sid -1
[30/10 13:00:34.88204][main]: minisatip.c:838 get_sid returns NULL for s_id = -1
[30/10 13:00:34.88205][main]: Requested stream close -1 timeout -1 type -1
[30/10 13:00:34.88205][main]: closing stream -1
minisatip: ../nptl/pthread_mutex_lock.c:117: __pthread_mutex_lock: Assertion `mutex->__data.__owner == 0 failed.
[New Thread 0x7fffdf7fe700 (LWP 7003)]
[New Thread 0x7ffff6da8700 (LWP 6993)]

Program received signal SIGABRT, Aborted.
0x00007ffff6dde267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
55 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory.
(gdb) thread apply all bt

Thread 3 (Thread 0x7ffff6da8700 (LWP 6993)):
#0 0x00007ffff6ea48dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007ffff75999d6 in en50221_tl_poll () from /usr/lib/libdvben50221.so
#2 0x0000000000420c78 in stackthread_func (arg=0x6380c0 ) at ca.c:229
#3 0x00007ffff7bc26aa in start_thread (arg=0x7ffff6da8700) at pthread_create.c:333
#4 0x00007ffff6eafeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 2 (Thread 0x7fffdf7fe700 (LWP 7003)):
#0 0x00007ffff6ea48dd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x0000000000408e4b in select_and_execute (arg=0x0) at socketworks.c:534
#2 0x00007ffff7bc26aa in start_thread (arg=0x7fffdf7fe700) at pthread_create.c:333
#3 0x00007ffff6eafeed in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109

Thread 1 (Thread 0x7ffff7fd2700 (LWP 6988)):
#0 0x00007ffff6dde267 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:55
#1 0x00007ffff6ddfeca in __GI_abort () at abort.c:89
#2 0x00007ffff6dd703d in __assert_fail_base (fmt=0x7ffff6f39028 %s%s%s:%u: %s%sAssertion `%s failed.
%n,
assertion=assertion@entry=0x7ffff7bce21c mutex->__data.__owner == 0, file=file@entry=0x7ffff7bce1e8 ../nptl/pthread_mutex_lock.c,
line=line@entry=117, function=function@entry=0x7ffff7bce320 __pthread_mutex_lock) at assert.c:92
#3 0x00007ffff6dd70f2 in __GI___assert_fail (assertion=assertion@entry=0x7ffff7bce21c mutex->__data.__owner == 0,
file=file@entry=0x7ffff7bce1e8 ../nptl/pthread_mutex_lock.c, line=line@entry=117,
function=function@entry=0x7ffff7bce320 __pthread_mutex_lock) at assert.c:101
#4 0x00007ffff7bc4efa in __GI___pthread_mutex_lock (mutex=) at ../nptl/pthread_mutex_lock.c:117
#5 0x000000000041c198 in mutex_lock1 (FILE=0x42a9d0 stream.c, line=300, mutex=0x63d280 ) at utils.c:934
#6 0x000000000040b737 in close_stream (i=-1) at stream.c:300
#7 0x00000000004056d1 in close_http (s=0x638a80 ) at minisatip.c:850
#8 0x00000000004089d8 in sockets_del (sock=4) at socketworks.c:467
#9 0x0000000000409ab8 in select_and_execute (arg=0x0) at socketworks.c:701
#10 0x00000000004068e8 in main (argc=6, argv=0x7fffffffe4b8) at minisatip.c:1090
(gdb)
```
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

as a quick shot I did catch it at:
minisatip.c:850 like this
if (s->sid != -1)
close_stream(s->sid);
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

another crash on start in gdb
```
Starting program: /usr/src/satip/minisatip/minisatip -g -l -l -o192.168.178.1:2000 -f
[Thread debugging using libthread_db enabled]
Using host libthread_db library /lib/x86_64-linux-gnu/libthread_db.so.1.

Program received signal SIGSEGV, Segmentation fault.
_IO_vsnprintf (
string=0xfffffffff77a39c0 , maxlen=,
format=0x7fffffffe2b0 minisatip version 0.5.2, compiled with s2api version: 050A, args=0x7fffffffe188) at vsnprintf.c:117
117 vsnprintf.c: No such file or directory.
(gdb)
(gdb) where
#0 _IO_vsnprintf (
string=0xfffffffff77a39c0 , maxlen=,
format=0x7fffffffe2b0 minisatip version 0.5.2, compiled with s2api version: 050A, args=0x7fffffffe188) at vsnprintf.c:117
#1 0x000000000041a86d in _log (level=0, file=0x427b01 minisatip.c,
line=122,
fmt=0x7fffffffe2b0 minisatip version 0.5.2, compiled with s2api version: 050A) at utils.c:596
#2 0x0000000000403477 in print_version (use_log=1) at minisatip.c:122
#3 0x000000000040641d in main (argc=6, argv=0x7fffffffe498)
at minisatip.c:1048
(gdb)
``
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

small issue with ca.c in todays commit
```
--- ca.c.orig 2015-11-09 09:56:52.768291201 +0100
+++ ca.c 2015-11-09 09:57:02.419122113 +0100
@@ -519,7 +519,7 @@
if (!c)
{
c = ca_devices[ad->id] = malloc1(sizeof(ca_device_t));
- if (c)
+ if (!c)
LOG_AND_RETURN(0, Could not allocate memory for CA device %d,
ad->id);
memset(c, 0, sizeof(ca_device_t));
```
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

some log cosmetics, would it be better to user the macros
dvb.c: perror(couldnt set DVR buffer size);
dvb.c: perror(FE_SET_PROPERTY TUNE failed);
socketworks.c: perror(select_and_execute: select() error);

```
[11/11 13:02:35.62750 AD0]: No enabled sockets for Thread ID 7f2425fcb700 name AD0 ... exiting
^Cselect_and_execute: select() error: Interrupted system call
[11/11 13:03:12.99297 main]: The main loop ended, run_loop = 0
```
9000h
Posts: 89
Joined: Tue May 12, 2015 1:49 pm

Post by 9000h »

there is a file tables.h.gch which needs to be removed from git 0.5
Post Reply