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

Built on macOS, websocket doesn't work #1699

Open
kajarit opened this issue Dec 20, 2023 · 23 comments
Open

Built on macOS, websocket doesn't work #1699

kajarit opened this issue Dec 20, 2023 · 23 comments
Assignees

Comments

@kajarit
Copy link

kajarit commented Dec 20, 2023

I've built OwnTone server on macOS 11.7.10 Big Sur with the help of these sources:

OwnTone Server Version 28.8

  • ffmpeg
  • Spotify
  • librespot-c
  • LastFM
  • Without Chromecast
  • MPD
  • Websockets
  • Without ALSA
  • Pulseaudio
  • Webinterface
  • Regex

Almost everything works fine, except things I noticed:

  1. Now playing page doesn't refresh on track change, so when one track ends and the next starts, it still displays the previous track
  2. Selecting a new output (AirPlay speaker) also isn't reflected, just after page reload
  3. When I start a library update, then the About page also won't update until I reload it
  4. When I connect to the websockets endpoint, it doesn't sends any updates, but connection is ok

I also noticed, that the browser page also updates itself when I move to other tab and back.

Postman test
OwnTone websocket Postman

Postman header (defaults hidden)
OwnTone websocket Postman header

And here's the owntone.log fitered for web debug messages:

[2023-12-20 16:57:06] [DEBUG]      web: notify callback request: { "notify": [ "player" ] }
[2023-12-20 16:57:06] [DEBUG]      web: notify callback request: { "notify": [ "player" ] }
[2023-12-20 16:57:06] [DEBUG]      web: notify callback event received: player
[2023-12-20 16:57:06] [DEBUG]      web: notify callback event received: player
[2023-12-20 16:57:28] [DEBUG]      web: notify callback reason: 71
[2023-12-20 16:57:28] [DEBUG]      web: notify callback reason: 71
[2023-12-20 16:57:28] [DEBUG]      web: notify callback reason: 71
[2023-12-20 16:57:28] [DEBUG]      web: notify callback reason: 71
[2023-12-20 16:57:31] [DEBUG]      web: notify callback reason: 11
[2023-12-20 16:57:31] [DEBUG]      web: notify callback reason: 11
@ejurgensen
Copy link
Member

Thanks for reporting and for good info about the issue. @hacketiwack do you think you can look into this? Maybe PR #1446 is of relevance here.

@kajarit
Copy link
Author

kajarit commented Dec 21, 2023

Thanks for looking into this, what about Postman not receiving any notifications, but still connected during playback?

@ejurgensen
Copy link
Member

@hacketiwack any chance you can look at this?

@hacketiwack
Copy link
Collaborator

Yes, sure. Let me check that.

@hacketiwack
Copy link
Collaborator

@kajarit do you have any particular reason to build on an unsupported version of macOS (Big Sur is unsupported since September 2023) and use macports instead of homebrew?
No judgment here, I just don't want to waste my time building a virtual machine in a specific version when there is no particular reason.

@kajarit
Copy link
Author

kajarit commented Jan 13, 2024

I have a 2014 Mac Mini, and I use homebrew. I don't plan to change this machine in the near future.

@hacketiwack
Copy link
Collaborator

@kajarit, I built OwnTone on a macOS Big Sur virtual machine (following the instructions I gave earlier last year). I could reproduce the errors and the behaviour.
However, I don't know what they really mean. I guess error codes are related to these reasons.
@ejurgensen, do you have any idea what these codes mean?
In the logs there are plenty of notify callback reasons, like: 11, 71, 49, 20, 53, 0, 6, 38, 78.
The only other suspicious error is: mdns: Error registering record owntone.local, error -65540 but it probably has nothing to do with our problem here.

I also tested with macOS Monterey with the same results. I suspect that even with the latest version of macOS, you'll have the same problems.

In your specific situation @kajarit macOS Big Sur is not supported and Homebrew is also not supported on this version of macOS. Therefore, my recommendations would be to make use of the containerisation to avoid having to built OwnTone by yourself.

And if you can't install Docker properly. I would suggest to upgrade your Mac Mini to a newer version of macOS with the help of Dortania

@kajarit
Copy link
Author

kajarit commented Jan 18, 2024

Thanks for the tips, I'll have a look on those.
Before building natively, I also tried with Docker but I couldn't make it work for several reasons.

@ejurgensen
Copy link
Member

I don't know those error codes. I think if this issue isn't present with current versions of MacOS/libwebsockets then it's fine to close the issue.

@kajarit
Copy link
Author

kajarit commented Jan 18, 2024

I also tested with macOS Monterey with the same results. I suspect that even with the latest version of macOS, you'll have the same problems.

Does this mean that even with the latest macOS the websocket doesn't work?

@hacketiwack
Copy link
Collaborator

Does this mean that even with the latest macOS the websocket doesn't work?

I need to test it with Sonoma to be sure.

@hacketiwack
Copy link
Collaborator

OK. No good news is coming with this comment. Actually, I get the error on all versions of macOS: from Big Sur to Sonoma.

Now the question is where to start searching within the integration of libwebsocket.
@ejurgensen any idea where I could start my investigation?
What I could try is to compile libwebsockets myself and not take the one coming from Homebrew.

@ejurgensen
Copy link
Member

Actually, I get the error on all versions of macOS: from Big Sur to Sonoma.

So you get an error message - what is that? From the thread above I couldn't see an error message (the notify reasons aren't errors, and the mdns error is unrelated).

If you have some error message I suppose you could search for it in the lws source code. But yes, compiling lws yourself with debug symbols could also be useful for debugging. Have you found a basic way to reproduce? Just browsing the web UI might be a difficult way, since there is a bunch of communication going on, so if you can isolate the error it would be useful.

@hacketiwack
Copy link
Collaborator

You're right these are not error messages, but "reasons" for whatever it means.
I don't have receive any errors or whatever.

I will try to compile with debug symbols and try to find a scenario that could provoke these messages in a reliable way.

@kajarit
Copy link
Author

kajarit commented Jan 19, 2024

Do we know what was the last known working websocket version of OwnTone/macOS ever?

@hacketiwack
Copy link
Collaborator

Do we know what was the last known working websocket version of OwnTone/macOS ever?

Excellent question. No idea.

@kajarit
Copy link
Author

kajarit commented Feb 15, 2024

What I could try is to compile libwebsockets myself and not take the one coming from Homebrew.

Hi @hacketiwack, have you been able to try this?

@hacketiwack
Copy link
Collaborator

@kajarit i did compile my own version of libwebsocket but it gives the same results.
I’m quite puzzled about the reason of this not working properly.

@kajarit
Copy link
Author

kajarit commented Mar 1, 2024

@hacketiwack should we raise an issue at libwebsockets?

@hacketiwack
Copy link
Collaborator

Actually, yes, that would be great.
I was wondering if there was some kind of HTML test with libwebsockers server application that could be used to test on macOS.

@kajarit
Copy link
Author

kajarit commented Mar 6, 2024

I am not sure how to create an issue that would help explain the problem.

@ejurgensen
Copy link
Member

I am planning to write a test program to help debug this. So basically copy websocket.c into a standalone server. I hope that will also help me understand the current implementation. It's a bit of a black box to me now, even after trying to read the code.

@hacketiwack
Copy link
Collaborator

@ejurgensen That would be great to have such test program to debug. Thanks.

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

No branches or pull requests

3 participants