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

librespot only outputs version information in certain docker image distributions #1408

Open
neekz0r opened this issue Nov 29, 2024 · 9 comments
Labels

Comments

@neekz0r
Copy link

neekz0r commented Nov 29, 2024

Description

When running in docker, librespot does nothing except output version information.

Version

0.6.0

How to reproduce

Using a similar dockerfile as this, run librespotify:

FROM debian:latest

ENV LIBRESPOT_VERSION="0.6.0"
RUN apt update && \
    apt install -y wget vim pkg-config node-typescript build-essential libasound2-dev rustc curl cargo snapserver procps sox npm && \
    curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && \
    . "$HOME/.cargo/env" && \
    rustup update && \
    mkdir /build && \
    cargo install librespot --version ${LIBRESPOT_VERSION} 
    cp /root/.cargo/bin/librespot /usr/local/bin/

mkdir librespot-test
(add the above for docker)
docker build . -t librespot-test
docker run -it librespot-test

note I stripped down my docker file so as to not annoy developers, but have included the additional required libraries in case there is a conflict. Eg: snapserver, npm, etc.

Log

root@9b5378732238:/# echo "Test standard output"
Test standard output
root@9b5378732238:/# >&2 echo "Test standard error output"
Test standard error output
root@9b5378732238:/# librespot --name TestSpeaker --verbose
librespot 0.6.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2024-11-29, Build ID: 2wNYHH1X, Profile: release)
root@9b5378732238:/# librespot --cache /var/lib/snapserver --enable-oauth --oauth-port 0 --verbose
librespot 0.6.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2024-11-29, Build ID: 2wNYHH1X, Profile: release)
root@9b5378732238:/# echo "y u no work?"
y u no work?

Host (what you are running librespot on):

  • OS: Linux (w/ docker) Host: Ubuntu 22.04.4 LTS
  • Docker: Docker version 25.0.4, build 1a576c5
  • Platform: AMD64

Additional context

I'm not 100% sure what the deal is between various distributions, but python:3-alpine (~alpine version 3.20 as of time of writing) works as expected:


ARG LIBRESPOT_VERSION=0.6.0-r0
ARG SNAPCAST_VERSION=0.29.0-r0

RUN echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories \
  && echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories
RUN apk add --no-cache bash snapcast=${SNAPCAST_VERSION} librespot=${LIBRESPOT_VERSION}
RUN pip3 install python-mpd2 musicbrainzngs websocket-client

CMD snapserver

Courtesy of this comment

But this container based on alpine:latest (3.20.3 as of time of writing) exhibits the same behavior:

FROM alpine:latest

ENV LIBRESPOT_VERSION="0.6.0-r0"
ENV SNAPCAST_VERSION="0.29.0-r0"
RUN  echo "https://dl-cdn.alpinelinux.org/alpine/edge/testing/" >> /etc/apk/repositories && \
        echo "https://dl-cdn.alpinelinux.org/alpine/edge/community/" >> /etc/apk/repositories && \
        apk add --no-cache bash snapcast=${SNAPCAST_VERSION} librespot=${LIBRESPOT_VERSION} libid3tag mpd

Finally, I did do an strace on it, but nothing interesting really came up. I'd be more than happy to provide that if thought to be helpful.

Image Works
alpine:3.20.3
ubuntu:latest
debian:latest
python:3-alpine
@kingosticks
Copy link
Contributor

Can you tell if it's working, just not outputting anything, or hanging after the first print message ?

@kingosticks
Copy link
Contributor

And can you rule out the docker pid 1 issue?

@neekz0r
Copy link
Author

neekz0r commented Nov 30, 2024

Can you tell if it's working, just not outputting anything, or hanging after the first print message ?

It is not hanging, nor does it really appear to be outputting anything (other than version info, as above). Strace shows the write to console, and nothing else being written out. It doesn't appear to be opening any sockets anywhere. At the surface level, it appears that running librespot --version provides the exact same behavior as running librespot -n "blah" or librespot --cache /var/lib/snapserver --enable-oauth --oauth-port 0

When I go and run the working image and run strace librespot --cache /var/lib/snapserver --enable-oauth --oauth-port 0 I get expected output and expected writes. On the other images, I get

And can you rule out the docker pid 1 issue?

I am fairly certain that is not what is happening -- in the cases above, I am using bash as the init process, not librespotify or snapcast.

The strace is really small, only a few hundred lines so I've included it as an attachment to help.
strace-snapcast.txt

I've also ruled out any sort of memory exhaustion -- there is something like 25G available on the host system.

@kingosticks
Copy link
Contributor

To.me.that sounds like it is hanging if it's not progressing any further than printing version info. Try running it under gdb?

@neekz0r
Copy link
Author

neekz0r commented Nov 30, 2024

What I mean by it not "Hanging" is that it immediately exits and does not continue to process anything, to be clear. It happens super fast:

time librespot --cache /var/lib/snapserver --enable-oauth --oauth-port 0
librespot 0.6.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2024-11-01, Build ID: 1730497895, Profile: release)
real    0m 0.00s
user    0m 0.00s
sys     0m 0.00s

@kingosticks
Copy link
Contributor

What I mean by it not "Hanging" is that it immediately exits and does not continue to process anything, to be clear. It happens super fast:

time librespot --cache /var/lib/snapserver --enable-oauth --oauth-port 0
librespot 0.6.0 VERGEN_IDEMPOTENT_OUTPUT (Built on 2024-11-01, Build ID: 1730497895, Profile: release)
real    0m 0.00s
user    0m 0.00s
sys     0m 0.00s

Ahh I understand now. Thanks

@kingosticks
Copy link
Contributor

Have you tried a debug build?

@neekz0r
Copy link
Author

neekz0r commented Nov 30, 2024

No, just what is available through cargo; to be honest I was kinda expecting this to be some sort of problem exists between keyboard and chair, but I'm begging to think I actually found a bug or something. Hah.

Are you able to duplicate it on your side? That, to me, is the last unknown variable -- is it something to do with my docker host, perhaps? (Although what, I can not fathom!)

@kingosticks
Copy link
Contributor

I don't have docker on this laptop, I'm really not a fan.

You should be able to use cargo install --debug https://doc.rust-lang.org/cargo/commands/cargo-install.html

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

2 participants