snapcast just crashes with no reason

Created on 23 Feb 2020  路  7Comments  路  Source: badaix/snapcast

hi @badaix!
I'm maintaining a HomeAssistant Supervisor (hass.io) Addon-Repo with snapcast.
https://github.com/raph2i/hassio-addons/tree/master/snapserver

work in progress branch: https://github.com/raph2i/hassio-addons/tree/update_snapcast/snapserver

After the start it just stops with no further information.
I dont have any idea, why it does that. You can test it by running alpine linux and install snapcast via edge repository

sed -i -e 's/v[[:digit:]]\..*\//edge\//g' /etc/apk/repositories && apk add --no-cache snapcast

my config:

[stream]
stream = pipe:///share/snapfifo/librespot?name=SpotifyConnect&sampleformat=44100:16:2
stream = pipe:///share/snapfifo/mopidy?name=Mopidy&sampleformat=44100:16:2
buffer = 1000
codec = flac
send_to_muted = false
sampleformat = 48000:16:2
[http]
enabled = true
doc_root = 
[tcp]
enabled = true
[logging]
debug = true
[server]
threads = -1

log:

[15:56:07] INFO: Populating snapserver.conf...
[15:56:08] INFO: Starting SnapServer...
2020-02-23 15-56-08.723 [Info] (main) Adding stream: pipe:///share/snapfifo/librespot?name=SpotifyConnect&sampleformat=44100:16:2
2020-02-23 15-56-08.723 [Info] (main) Adding stream: pipe:///share/snapfifo/mopidy?name=Mopidy&sampleformat=44100:16:2
2020-02-23 15-56-08.723 [Notice] (init) Settings file: "/var/lib/snapserver/server.json"
[cmd] /run.sh exited 0

Most helpful comment

I don't know what changed since 0.15 regarding the -d option, but I can reproduce thie issue on my debian machine, I will investigate this.
The default location of server.json is in /var/lib/snapserver/ if the environment variable HOME is not set, otherwise it's $HOME/.config/snapserver/server.json.
I will make the location of the server.json file another option in server.conf in the next release.

All 7 comments

What version of snapserver are you using?
What is the content of your server.json?
When I start snapserver v0.18.1 with your configuration, I'm getting:

Error2020-02-23 18-43-58.783mainException: missing argument for --http.doc_root

This is a bug in the config reader. Please try to comment the doc_root:

[http]
enabled = true
#doc_root = 

Thanks for your quick answer! :)

What version of snapserver are you using?

v0.18.1

This is a bug in the config reader. Please try to comment the doc_root:

i've tested this, now the problem is getting, well, weird... see next quote:

What is the content of your server.json?

Even if i trim down the config to

[stream]
stream = pipe:///share/snapfifo/librespot?name=SpotifyConnect&sampleformat=44100:16:2
stream = pipe:///share/snapfifo/mopidy?name=Mopidy&sampleformat=44100:16:2

i now get

[22:11:19] INFO: Starting SnapServer...
2020-02-23 22-11-20 [Info] (main) Adding stream: pipe:///share/snapfifo/librespot?name=SpotifyConnect&sampleformat=44100:16:2
2020-02-23 22-11-20 [Info] (main) Adding stream: pipe:///share/snapfifo/mopidy?name=Mopidy&sampleformat=44100:16:2
2020-02-23 22-11-20 [Notice] (init) Settings file: "/var/lib/snapserver/server.json"
2020-02-23 22-11-20 [Error] (init) Error reading config: [json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal

and of course:

cat: can't open '/var/lib/snapcast/server.json': No such file or directory

this message is ok:

2020-02-23 22-11-20 [Error] (init) Error reading config: [json.exception.parse_error.101] parse error at 1: syntax error - unexpected end of input; expected '[', '{', or a literal

the snapserver should create a new server.json config file and not log this message the next time.

It seems to be related to the daemonize option. Do you need to run it with -d? Can you please try without -d?
Was this hassio addon working with a previous version of Snapserver?

It worked until 0.15 (before 0.16 and so on ;)) but...

NOICE! without '-d' it is really working. I thought i tested this...
Maybe i was in an unevitable wheel of wtf :dancer:

Okay. In Hass.io, we can only store persistent data in "/share/". Is it possible to make the server.json configurable as a parameter like the config?
Otherwise i would link /var/lib/snapserver symbolic to /share/snapserver at the creation of the docker-container. - But this is a new issue, right? :+1:

I don't know what changed since 0.15 regarding the -d option, but I can reproduce thie issue on my debian machine, I will investigate this.
The default location of server.json is in /var/lib/snapserver/ if the environment variable HOME is not set, otherwise it's $HOME/.config/snapserver/server.json.
I will make the location of the server.json file another option in server.conf in the next release.

I've checked again, and it seems to work also with -d option. It's just looking weird because the server logs as the current user some messages and then daemonizes: the server forks itself and is running as daemon in the background, while the original process exits.

data dir and pid file will be configurable in v0.19: 7376c7709ce3239af3c33aaca2c95481735d8f39

# General server settings #####################################################
#
[server]
# the pid file when running as daemon
#pidfile = /var/run/snapserver/pid

# directory where persistent data is stored (server.json)
# if empty, data dir will be
#  - "/var/lib/snapserver/" when running as daemon
#  - "$HOME/.config/snapserver/" when not running as daemon
#datadir = 
Was this page helpful?
0 / 5 - 0 ratings

Related issues

fallenicarus picture fallenicarus  路  3Comments

badaix picture badaix  路  3Comments

Daargajedan picture Daargajedan  路  7Comments

quantenschaum picture quantenschaum  路  7Comments

lealoureiro picture lealoureiro  路  4Comments