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

Streaming to Liquidsoap doesn't work anymore after some time #1403

Open
Charbacca opened this issue Nov 12, 2020 · 5 comments
Open

Streaming to Liquidsoap doesn't work anymore after some time #1403

Charbacca opened this issue Nov 12, 2020 · 5 comments
Labels

Comments

@Charbacca
Copy link

I am using Liquidsoap 1.4.3 (installed with OPAM) on my Ubuntu 18.04 webserver to receive a livestream and provide it to my Icecast2-Server. I am starting Liquidsoap as a service (systemd) and it works fine. The use case is, that I want to stream to my Icecast-Server stop the stream and do the same again (maybe two hours later). But after some time it doesn't work anymore and I don't get why it works at the beginning but after some time it stops working.

This is my Liquidsoap-Script:

#Log dir
set("log.file.path","/home/myuser/liquidsoap-daemon/script/myscript.log")

#Server settings
#IP address on which the harbor should listen.
set("harbor.bind_addr","0.0.0.0")
set("harbor.ssl.certificate","/etc/letsencrypt/live/example/fullchain.pem")
set("harbor.ssl.private_key","/etc/letsencrypt/live/example/privkey.pem")

#A live source
livedj = input.harbor.ssl(
	"mount",
	port=8080,
	user="source",
	password="hackme"
)

#fallback
radio = fallback(track_sensitive=false,[livedj])

#Stream it out
output.icecast(
	%mp3,
	host = "localhost",
	mount = "Stream1",
	user = "source",
	port = 8000,
	password = "hackme",
	name = "DemoStream",
	fallible=true,
	radio
)

Here is the log-file, where you can see that I have two times created successfull a connection. When I want to do the same a few hours later it will not work anymore. At first I thought it is related to the error "Failed to accept new client", but it is not. This just comes up every few minutes when no source connects to Liquidsoap and even after this error was in the logfile I was still able to connect:
log.txt

When I check the running services, the Liquidsoap-Service is shown as running normally:
myscript.liq-liquidsoap.service loaded active running myscript.liq Liquidsoap daemon

I am using Webcaster-Client to stream to my Liquidsoap and when I am trying to connect to Liquidsoap after some time, the console of the browser shows the following:
"WebSocket connection to URL failed: WebSocket is closed before the connection is established."

Can somebody help me with this issue? Why am I not able to connect to Liquidsoap again after some time?

@toots
Copy link
Member

toots commented Dec 2, 2020

This looks like a bug. I'll try to have a look at it soon.

@toots toots added this to the 1.4.4 milestone Dec 2, 2020
@toots
Copy link
Member

toots commented Feb 12, 2021

Hi! We've done some work on websocket in the latest master branch. Any chance you'd be able to test it there?

I might keep this ticket open for later as we're long overdue for a 1.4.4 release..

@smimram smimram modified the milestones: 1.4.4, 2.0.0 May 1, 2021
@toots toots removed this from the 2.0.0 milestone Aug 25, 2021
@codeurimpulsif
Copy link

I'm having the same issue with liquidsoap 2.1.4.

I use input.harbor.ssl but after some time I can't connect anymore.

Some clues I found maybe

A netstat (netstat -altupn | grep <harbor-port> | grep "CLOSE_WAIT") or ss (ss -tap state CLOSE-WAIT | grep "liquidsoap") command show me there is a lot of open connections (250 exactly) to the harbor port in CLOSE_WAIT state.

I can reproduce the issue by sending lot of connections (using nc -z <harbor-ip> <harbor-port>), after some time I can't connect anymore on harbor port and open connections in CLOSE_WAIT state are still here, never flushed.

Liquidsoap logs shows Failed to accept new client: SSL accept() error: error:00000000:lib(0):func(0):reason(0) each time I open a connection. Then it reach the limit with log message Failed to accept new client: Too many open files in accept().

@vitoyucepi
Copy link
Collaborator

Hi @codeurimpulsif,
This issue is a bit old. Would you mind creating a new report using the template?
I guess the issue may be related to OS or limits.

I can't reproduce your problem locally, but I have to clarify my setup.

settings.harbor.ssl.certificate.set("cert.pem")
settings.harbor.ssl.private_key.set("key.pem")

live = input.harbor.ssl("live", port=8000, password="hackme")
output.dummy(mksafe(live))

And I'm using curl to access the harbor. The certs are self-signed.
curl -k https://localhost:8000

Could you check if this setup will produce the same issue in your case?

@codeurimpulsif
Copy link

@vitoyucepi Hi, ok I will open another issue, but I can't reproduce with curl, only netcat seem to reproduce it (maybe because it only create a SYN/ACK without closing the connection?)

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

5 participants