savonet / liquidsoap

Liquidsoap is a statically typed scripting general-purpose language with dedicated operators and backend for all thing media, streaming, file generation, automation, HTTP backend and more.
http://liquidsoap.info
GNU General Public License v2.0
1.4k stars 128 forks source link

Multiple dyanmically created input.http's with pass through encoding segmentation fault #1941

Closed Russsgithub closed 3 years ago

Russsgithub commented 3 years ago

Hello,

I don't know weather this is a bug or not ?

If i create an input.http source dynamically through a harbor call with this create code

    silence = silngle(path/to/aac/silence.m4a)

    safe_source = fallback(track sensitive=false,[playlist("path/to/playlisr/dir"), silence])

    toggle = interactive.bool("#{!switch_title}", true)

    s = switch(track_sensitive= false, [(toggle, input.http(timeout=20.,new_track_on_metadata=false, poll_delay=2.,max_buffer=!input_buffer,"#{stream_url}")),({true}, safe_source)])

    s = fallback(track_sensitive=false, [s, single('./silence/silence2.m4a')])

    ####Set the output destination and stream to icecast

    enc = %ffmpeg(format="adts", %audio.copy)

    s = output.icecast(icy_metadata="true", enc, fallible = false, host="#{!out_url}", port=8000, password="#{!out_pass}", mount="#{!out_mount}", s)

and send a few requests at it I eventually get segmentation fault (core dump) with no error.

Cpu is not pushed , memory is not full (swap file on which doesn't get used). All files in the chain are the same codec, and samplerate.

But all paths led to a seg fault at some point.

I tried increase / decrease input.http max buffer - which lengthen the time to crash (interesting), and increasing the amount of queue - which sped up the creation of the sources.

I would really appreciate some help getting this working. Thanks.

toots commented 3 years ago

Thanks for reporting this. Have you ever used gdb? You can retrieve a stack trace of the crash this way:

% gdb /path/to/liquidsoap
> r <options list>
.... crash
> thread apply all bt

Then send it here and we shall see what we can do..

Russsgithub commented 3 years ago

I shall try. Thanks

On 17 Sep 2021 14:50, Romain Beauxis @.***> wrote:

Thanks for reporting this. Have you ever used gdb? You can retrieve a stack trace of the crash this way:

% gdb /path/to/liquidsoap

r .... crash thread apply all bt

Then send it here and we shall see what we can do..

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/savonet/liquidsoap/issues/1941#issuecomment-921812642, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB627QLVBJR6WX4WWNEC53DUCNBRHANCNFSM5EEZMMVA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Russsgithub commented 3 years ago

@toots Here's the gdb backtrace dump.

Thread 17 "liquidsoap" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7fffb37fe700 (LWP 53289)]
0x0000555555ce693f in ocaml_avcodec_get_packet_pts (_packet=1) at avcodec_stubs.c:191
191       AVPacket *packet = Packet_val(_packet);
(gdb) thread apply all bt

Thread 31 (Thread 0x7fffa37fe700 (LWP 53324)):
#0  0x00007ffff587d3bf in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7fffa37fcff0, rem=rem@entry=0x7fffa37fcff0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007ffff5883047 in __GI___nanosleep (requested_time=requested_time@entry=0x7fffa37fcff0, remaining=remaining@entry=0x7fffa37fcff0) at nanosleep.c:27
#2  0x0000555555d0e632 in unix_sleep (duration=<optimized out>) at sleep.c:42
#3  0x0000555555c70833 in camlUnix__fun_2831 ()
#4  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#5  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#6  0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737122067472, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc00afac0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 29 (Thread 0x7fffa3fff700 (LWP 53319)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121764088, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc0007940) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 27 (Thread 0x7fffb0ff9700 (LWP 53314)):
#0  0x00007ffff587d3bf in __GI___clock_nanosleep (clock_id=clock_id@entry=0, flags=flags@entry=0, req=req@entry=0x7fffb0ff7ff0, rem=rem@entry=0x7fffb0ff7ff0) at ../sysdeps/unix/sysv/linux/clock_nanosleep.c:78
#1  0x00007ffff5883047 in __GI___nanosleep (requested_time=requested_time@entry=0x7fffb0ff7ff0, remaining=remaining@entry=0x7fffb0ff7ff0) at nanosleep.c:27
#2  0x0000555555d0e632 in unix_sleep (duration=<optimized out>) at sleep.c:42
#3  0x0000555555c70833 in camlUnix__fun_2831 ()
#4  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#5  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#6  0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737064101896, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc8008c80) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 25 (Thread 0x7fffb17fa700 (LWP 53309)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
--Type <RET> for more, q to quit, c to continue without paging--c
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737122094832, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc001d980) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 23 (Thread 0x7fffb1ffb700 (LWP 53304)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737122262024, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc0006140) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 21 (Thread 0x7fffb27fc700 (LWP 53299)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737122248656, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc40056c0) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 19 (Thread 0x7fffb2ffd700 (LWP 53294)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121904544, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffc00de3c0) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 17 (Thread 0x7fffb37fe700 (LWP 53289)):
#0  0x0000555555ce693f in ocaml_avcodec_get_packet_pts (_packet=1) at avcodec_stubs.c:191
#1  0x0000555555945313 in camlFfmpeg_decoder__f_1222 () at avcodec/avcodec.ml:67
#2  0x000055555592fc54 in camlFfmpeg_io__fun_3325 () at io/ffmpeg_io.ml:174
#3  0x0000555555b14922 in camlClock__fun_2255 () at clock.ml:299
#4  0x0000555555c79e98 in camlStdlib__list__fold_left_275 () at list.ml:121
#5  0x0000555555b1258c in camlClock__fun_2204 () at clock.ml:296
#6  0x0000555555b14643 in camlClock__loop_1139 () at clock.ml:266
#7  0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#8  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#9  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#10 0x0000555555d34a2c in caml_start_program ()
#11 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737065035120, arg=<optimized out>, arg@entry=1) at callback.c:111
#12 0x0000555555d08d60 in caml_thread_start (arg=0x7fffbc005540) at st_stubs.c:538
#13 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 15 (Thread 0x7fffb3fff700 (LWP 53284)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x5555561c9c98 <caml_master_lock+88>) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x5555561c9c40 <caml_master_lock>, cond=0x5555561c9c70 <caml_master_lock+48>) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x5555561c9c70 <caml_master_lock+48>, mutex=mutex@entry=0x5555561c9c40 <caml_master_lock>) at pthread_cond_wait.c:638
#3  0x0000555555d0859e in st_masterlock_acquire (m=0x5555561c9c40 <caml_master_lock>) at st_posix.h:137   
#4  0x0000555555d086ad in caml_thread_leave_blocking_section () at st_stubs.c:237
#5  0x0000555555d12cda in caml_leave_blocking_section () at signals.c:175
#6  0x0000555555d0e639 in unix_sleep (duration=<optimized out>) at sleep.c:47
#7  0x0000555555c70833 in camlUnix__fun_2831 ()
#8  0x0000555555b13627 in camlClock__sleep_449 () at clock.ml:43
#9  0x0000555555b145e7 in camlClock__loop_1139 () at clock.ml:245
#10 0x0000555555b1295d in camlClock__fun_2181 () at clock.ml:269
#11 0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#12 0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#13 0x0000555555d34a2c in caml_start_program ()
#14 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737122265872, arg=<optimized out>, arg@entry=1) at callback.c:111
#15 0x0000555555d08d60 in caml_thread_start (arg=0x7fffb8020f00) at st_stubs.c:538
#16 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#17 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 13 (Thread 0x7fffdcff9700 (LWP 53279)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffc0002b9c) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffc0002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffc0002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffc0002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121043000, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8006ac0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 12 (Thread 0x7fffdd7fa700 (LWP 53278)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffbc002b9c) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffbc002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffbc002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffbc002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121045568, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd80066e0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 11 (Thread 0x7fffddffb700 (LWP 53277)):
#0  0x00007ffff58b2aff in __GI___poll (fds=fds@entry=0x7fffc808a690, nfds=nfds@entry=25, timeout=timeout@entry=-1) at ../sysdeps/unix/sysv/linux/poll.c:29
#1  0x0000555555cfa3c1 in poll (__timeout=-1, __nfds=25, __fds=0x7fffc808a690) at /usr/include/x86_64-linux-gnu/bits/poll2.h:46
#2  caml_poll (_read=<optimized out>, _write=<optimized out>, _err=<optimized out>, _timeout=<optimized out>) at duppy_stubs.c:95
#3  0x0000555555c32c80 in camlDuppy__poll_125 () at src/duppy.ml:37
#4  0x0000555555c33dcc in camlDuppy__f_521 () at src/duppy.ml:208
#5  0x0000555555c339cd in camlDuppy__process_511 () at src/duppy.ml:229
#6  0x0000555555c34713 in camlDuppy__f_606 () at src/duppy.ml:326
#7  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#8  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#9  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#10 0x0000555555d34a2c in caml_start_program ()
#11 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121048056, arg=<optimized out>, arg@entry=1) at callback.c:111
#12 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8006300) at st_stubs.c:538
#13 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#14 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 10 (Thread 0x7fffde7fc700 (LWP 53276)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffc4002b98) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffc4002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffc4002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffc4002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121050528, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8005f20) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 9 (Thread 0x7fffdeffd700 (LWP 53275)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffd0002b98) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffd0002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffd0002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffd0002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121052944, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8005b40) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 8 (Thread 0x7fffdf7fe700 (LWP 53274)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffb4002b9c) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffb4002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffb4002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffb4002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121055320, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8005760) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 7 (Thread 0x7fffdffff700 (LWP 53273)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffb8002b9c) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffb8002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffb8002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffb8002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121057744, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8005380) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 6 (Thread 0x7fffe48b5700 (LWP 53272)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffcc002b98) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffcc002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffcc002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffcc002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121060128, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8004fa0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 5 (Thread 0x7fffe50b6700 (LWP 53271)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x7fffd4002b9c) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556216030, cond=0x7fffd4002b70) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x7fffd4002b70, mutex=mutex@entry=0x555556216030) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556216030, c=0x7fffd4002b70) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c34835 in camlDuppy__f_606 () at src/duppy.ml:341
#6  0x0000555555c344a4 in camlDuppy__queue_inner_2535 () at src/duppy.ml:357
#7  0x0000555555b47f67 in camlTutils__process_729 () at tools/tutils.ml:175
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121062472, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x7fffd8004bc0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 4 (Thread 0x7fffe58b7700 (LWP 53270)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555556215f78) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556215f20, cond=0x555556215f50) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x555556215f50, mutex=mutex@entry=0x555556215f20) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556215f20, c=0x555556215f50) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555b49268 in camlTutils__fun_2314 () at tools/tutils.ml:340
#6  0x0000555555b47904 in camlTutils__mutexify_105 () at tools/tutils.ml:90
#7  0x0000555555c3d558 in camlDtools__Dtools_impl__thread_892 () at src/dtools_impl.ml:497
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121066512, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x5555562239b0) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 3 (Thread 0x7fffe60b8700 (LWP 53269)):
#0  0x00007ffff58b512b in __GI___select (nfds=nfds@entry=0, readfds=readfds@entry=0x0, writefds=writefds@entry=0x0, exceptfds=exceptfds@entry=0x0, timeout=timeout@entry=0x7fffe60b7240) at ../sysdeps/unix/sysv/linux/select.c:41
#1  0x0000555555d081a1 in caml_thread_tick (arg=<optimized out>) at st_posix.h:388
#2  0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#3  0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 2 (Thread 0x7fffe68b9700 (LWP 53268)):
#0  futex_wait_cancelable (private=<optimized out>, expected=0, futex_word=0x555556214dac) at ../sysdeps/nptl/futex-internal.h:183
#1  __pthread_cond_wait_common (abstime=0x0, clockid=0, mutex=0x555556214d50, cond=0x555556214d80) at pthread_cond_wait.c:508
#2  __pthread_cond_wait (cond=cond@entry=0x555556214d80, mutex=mutex@entry=0x555556214d50) at pthread_cond_wait.c:638
#3  0x0000555555d096d3 in st_condvar_wait (m=0x555556214d50, c=0x555556214d80) at st_posix.h:290
#4  caml_condition_wait (wcond=<optimized out>, wmut=<optimized out>) at st_stubs.c:869
#5  0x0000555555c3e522 in camlDtools__Dtools_impl__fun_2762 () at src/dtools_impl.ml:734
#6  0x0000555555c3e31a in camlDtools__Dtools_impl__mutexify_1402 () at src/dtools_impl.ml:702
#7  0x0000555555c3e4bf in camlDtools__Dtools_impl__f_1422 () at src/dtools_impl.ml:730
#8  0x0000555555c6dba5 in camlThread__fun_314 () at thread.ml:41
#9  0x0000555555d34a2c in caml_start_program ()
#10 0x0000555555d29d61 in caml_callback_exn (closure=closure@entry=140737121066760, arg=<optimized out>, arg@entry=1) at callback.c:111
#11 0x0000555555d08d60 in caml_thread_start (arg=0x555556346810) at st_stubs.c:538
#12 0x00007ffff59b9609 in start_thread (arg=<optimized out>) at pthread_create.c:477
#13 0x00007ffff58bf293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95

Thread 1 (Thread 0x7fffea3f6340 (LWP 53265)):
#0  0x00007ffff57e4322 in __GI___sigtimedwait (set=set@entry=0x7fffffffdb00, info=info@entry=0x7fffffffda40, timeout=timeout@entry=0x0) at ../sysdeps/unix/sysv/linux/sigtimedwait.c:29
#1  0x00007ffff59c4f6c in __sigwait (set=set@entry=0x7fffffffdb00, sig=sig@entry=0x7fffffffdafc) at ../sysdeps/unix/sysv/linux/sigwait.c:28
#2  0x0000555555d0895e in caml_wait_signal (sigs=<optimized out>) at st_posix.h:474
#3  0x0000555555c3d288 in camlDtools__Dtools_impl__wait_signal_789 () at src/dtools_impl.ml:471
#4  0x0000555555c3d431 in camlDtools__Dtools_impl__main_885 () at src/dtools_impl.ml:507
#5  0x0000555555c3d68a in camlDtools__Dtools_impl__catch_900 () at src/dtools_impl.ml:512
#6  0x000055555590398f in camlMain__fun_2296 () at main.ml:558
#7  0x0000555555c3d18b in camlDtools__Dtools_impl__exec_786 () at src/dtools_impl.ml:455
#8  0x0000555555c79de1 in camlStdlib__list__iter_261 () at list.ml:110
#9  0x0000555555c3d1c8 in camlDtools__Dtools_impl__exec_786 () at src/dtools_impl.ml:458
#10 0x0000555555c79de1 in camlStdlib__list__iter_261 () at list.ml:110
#11 0x0000555555c3d1c8 in camlDtools__Dtools_impl__exec_786 () at src/dtools_impl.ml:458
#12 0x0000555555901b43 in camlRunner__entry () at main.ml:566
#13 0x00005555558fade9 in caml_program ()
#14 0x0000555555d34a2c in caml_start_program ()
#15 0x0000555555d119e4 in caml_startup_common (argv=0x7fffffffdec8, pooling=<optimized out>, pooling@entry=0) at startup_nat.c:158
#16 0x0000555555d11a2f in caml_startup_exn (argv=<optimized out>) at startup_nat.c:168
#17 caml_startup (argv=<optimized out>) at startup_nat.c:168
#18 0x00005555558f90e2 in main (argc=<optimized out>, argv=<optimized out>) at main.c:41

Thanks

toots commented 3 years ago

Hi,

I'm gonna try to reproduce this one locally. Any chance you could work out a minimal reproduction script? Try removing the playlist or even the single. Also, would appreciate a test url. Feel free to send in private if needed.

Thanks!

Russsgithub commented 3 years ago

Yes, of course. I'll need a little time to strip it down and make it work.

Thanks

On 19 Sep 2021 17:49, Romain Beauxis @.***> wrote:

Hi,

I'm gonna try to reproduce this one locally. Any chance you could work out a minimal reproduction script? Try removing the playlist or even the single. Also, would appreciate a test url. Feel free to send in private if needed.

Thanks!

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/savonet/liquidsoap/issues/1941#issuecomment-922503367, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB627QIKYMDWMIJ2E3BTWO3UCYIDLANCNFSM5EEZMMVA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

Russsgithub commented 3 years ago

@toots Hello, This script takes about 2 mins to hit the seg fault on my machine.

As in the comments you can use https://radio.millicent.org as the input source.

#### encode defaults to true
#### switch title defaults to out_url + out_mount
####

### {
###    "encode": "false", -defaults to true , i.e. to encode the output
###    "in_url":"https://radio.millicent.org",
###    "in_mount": "",
###    "switch_title": "", - MUST BE UNIQUE
###    "in_pass":"",
###    "out_url":"",  --- SET URL OF OUTPUT (ICECAST)
###    "out_mount": "", --- defaults to in_mount + "_egress" or switich_title + "_egress" if in_mount = ""
###    "out_user": "source",
###    "out_port": "", - defaults tp 8000
###    "out_pass": "" - out going icecast mount password if needed
###  }

#set("log.level",5)

settings.init.force_start.set(true)

settings.scheduler.fast_queues.set(3)
settings.scheduler.generic_queues.set(3)
settings.scheduler.non_blocking_queues.set(3)

interactive.harbor()

### initialize some refs
sources = ref([])

######
#######
######## Function to add new input stream pulled from an http audio stream with a switch available at HOST:8000/interactive through a web browser
def play(~protocol,~data,~headers,uri)

  safe_source = single('./silence/silence.m4a')
  ####convert json to an associated list (key, value)
  d = json.parse(default=[("","")], data)

  #### Assign json value to variable used to streams
  encode = ref(d['encode'])
  switch_title = ref(d['switch_title'])
  in_url = ref(d['in_url'])
  out_url = ref(d['out_url'])
  in_mount = ref(d['in_mount'])
  out_mount = ref(d['out_mount'])
  in_pass = ref(d['in_pass'])
  out_pass =ref( d['out_pass'])
  out_port = ref(int_of_string(d['out_port']))
  in_user = ref(d['in_user'])
  out_user = ref(d['out_user'])

  ### Responce text
  res = json()

  ##### set defaults
  if !out_port == 0 then
    out_port := int_of_string("8000")
  end
  if !in_user == "" then
    in_user := "source"
  end
  if !out_user == "" then
    out_user := "source"
  end
  if !in_pass == "" then
    in_pass := "hackme"
  end
  if !out_pass == "" then
    out_pass := "hackme"
  end
  if !switch_title == "" then
    switch_title := !out_url ^ "-" ^ !out_mount
  end
  if !out_mount == "" then
    if !in_mount != "" then
      out_mount := !in_mount ^ "_egress"
    else
      out_mount := !switch_title ^ "_egress"
    end
  end
  if !encode == "" then
    encode := "true"
  end

  x = (!out_url, !out_mount)

  code = ref(0)

  stream_url = !in_url ^ "/" ^ !in_mount

  print(stream_url)

  toggle = interactive.bool("#{!switch_title}", true)

  s = switch(track_sensitive= false, [(toggle, input.http(timeout=20.,new_track_on_metadata=false, poll_delay=2.,max_buffer=5.,"#{stream_url}")),({true}, safe_source)])

  s = output.icecast(icy_metadata="true", (bool_of_string(!encode)? %ffmpeg(format="adts", %audio(codec="aac",samplerate=48000,b="320k")):%ffmpeg(format="adts", %audio.copy)), fallible = false, host="#{!out_url}", port=8000, password="#{!out_pass}", mount="#{!out_mount}", clock(s))

  ### Create responce to POST and add new source to sources list if it dosn't already exist

  sources := list.add((x, (s, safe_source, toggle)), !sources)

  res.add("msg", "New Stream Connected")
  res.add("url", !out_url)
  res.add("mount", ":" ^ string_of(!out_port) ^ "/" ^ !out_mount)
  res.add("switch_location", "localhost:7000/interactive")
  res.add("switch_name",  !switch_title)
  code := 200

  res = json.stringify(res)
  # Return response
  http.response(
   protocol=protocol,
   code=!code,
   headers=[("Content-Type","application/json; charset=utf-8")],
   data=res
  )
end

def stop(~protocol,~data,~headers,uri)

  ####convert json to an associated list (key, value)
  d = json.parse(default=[("","")], data)

  #### Assign json value to variable used to shut the stream down
  url = d['url']
  mount = d['mount']

  ### Create a tuple of listener facing url and mount point (if pressent) for logging purposes
  x = (url, mount)

  ### Get the source related to the url and mount point
  let (s, f, sw) = list.assoc(x, !sources)

  ### Remove the source and the switch from their respective lists
  sources := list.assoc.remove(x, !sources)

  ### Shut down the source
  s.shutdown()

  f.shutdown()

  ### Remove the switch
  sw.remove()

  res = json()
  res.add("msg", "#{url} - #{mount} is no longer connected")

  res = json.stringify(res)
  # Return response
  http.response(
   protocol=protocol,
   code=200,
   headers=[("Content-Type","application/json; charset=utf-8")],
   data=res
  )
end

# Register handler on port 7000
harbor.http.register(port=7000,method="POST","/start", play)
harbor.http.register(port=7000,method="POST","/stop", stop)

I have left the single(silence.m4a) so the switch has something to fall to - this is an aac encoded file. I had issues with short files, mine is 15s long.

I have been using these python3 scripts to populate and depopulate the sources

import requests
import json

amount = 10

for i in range(1, amount):
    #time.sleep(0.5)
    url = "http://localhost:7000/start"
    data = {
          "encode": "true",
          "in_url":"https://radio.millicent.org",
          "in_mount": "",
          "switch_title": "test" + str(i),
          "in_pass":"",
          "out_url":"localhost",
          "out_mount": "",
          "out_user": "source",
          "out_port": "",
          "out_pass": ""
        }

    d = json.dumps(data)

    res = requests.post(url, data = d)
    print(str(i), res)
import requests
import json

amount = 10

for i in range(1, amount):
    #time.sleep(0.5)
    url = "http://localhost:7000/stop"
    data = {
          "url":"localhost",
          "out_mount": "test" + str(i),
        }

    d = json.dumps(data)

    res = requests.post(url, data = d)
    print(str(i), res)

I think it all works apart from the seg fault, let me know if you have other problems with the script.

Thanks

toots commented 3 years ago

What branch are you using to run the script?

Russsgithub commented 3 years ago

Sorry, I forgot about that .. source-any is the branch I have install to get the encoder conditional working.

On 20 Sep 2021 13:13, Romain Beauxis @.***> wrote:

What branch are you using to run the script?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/savonet/liquidsoap/issues/1941#issuecomment-922872801, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AB627QOV4AZ23MLOFXGKNXTUC4QOTANCNFSM5EEZMMVA. Triage notifications on the go with GitHub Mobile for iOShttps://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675 or Androidhttps://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub.

toots commented 3 years ago

Thanks for the great report and the reproduction script! I think I was able to fix it. All you should have to do is compile against the latest ocaml-ffmpeg now. Would you mind confirming that it is indeed fixed on your end? Thanks!

Russsgithub commented 3 years ago

I think I just updated ocaml-ffmpeg code but forgot to recompile against it. Ooooops.

Testing now, but seems OK. Will confirm in a little while , once I'm reasonably certain .

Thanks

Russsgithub commented 3 years ago

Up for 13 mins with no seg faults.

Great, thanks.