Closed 9000h closed 4 years ago
Hi @9000h ,
Perhaps it's my fault. Please, can you apply my last PR, recompile, and retry to execute? My last patch increases the funcionality of the LOG, so it will be more easy to debug.
In any case, the problem seems to be related to a write in a unkown socket. We need to found the root cause, but a simple check in the function writev()
can overcome the crash.
it did not help
[25/04 15:51:06.660 ADPT main]: pid 106, fd 15, packets 0, d/c errs 0/0, flags 3, pmt -1, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[25/04 15:51:06.660 ADPT main]: pid 96, fd 16, packets 4, d/c errs 0/0, flags 3, pmt -1, filter 2, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[25/04 15:51:06.660 DVB main]: clearing filter on PID 96 FD 16
[25/04 15:51:06.660 DVB main]: clearing filter on PID 106 FD 15
[25/04 15:51:06.660 DVB main]: clearing filter on PID 2816 FD 14
[25/04 15:51:06.660 DVB main]: clearing filter on PID 2815 FD 13
[25/04 15:51:06.660 DVB main]: clearing filter on PID 0 FD 12
[25/04 15:51:06.660 STRM main]: closed stream sid 0
[25/04 15:51:06.660 STRM main]: minisatip.c:1990 get_sid returns NULL for s_id = -1
[25/04 15:51:06.660 RTSP main]: Reply RTSP (sid -1) [192.168.178.151:36446] content_len:0, sock 8 (handle 9)
[25/04 15:51:06.660 LOCK main]: socketworks.c:544 Unlock disabled mutex 0x5555559a7dd8
[25/04 15:51:06.660 WORK main]: sockets_unlock: Changing socket 8 lock 0x5555559a7dd8 to NULL error -1 Success
[25/04 15:51:06.660 LOCK main]: socketworks.c:550 Unlock disabled mutex 0x555555972238
Thread 1 "minisatip" received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
120 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
(gdb) bt full
#0 __strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
No locals.
#1 0x00007ffff66f54d3 in _IO_vfprintf_internal (s=s@entry=0x7fffffffccd0, format=format@entry=0x5555555b30f0 "select_and_execute[%d]: %s on socket sock %d (sid %d) from %s:%d - type %s errno %d",
ap=ap@entry=0x7fffffffce78) at vfprintf.c:1643
len = <optimized out>
string_malloced = 0
string = 0x300000005 <error: Cannot access memory at address 0x300000005>
width = <optimized out>
signed_number = <optimized out>
is_short = 0
spec = 115 's'
ptr = <optimized out>
ptr = <optimized out>
outc = <optimized out>
step0_jumps = {0, 160, 64, 1664, 1576, 1464, 1360, 2216, 2912, 208, 2032, 1848, 1760, -768, -760, 3024, 3000, 3104, 2128, 3120, -304, -704, 384, 312, -80, -1256, 2624, -1344, -1344, 2536}
base = <optimized out>
pad = <optimized out>
offset = <optimized out>
offset = <optimized out>
step1_jumps = {0, 0, 0, 0, 0, 0, 0, 0, 0, 208, 2032, 1848, 1760, -768, -760, 3024, 3000, 3104, 2128, 3120, -304, -704, 384, 312, -80, -1256, 2624, -1344, -1344, 0}
args_value = <optimized out>
is_negative = <optimized out>
number = <optimized out>
use_outdigits = <optimized out>
step2_jumps = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2032, 1848, 1760, -768, -760, 3024, 3000, 3104, 2128, 3120, -304, -704, 384, 312, -80, -1256, 2624, -1344, -1344, 0}
alt = 0
left = 0
showsign = <optimized out>
group = 0
is_char = 0
step3a_jumps = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1936, 0, 0, 0, -760, 3024, 3000, 3104, 2128, 0, 0, 0, 0, 312, 0, 0, 0, 0, 0, 0}
the_arg = {pa_wchar = -12496 L'\xffffcf30', pa_int = -12496, pa_long_int = 140737488342832, pa_long_long_int = 140737488342832, pa_u_int = 4294954800, pa_u_long_int = 140737488342832,
pa_u_long_long_int = 140737488342832, pa_double = 6.9533558072176199e-310, pa_long_double = <invalid float value>, pa_string = 0x7fffffffcf30 "", pa_wstring = 0x7fffffffcf30 L"",
pa_pointer = 0x7fffffffcf30, pa_user = 0x7fffffffcf30}
space = <optimized out>
is_long_double = <optimized out>
is_long = <optimized out>
step3b_jumps = {0 <repeats 11 times>, 1760, 0, 0, -760, 3024, 3000, 3104, 2128, 3120, -304, -704, 384, 312, -80, -1256, 2624, 0, 0, 0}
step4_jumps = {0 <repeats 14 times>, -760, 3024, 3000, 3104, 2128, 3120, -304, -704, 384, 312, -80, -1256, 2624, 0, 0, 0}
prec = <optimized out>
_buffer = {__routine = 0x5555555b4f00, __arg = 0x3000000020, __canceltype = -12432, __prev = 0x7fffffffceb0}
_avail = <optimized out>
thousands_sep = 0x0
grouping = 0xffffffffffffffff <error: Cannot access memory at address 0xffffffffffffffff>
done = 105
f = <optimized out>
lead_str_end = 0x5555555b3103 "%d]: %s on socket sock %d (sid %d) from %s:%d - type %s errno %d"
end_of_spec = <optimized out>
work_buffer = "\340\310\377\377\377\177\000\000 \000\000\000\060\000\000\000\300\317\377\377\377\177\000\000\000\317\377\377\377\177\000\000P\312\377\377\377\177\000\000\377\377\377\377\000\000\000\000 }|UUU\000\000\020\tr\366\377\177\000\000\001\200\255\373\000\000\000\000 }|UUU\000\000 }|UUU\000\000\000\000\361T/Q1\230@\311\377\377\377\177\000\000@\311\377\377\377\177\000\000\317\a\000\000\000\000\000\000\bb[UUU\000\000\260\312\377\377\377\177\000\000\377\377\377\377\000\000\000\000\000~|UUU\000\000\020\tr\366\377\177\000\000\001\200\255\373\000\063\062\070\000\000\361T/Q1\230\220\311\377\377\377\177\000\000\220\311\377\377\377\177\000\000\307\000\000\000\000\000\000\000"...
workstart = <optimized out>
---Type <return> to continue, or q <return> to quit---
workend = <optimized out>
ap_save = {{gp_offset = 32, fp_offset = 48, overflow_arg_area = 0x7fffffffcf90, reg_save_area = 0x7fffffffced0}}
nspecs_done = 6
save_errno = 9
readonly_format = 0
__PRETTY_FUNCTION__ = "_IO_vfprintf_internal"
__result = <optimized out>
#2 0x00007ffff6720910 in _IO_vsnprintf (string=0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ", maxlen=<optimized out>,
format=0x5555555b30f0 "select_and_execute[%d]: %s on socket sock %d (sid %d) from %s:%d - type %s errno %d", args=0x7fffffffce78) at vsnprintf.c:114
sf = {f = {_sbf = {_f = {_flags = -72515583, _IO_read_ptr = 0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ",
_IO_read_end = 0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ",
_IO_read_base = 0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ",
_IO_write_base = 0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ",
_IO_write_ptr = 0x5555557c7e8b <output+139> "", _IO_write_end = 0x5555557c85cf <output+1999> "",
_IO_buf_base = 0x5555557c7e22 <output+34> "select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type ",
_IO_buf_end = 0x5555557c85cf <output+1999> "", _IO_save_base = 0x0, _IO_backup_base = 0x0, _IO_save_end = 0x0, _markers = 0x0, _chain = 0x0, _fileno = 48697, _flags2 = 128,
_old_offset = 140737488347984, _cur_column = 0, _vtable_offset = 0 '\000', _shortbuf = "", _lock = 0x0, _offset = 206158430256, _codecvt = 0x7fffffffce40, _wide_data = 0xffffffffffffffff,
_freeres_list = 0x0, _freeres_buf = 0x7ffff6a886a0 <_tmbuf>, __pad5 = 140737488342544, _mode = -1, _unused2 = "UU\000\000 }|UUU\000\000\267a[UUU\000"},
vtable = 0x7ffff6a7ffa0 <_IO_strn_jumps>}, _s = {_allocate_buffer = 0x0, _free_buffer = 0xf7ffb8c8}},
overflow_buf = "\000\000\000\000\000\000\000\000\000\000\361T/Q1\230\005\000\000\000\003\000\000\000P\232WUUU\000\000\063\000\000\000\000\000\000\000\006\000\000\000\000\000\000\000\224\002\000\000\000\000\000\000\277\231WUUU\000"}
ret = <optimized out>
#3 0x000055555557a08b in _log (file=0x5555555b24e2 "socketworks.c", line=929, level=8192, fmt=0x5555555b30f0 "select_and_execute[%d]: %s on socket sock %d (sid %d) from %s:%d - type %s errno %d")
at utils.c:751
arg = {{gp_offset = 48, fp_offset = 48, overflow_arg_area = 0x7fffffffcfb8, reg_save_area = 0x7fffffffced0}}
len = 34
len1 = 34
both = 0
idx = 0
times = 0
stid = " main\000\000T\254}\366\377\177\000\000\000\000\000\000\062\000\000\000\320\331\377\377\377\177\000\000\024\275\204\366\377\177\000\000\005\000\000\000\377\177\000\000n"
lname = 0x5555555b61b7 "SOCK"
output = {
"[25/04 15:51:06.660 SOCK main]: select_and_execute[11]: Bad file descriptor on socket sock -1 (sid -1) from 192.168.178.151:48697 - type \000-1\000,2816,106\000=NULL, apids=NULL, dpids=NULL x_pmt=NULL\000L, dpi"...,
"[25/04 15:51:06.660 LOCK main]: socketworks.c:550 Unlock disabled mutex 0x555555972238\000\061, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1\000\000ackets 0\000, unsend packets 0\000\065,2816,106, apids=NULL, dpids"...}
#4 0x0000555555565bb2 in select_and_execute (arg=0x0) at socketworks.c:925
err_str = 0x7ffff684c18a "Bad file descriptor"
types = {0x5555555b3073 "udp", 0x5555555b3077 "tcp", 0x5555555b307b "server", 0x5555555b3082 "http", 0x5555555b3087 "rtsp", 0x5555555b308c "dvr"}
ss = 0x555555972230
master = 0x555555972230
i = 11
rv = 2
rlen = -1
les = 9
es = 9
pos_len = 2000
buf = "\000EARDOWN\000rtsp://192.168.178.129/stream=1\000RTSP/1.0\000\000CSeq:\000\066\000\000User-Agent:\000LibVLC/3.0.9.2\000(LIVE555\000Streaming\000Media\000v2020.01.19)\000\000Session:\000\061\063\065\060\064\071\060\060\062\067\000\000\000\n\000npt=0.000-\000\000\000\n\000\071\066-48697\000\000\000\n\000\065\065\065\000Streaming\000Media\000v2"...
pos = 0x7fffffffda10 ""
err = 9
pf = {{fd = 5, events = 3, revents = 0}, {fd = 6, events = 3, revents = 0}, {fd = 3, events = 3, revents = 0}, {fd = 4, events = 3, revents = 0}, {fd = -1, events = 0, revents = 0}, {fd = -1,
---Type <return> to continue, or q <return> to quit---
events = 0, revents = 0}, {fd = -2, events = 3, revents = 0}, {fd = -1, events = 0, revents = 0}, {fd = 9, events = 3, revents = 1}, {fd = -1, events = 0, revents = 0}, {fd = 10, events = 3,
revents = 0}, {fd = 11, events = 3, revents = 1}, {fd = -1, events = 0, revents = 0}, {fd = -1, events = 0, revents = 0}, {fd = -1, events = 0, revents = 0}, {fd = 23, events = 3, revents = 0}, {
fd = -1, events = 0, revents = 0}, {fd = -1, events = 0, revents = 0}, {fd = 25, events = 3, revents = 0}, {fd = 26, events = 3, revents = 1}, {fd = -1, events = -1,
revents = -1} <repeats 280 times>}
lt = 62502
c_time = 62512
read_ok = 0
ra = "192.168.178.151", '\000' <repeats 34 times>
#5 0x00005555555614d6 in main (argc=16, argv=0x7fffffffe358) at minisatip.c:1890
sock_bw = 5
rv = 0
devices = 8
i = 19
log_it = 262144
sv = {sa = {sa_family = 2, sa_data = "\037\220", '\000' <repeats 11 times>}, sin = {sin_family = 2, sin_port = 36895, sin_addr = {s_addr = 0}, sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {
sin6_family = 2, sin6_port = 36895, sin6_flowinfo = 0, sin6_addr = {__in6_u = {__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0, 0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}},
sin6_scope_id = 0}}
(gdb)
Hi @9000h ,
More clear debug now... so please enable now the full log of modules socketworks and socket (-v socketworks,socket
). And if you don't see the cause, try adding "stream", "dvbapi" and "utils". What I see is that the RESPONSE that the server wants to send to the SAT>IP client (192.168.178.151:36446) fails... perhaps because the socket is closed, or by another cause. We need to identify this.
I had to revert back to "git reset --hard 107c400f1b6981b151cb4d05dfb268adfaa5f982"
I had to revert back to "git reset --hard 107c400"
Then it's my fault! This patch is from me. I'll take a look... however, it will be interesting if you can pass to me a full log. In the meeantime I suspect that the problem can be the check of the b[0]
. However, I can't imagine how this can create a crash, as the read implies the existence of the buffer. And I want to say that I'm using this patch for around three weeks without any crash.
In any case, I'll fix it. But please, share the full log. Regards.
this look suspicions to me as this could be out of bounds -1 https://github.com/catalinii/minisatip/blob/a69d763ddf599e27423366c5d4b1b2bd6890bc1b/src/adapter.c#L517
if I revert this commit only it did not crash https://github.com/catalinii/minisatip/commit/0a1910b59f1d6465aac850ad1770d6320e3e2c0a still testing
the issue seem to be
- if (ss->type == TYPE_RTCP || ss->sock == SOCK_TIMEOUT)
+ if (ss->sock == SOCK_TIMEOUT)
Can you try to reproduce with -v socket and upload the log?
You can also do in gdb:
catch syscall close when you see fd 5 or 6 do a bt And paste the stack trace here
Hi @catalinii ,
Only to have a more robust code I created this PR: #745 . In any case, now it's clear that the crash from @9000h is not related with this commit: https://github.com/catalinii/minisatip/commit/107c400f1b6981b151cb4d05dfb268adfaa5f982
Hi @9000h ,
this look suspicions to me as this could be out of bounds -1 https://github.com/catalinii/minisatip/blob/a69d763ddf599e27423366c5d4b1b2bd6890bc1b/src/adapter.c#L517
Even this is not related with your crash, thank you for pointing it! The code has an error. I'm fixed it in PR #746 .
not sure if this helps
TEARDOWN rtsp://192.168.178.129/stream=1 RTSP/1.0
CSeq: 6
User-Agent: LibVLC/3.0.9.2 (LIVE555 Streaming Media v2020.01.19)
Session: 1804289383
[27/04 15:04:27.066 main]: Updating sid 0 time to 110727, current time 110734
[27/04 15:04:27.067 main]: closing stream sid 0
[27/04 15:04:27.067 main]: Closing RTP sock 9 handle 8
[27/04 15:04:27.068 main]: stream.c:333 get_sid returns NULL for s_id = 0
[27/04 15:04:27.068 main]: close_stream_for_socket: start close_stream_for_socket for id 0 (nil)
[27/04 15:04:27.069 main]: sockets_del: sock 9 -> handle 8, sid 0, overflow bytes 0, allocated 0, used 0, unsend packets 0
[Switching to Thread 0x7ffff7fcb600 (LWP 11469)]
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=8) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=8) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:30.526 signal]: get_signal_new took 3482 ms for adapter 0 handle 10 (status: 31, ber: 0, strength:254, snr: 40, force scan 0)
[27/04 15:04:31.081 main]: sockets_del: sock 9 Last open socket is at index 12 current_handle 8
[27/04 15:04:31.082 main]: Destroying mutex 0x5555559508b8
[27/04 15:04:31.083 signal]: BW 803KB/s, Total BW: 5 MB, ns/read 1824, r: 41, w: 46 fw: 0, tt: 74 ms
[27/04 15:04:31.084 AD0]: Mutex 0x5555559a9c78 destroyed meanwhile
[27/04 15:04:31.085 main]: Destroying mutex 0x5555559a9c78
[27/04 15:04:31.085 main]: Closing RTCP sock 10 handle 9
[27/04 15:04:31.086 main]: sockets_del: sock 10 -> handle 9, sid 0, overflow bytes 0, allocated 0, used 0, unsend packets 0
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=9) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:31.087 AD0]: leak detected 1 0!!!
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=9) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:32.248 main]: sockets_del: sock 10 Last open socket is at index 12 current_handle 9
[27/04 15:04:32.248 main]: Destroying mutex 0x555555962578
[27/04 15:04:32.249 AD0]: sockets_lock: Changing socket 8 lock 0x5555559a9c78 to NULL error 1 Operation not permitted
[27/04 15:04:32.251 main]: sockets_del: sock 8 -> handle -2, sid 0, overflow bytes 0, allocated 0, used 0, unsend packets 0
[27/04 15:04:32.251 main]: sockets_del: sock 8 Last open socket is at index 12 current_handle -2
[27/04 15:04:32.252 AD0]: event on socket index 11 handle 11 type 5 spos 0 wpos 0 (poll fd: 11, events: 3, revents: 3)
[27/04 15:04:32.253 main]: Destroying mutex 0x55555593ebf8
[27/04 15:04:32.253 main]: adapter.c:840 get_sid returns NULL for s_id = 0
[27/04 15:04:32.254 main]: closed adapter 0 for sid 0 m:-1 sid_cnt:0, restart_needed 0
[27/04 15:04:32.255 main]: deleting pids on adapter 0, sid -1, pids=NULL
[27/04 15:04:32.255 main]: Dumping pids table for adapter 0, number of unknown pids: 15
[27/04 15:04:32.256 main]: pid 163, fd 16, packets 22208, d/c errs 0/2, flags 3, pmt 0, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.256 main]: pid 18, fd 14, packets 3934, d/c errs 0/1, flags 3, pmt -1, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.256 main]: pid 106, fd 18, packets 2418, d/c errs 0/1, flags 3, pmt 0, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.256 main]: pid 105, fd 17, packets 1820, d/c errs 0/2, flags 3, pmt -1, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.257 main]: pid 0, fd 12, packets 20, d/c errs 0/1, flags 3, pmt -1, filter 0, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.257 main]: pid 17, fd 13, packets 10, d/c errs 0/1, flags 3, pmt -1, filter 1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.257 main]: pid 44, fd 15, packets 19, d/c errs 0/1, flags 3, pmt 0, filter 2, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.257 main]: pid 54, fd 20, packets 19, d/c errs 0/1, flags 3, pmt -1, filter 3, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.258 main]: pid 55, fd 21, packets 19, d/c errs 0/1, flags 3, pmt -2, filter 4, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.258 main]: pid 57, fd 30, packets 19, d/c errs 0/1, flags 3, pmt -11, filter 13, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.258 main]: pid 56, fd 22, packets 19, d/c errs 0/1, flags 3, pmt -3, filter 5, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.258 main]: Dumping pids table for adapter 0, number of unknown pids: 15
[27/04 15:04:32.259 main]: pid 163, fd 16, packets 22208, d/c errs 0/2, flags 3, pmt 0, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.259 main]: pid 18, fd 14, packets 3934, d/c errs 0/1, flags 3, pmt -1, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.259 main]: pid 106, fd 18, packets 2418, d/c errs 0/1, flags 3, pmt 0, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.259 main]: pid 105, fd 17, packets 1820, d/c errs 0/2, flags 3, pmt -1, filter -1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.260 main]: pid 0, fd 12, packets 20, d/c errs 0/1, flags 3, pmt -1, filter 0, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.260 main]: pid 17, fd 13, packets 10, d/c errs 0/1, flags 3, pmt -1, filter 1, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.260 main]: pid 44, fd 15, packets 19, d/c errs 0/1, flags 3, pmt 0, filter 2, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.260 main]: pid 54, fd 20, packets 19, d/c errs 0/1, flags 3, pmt -1, filter 3, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.260 main]: pid 55, fd 21, packets 19, d/c errs 0/1, flags 3, pmt -2, filter 4, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.261 main]: pid 57, fd 30, packets 19, d/c errs 0/1, flags 3, pmt -11, filter 13, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.261 main]: pid 56, fd 22, packets 19, d/c errs 0/1, flags 3, pmt -3, filter 5, sock -1, sids: -1 -1 -1 -1 -1 -1 -1 -1
[27/04 15:04:32.261 AD0]: Read OK 72192 (rlen:72192/total:72192) bytes from 11 [s: 11 m: 11] -> 0x55555591b510 (buf: 0x55555591b510) - iteration 215 action 0x55555556c5bb
[27/04 15:04:32.262 main]: clearing filter on PID 56 FD 22
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=22) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=22) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:33.424 signal]: get_signal_new took 1177 ms for adapter 0 handle 10 (status: 31, ber: 0, strength:254, snr: 39, force scan 0)
[27/04 15:04:34.189 main]: clearing filter on PID 57 FD 30
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=30) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=30) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:35.484 main]: clearing filter on PID 55 FD 21
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=21) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=21) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:36.657 main]: clearing filter on PID 54 FD 20
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=20) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=20) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:37.847 main]: clearing filter on PID 44 FD 15
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=15) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=15) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:39.357 main]: clearing filter on PID 17 FD 13
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=13) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=13) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:40.715 main]: clearing filter on PID 0 FD 12
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=12) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=12) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:42.006 main]: clearing filter on PID 105 FD 17
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=17) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=17) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:43.266 main]: clearing filter on PID 106 FD 18
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=18) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=18) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:44.375 main]: clearing filter on PID 18 FD 14
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=14) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=14) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:45.429 main]: clearing filter on PID 163 FD 16
Thread 1 "minisatip" hit Catchpoint 1 (call to syscall close), 0x00007ffff7bc7447 in __close (fd=16) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
Thread 1 "minisatip" hit Catchpoint 1 (returned from syscall close), 0x00007ffff7bc7447 in __close (fd=16) at ../sysdeps/unix/sysv/linux/close.c:27
27 in ../sysdeps/unix/sysv/linux/close.c
(gdb) c
Continuing.
[27/04 15:04:46.567 AD0]: stream.c:1083 Locked 0x555555910fd8 after 14305 ms, previously locked at: adapter.c, line 845
[27/04 15:04:46.568 main]: closed stream sid 0
[27/04 15:04:46.568 main]: minisatip.c:1950 get_sid returns NULL for s_id = -1
[27/04 15:04:46.569 main]: Reply (handle 7) [192.168.178.151:46460] content_len:0, sock 7
[27/04 15:04:46.570 main]: MSG client << process :
RTSP/1.0 200 OK
Date: Mon, Apr 27 13:04:46 2020 GMT
CSeq: 6
Server: minisatip/1.0.3-a69d763
Session: 1804289383
[27/04 15:04:46.571 AD0]: event on socket index 11 handle 11 type 5 spos 0 wpos 0 (poll fd: 11, events: 3, revents: 11)
[27/04 15:04:46.571 main]: start writev handle 7, iiov 1, len 119
[27/04 15:04:46.572 AD0]: Read NOK -1 (rlen:0/total:72192) bytes from 11 [s: 11 m: 11] -> 0x55555591b510 (buf: 0x55555591b510) - iteration 216 action 0x55555556c5bb
[27/04 15:04:46.573 main]: writev returned 119 handle 7, iiov 1, len 119 (took 0 ms)
[27/04 15:04:46.573 main]: socketworks.c:544 Unlock disabled mutex 0x5555559a9c78
[27/04 15:04:46.574 main]: sockets_unlock: Changing socket 7 lock 0x5555559a9c78 to NULL error -1 Success
[27/04 15:04:46.574 main]: event on socket index 10 handle -1 type 6 spos 0 wpos 0 (poll fd: 9, events: 3, revents: 1)
[27/04 15:04:46.575 main]: Read NOK -1 (rlen:0/total:2000) bytes from -1 [s: 10 m: 10] -> 0x7fffffffda50 (buf: 0x7fffffffda50) - iteration 7 action 0x55555556d7de
[27/04 15:04:46.575 main]: socketworks.c:550 Unlock disabled mutex 0x555555962578
Thread 1 "minisatip" received signal SIGSEGV, Segmentation fault.
__strlen_sse2 () at ../sysdeps/x86_64/multiarch/../strlen.S:120
120 ../sysdeps/x86_64/multiarch/../strlen.S: No such file or directory.
(gdb) c
Continuing.
RECEIVED SIGNAL 11 - SP=0 IP=0
Obtained 10 stack frames.
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
?? ??:0
0x55555557930b : 0x555555579400 : 0x7ffff7bc8890 : 0x7ffff6749646 : 0x7ffff66f54d3 : 0x7ffff6720910 : 0x55555557a0d2 : 0x5555555658ae : 0x5555555611f2 : 0x7ffff66b9b97 : [Thread 0x7ffff1bec700 (LWP 13463) exited]
[Thread 0x7ffff7fcb600 (LWP 11469) exited]
[Inferior 1 (process 11469) exited with code 01]
(gdb)
Hi @9000h ,
Please, which SAT>IP client are you using? VLC? And minisatip is using the satipc module?
yes for the test it's VLC but also with VDR the crash will happen
yes for the test it's VLC but also with VDR the crash will happen
And the tuner? A local tuner or a SAT>IP server? Please, share the VLC URL too.
only local tuners in a mix gdb --args ./minisatip -H5:50 -D5 -o 192.168.178.129:2000 -Y 4:dvbt2,5:dvbt2,6:dvbc2,7:dvbc2 -u 0:4-984[-48],1:5-1020[-23],2:6-1056[-88],3:7-1092[-204] -m 0040caa2c79d -l general,http,adapter,stream,socketworks -v socket -f
why not revert the change particular in the first step
- if (ss->type == TYPE_RTCP || ss->sock == SOCK_TIMEOUT)
+ if (ss->sock == SOCK_TIMEOUT)
Hi @9000h ,
only local tuners in a mix
Then my patches aren't related to this crash, as they target mainly the satipc
module.
why not revert the change particular in the first step
- if (ss->type == TYPE_RTCP || ss->sock == SOCK_TIMEOUT) + if (ss->sock == SOCK_TIMEOUT)
Perhaps you're rigth and this is the cause of the crash, but we need to found the root cause. Personally I suggest to undo the other part of the patch...
- return (*rv > 0);
+ // 0 is totally acceptable for UDP
+ return (*rv >= 0);
}
and test it.
Hi @9000h ,
Any news about this crash?
it's defiantly this one
- if (ss->type == TYPE_RTCP || ss->sock == SOCK_TIMEOUT)
+ if (ss->sock == SOCK_TIMEOUT)
Hi @9000h ,
it's defiantly this one
- if (ss->type == TYPE_RTCP || ss->sock == SOCK_TIMEOUT) + if (ss->sock == SOCK_TIMEOUT)
Then, as I'm not sure if the assumption of @catalinii is true or not, try now this change:
In your crash log I see some errors related to strings. So, if the crash is inside this line, then the problem is with the printed parameters.
Please, try it!
I did try it already with latest git, still the same the RTCP socket got closed and the write to the closed socket triggers the crash.
Hi @9000h ,
Then that's my conclusion:
So, almost two different ways to solve this crash are possible:
I suspect that the initial idea from @catalinii is to not close the RTCP when read 0. However, then this specific case is required to be handle, as the current code closes it. However, I feel that is a good practice too to add the check for not writing in the RTCP socket if it's closed.
I hope @catalinii will fix this soon. Regards.
There are multiple problems here: 1) Why the rtcp socket is closed 2) Why a disabled socket is being processed (easy fixable) 3) Why it crashes in LOG
Can you try the latest commit ?
I did a quick test and it did not crash.
I think we still need to see why rtcp socket is closed
any idea how to track this down
break socketworks.c:650 if ss->type==6 print *ss
If ss->read is sockets_recv you can add break sockets_recv if ss->type==6 See when this method returns 0
hmm, the channels below have some broken ones after RTL If you zap with VLC it will happen (but with the latest git no crash)
#EXTINF:-1,Astra 19.2E RTL
rtsp://192.168.178.129:554/?src=1&freq=12188&sr=27500&pol=h&msys=dvbs&pids=0,17,18,44,163,105,106
#EXTINF:-1,Astra 19.2E Fashion 4K
rtsp://192.168.178.129/?src=1&freq=11111&sr=22000&fec=23&pol=h&msys=dvbs&pids=0,2815,2816,106
#EXTINF:-1,Astra 19.2E HGL teststream
http://192.168.178.129:8080/?src=1&freq=10714.00&pol=h&ro=0.35&msys=dvbs2&mtype=8psk&plts=off&sr=23500&fec=89&pids=0,17,18,20,32,33,36
#EXTINF:-1,Astra 19.2E Puls24 HD http
http://192.168.178.129:8080/?src=1&freq=11670.75&pol=h&msys=dvbs2&sr=22000&fec=23&pids=0,17,18,1279,1283,100
#EXTINF:-1,Astra 19.2E ORF1 HD http
http://192.168.178.129:8080/?src=1&freq=11302&pol=h&msys=dvbs2&sr=22000&fec=23&plts=on&ro=35&pids=0,107,1920,1921,1922,1925
#EXTINF:-1,Astra 19.2E ORF1 HD http satip
http://192.168.178.129:8080/?src=1&freq=11302&pol=h&msys=dvbs2&sr=22000&fec=23&plts=on&ro=35&pids=0,107,1920,1921,1922,1925
#EXTINF:-1,Astra 19.2E ORF1 HD rtsp
rtsp://192.168.178.129:554/?src=1&freq=11302&pol=h&msys=dvbs2&sr=22000&fec=23&plts=on&ro=35&pids=0,107,1920,1921,1922,1925
#EXTINF:-1,ServusTV_HD_Deutschland rtsp satip
[03/05 20:57:08.980 main]: MSG client >> process :
TEARDOWN rtsp://192.168.178.129/stream=1 RTSP/1.0
CSeq: 6
User-Agent: LibVLC/3.0.9.2 (LIVE555 Streaming Media v2020.01.19)
Session: 1804289383
[03/05 20:57:08.980 main]: Updating sid 0 time to 54546, current time 54546
[03/05 20:57:08.980 main]: closing stream sid 0
[03/05 20:57:08.980 main]: Closing RTP sock 9 handle 8
[03/05 20:57:08.987 main]: stream.c:333 get_sid returns NULL for s_id = 0
[03/05 20:57:08.987 main]: close_stream_for_socket: start close_stream_for_socket for id 0 (nil)
[03/05 20:57:08.987 main]: sockets_del: sock 9 -> handle 8, sid 0, overflow bytes 0, allocated 0, used 0, unsend packets 0
[03/05 20:57:08.987 main]: sockets_del: sock 9 Last open socket is at index 12 current_handle 8
[03/05 20:57:08.987 main]: Destroying mutex 0x5555559508b8
[03/05 20:57:08.987 main]: Destroying mutex 0x5555559a9dd8
[03/05 20:57:08.987 main]: Closing RTCP sock 10 handle 9
Thread 1 "minisatip" hit Breakpoint 1, sockets_del (sock=10)
at socketworks.c:650
650 if (ss->close)
(gdb) print *ss
$1 = {enabled = 1 '\001', mutex = {enabled = 1, mtx = pthread_mutex_t = {
Type = Recursive, Status = Acquired, possibly with no waiters,
Owner ID = 31694, Robust = No, Shared = No, Protocol = None},
state = 1, line = 644, tid = 140737353922048, lock_time = 54553,
create_time = 47906, file = 0x5555555b3cd1 "socketworks.c"},
is_enabled = 1 '\001', force_close = 0 '\000', sock = 9, nonblock = 0,
sa = {sa = {sa_family = 2,
sa_data = "\247=\300\250\262\227\000\000\000\000\000\000\000"}, sin = {
sin_family = 2, sin_port = 15783, sin_addr = {s_addr = 2545068224},
sin_zero = "\000\000\000\000\000\000\000"}, sin6 = {sin6_family = 2,
sin6_port = 15783, sin6_flowinfo = 2545068224, sin6_addr = {__in6_u = {
__u6_addr8 = '\000' <repeats 15 times>, __u6_addr16 = {0, 0, 0, 0,
0, 0, 0, 0}, __u6_addr32 = {0, 0, 0, 0}}}, sin6_scope_id = 0}},
action = 0x55555556d818 <rtcp_confirm>, close = 0x0, timeout = 0x0,
read = 0x555555563a5a <sockets_recv>, type = 6, sid = 0, rtime = 49906,
wtime = 0, buf = 0x7fffffffda40 "TEARDOWN", opaque = 0x0, opaque2 = 0x0,
opaque3 = 0x0, lbuf = 2000, rlen = 48, timeout_ms = 0, id = 10,
iteration = 3, err = 0, flags = 0, events = 3, last_poll = 54516,
tid = 140737353922048, lock = 0x0, sock_err = 0, pack = 0x0, prio_pack = {
len = 0, size = 0, buf = 0x0}, flush_enqued_data = 0, spos = 0,
wmax = 100, wpos = 0, overflow = 0, buf_alloc = 0, buf_used = 0,
master = -1}
(gdb)
This is an occurrence part of stream close. In the logs you've attached initially there is 'close on socket..'
Looking more to know why reading 0 closes the socket
read 0 is also happen on a normal close without any error.
For tcp yes. Udp does not have the concept of a connection. So writing 0 byteswill make the peerread 0 bytes
Hi @catalinii and @9000h ,
Please take note of this:
Why the rtcp socket is closed
The RTCP can be closed by some different reasons. For example, because the client doesn't use it. Because some firewall is blocking it. And for other different reasons. In any case, the streaming should continue without RTCP packets. So my suggestion is very simple: if the RTCP socket is closed, then the processing can continue without any modification... but no new RTCP sockets will be sended to the network. This will simplifies the code and make it easy to maintain it. A simple flag can be used for this objective. You agree with that?
Why a disabled socket is being processed (easy fixable)
That's an internal behaviour of the minisatip. Personally, it's quite complex to understand how it works. Perhaps @catalinii can provide a diagram or model about the organization of the threads/modules.
Why it crashes in LOG
I feel they are more bugs related to the LOG functionality. I detected some of them, and I'm fixed them (see my PR #744). But in this particular case I suspect that the problem is not in the log but in the stream threading management. When the RTCP socket is closed, something is changed but the loop over the socket activity doesn't perceive this change. Please @catalinii can you explain how you debug minisatip?
I hope it helps. Regards.
is this still work in progress or can we close here?