Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash with jack input and output.external #993

Open
Yamakaky opened this issue Oct 16, 2019 · 10 comments
Open

Crash with jack input and output.external #993

Yamakaky opened this issue Oct 16, 2019 · 10 comments
Labels

Comments

@Yamakaky
Copy link
Contributor

Yamakaky commented Oct 16, 2019

Describe the bug
When the following output.external restarts after a blank period, I get this crash:

2019/10/16 22:19:08 [clock.wallclock_bjack:2] Source r128(dot)voice failed while streaming: File "outputs/pipe_output.ml", line 123, characters 4-10: Assertion failed!
2019/10/16 22:19:08 [clock.wallclock_bjack:3] Raised at file "outputs/pipe_output.ml", line 123, characters 4-49
2019/10/16 22:19:08 [clock.wallclock_bjack:3] Called from file "tools/start_stop.ml", line 99, characters 6-16
2019/10/16 22:19:08 [clock.wallclock_bjack:3] Called from file "outputs/output.ml", line 164, characters 4-18
2019/10/16 22:19:08 [clock.wallclock_bjack:3] Called from file "clock.ml", line 160, characters 17-25
2019/10/16 22:19:08 [main:3] Shutdown started!

the output, with voice being a pipeline starting with a input.jack:

output.external(
    id = "r128.voice",
    flush = true,
    fallible = true,
    %wav(stereo, samplerate = 48000),
    "/r128.py voice",
    strip_blank(
        id = "r128.voice.strip_blank",
        start_blank = true,
        voice
    )
)

Note that the output was blank thus stopped when the problem occured.

To Reproduce
Will do this weekend if I find the time, as well as expand this issue with more debugging.

Expected behavior
Should not crash

Version details

  • OS: alpine latest
  • Version 1.4.0 (opam)
@smimram
Copy link
Member

smimram commented Oct 17, 2019

Could we also see the log just before the crash please?

@smimram smimram added the bug label Oct 17, 2019
@smimram smimram added this to the 1.5.0 milestone Oct 19, 2019
@Yamakaky
Copy link
Contributor Author

Nothing in particular, just my normal logs.

@Yamakaky
Copy link
Contributor Author

The failed assertion is this one: https://github.com/savonet/liquidsoap/blob/master/src/outputs/pipe_output.ml#L123. It happens when I unmute the input which comes into jack, so it seems to check out with the method name. Is there a way I could debug the two variables to check which one doesn't have the right value?

output_stop was modified recently to add the if condition, maybe the pipe is now not correctly closed? Could you check if the code seems correct?

I'm trying to find a short code which would trigger the problem...

@Yamakaky
Copy link
Contributor Author

Yamakaky commented Oct 19, 2019

After testing, I made some progress. My pipeline is simplified as such:

in = input.jack()
out = process(in)
output.external(strip_blank(in))
output.external(switch([{bool}, out])

The idea is that the first output is used to monitor the audio level of the input continuously, while the second monitors the audio stream including music and the input (only when broadcasting).
Setup: the input is silent and the second output is active. When sound comes from in, it crashes.

@smimram
Copy link
Member

smimram commented Oct 24, 2019

Could you try to simplify it further to a self-contained script without jack or complicated external program?

I have tried the following but cannot reproduce:

b = ref(false)
in = sine()
out = in
add_timeout(1., fun () -> begin b := true; (-1.) end)
output.external(fallible=true, %wav, "cat > /dev/null", in)
output.external(fallible=true, %wav, "cat > /dev/null", switch([({!b}, out)]))

@smimram
Copy link
Member

smimram commented Oct 24, 2019

Btw, it would be nice if you could tell which of the two variables is wrong. The easiest is to replace

assert (not (self#is_open) && encoder = None) ;

by

assert (not (self#is_open));
assert (encoder = None) ;

and see which line raises.

@Yamakaky
Copy link
Contributor Author

Yamakaky commented Dec 5, 2019

1 month later: I did that, apparently encoder = None.

@Yamakaky
Copy link
Contributor Author

Yamakaky commented Dec 5, 2019

Interesting: if I use the same input two times, I get the crash. Maybe a faulty shutdown condition?

@smimram
Copy link
Member

smimram commented Dec 6, 2019

Thanks. I think I begin to understand the issue, but I cannot reproduce so that I cannot fix the bug. Here is my current script:

b = ref(false)
add_timeout(1., fun () -> begin b := not !b; 1. end)

s = sine()

output.external(id="enc1", fallible=true, %wav, "cat > /dev/null", s)
output.external(id="enc2", fallible=true, %wav, "cat > /dev/null", switch(track_sensitive=false, [({!b}, s)]))
out(mksafe(s))

which should be relatively close to yours. Can you simplify your script so that you don't use jack nor an opaque "process" command? Or modify the above script so that it fails?

@mrdevis
Copy link

mrdevis commented May 11, 2021

any progress on using input.jack in 2.0??

@toots toots removed this from the 2.0.0 milestone Aug 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants