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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpv not starting on arm/raspberrypi #265

Closed
sentriz opened this issue Dec 4, 2022 · 3 comments
Closed

mpv not starting on arm/raspberrypi #265

sentriz opened this issue Dec 4, 2022 · 3 comments
Labels

Comments

@sentriz
Copy link
Owner

sentriz commented Dec 4, 2022

from #211 (comment)

@marlop352 馃憢

@lucat1
Copy link

lucat1 commented Dec 8, 2022

I'm not too familiar with the codebase but differentiating these two error messages here would help follow the "stack trace" a bit further:

gonic/server/server.go

Lines 367 to 370 in 6c8f6b3

return fmt.Errorf("start jukebox: %w", err)
}
if err := s.jukebox.Wait(); err != nil {
return fmt.Errorf("start jukebox: %w", err)

Still, reading the error further it is clear the culprit (on the go side of things) is here:

return fmt.Errorf("open connection: %w", err)

Because it reaches past the timeout of 5s for the open of the mpv socket we have to guess it has started.
Here I believe is the issue. The socket file is not actually created by mpv itself but it is being created here:

sockFile, err = os.CreateTemp("", "gonic-jukebox-*.sock")

and it never gets deleted. Therefore the os.Stat in the startup check will always report true. It may work on your machine because of its speed but it appears to fail on a Pi.

Now, if this is the case (even if it's not the thing causing the issue, I believe the current implementation is not doing what it's supposed to) the quickest fix would be to just delete the file after we obtain a path. The more elegant solution would be to find a function which only generates the path without creating the actual file, but with my limited search in the standard library I couldn't find anything suitable.

@lucat1
Copy link

lucat1 commented Dec 8, 2022

I've done some local testing (not on a Pi) and it seems to be as I had thought. If the tmp file is not deleted it the checker assumes a socket has been opened (because it only does a stat to check) and tries to connect. Of course another plausible change could be to actually attempt to connect to it in the socket, but my PR is going to leave most of the code as is and just delete the temporary file, which I believe is what the original implementation was meant to be.

lucat1 added a commit to lucat1/gonic that referenced this issue Dec 8, 2022
Previously, a temporary path was not only being generated but also
touched, therefore the os.Stat check to verify mpv had started was
really doing nothing and just succeeding at the first attempt.

Closes sentriz#265
@sentriz sentriz closed this as completed in e8fac56 Dec 8, 2022
sentriz added a commit that referenced this issue Dec 8, 2022
@marlop352
Copy link

Fix confirmed working on my Pi4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants