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

Fix errors when switching user #1491

Merged
merged 3 commits into from
Mar 1, 2025

Conversation

andrew-sayers
Copy link
Contributor

Fluidsynth includes a systemd user service, which listens on TCP port 9800 by default. So if a computer starts a second user session, that session's service immediately fails because port 9800 is already in use. Lightdm implements its login prompt as a user session, so this can happen just by misclicking the "switch user" button. I assume other display managers are the same, but haven't checked.

This PR is a set of loosely-connected suggestions that would have helped as I went down this particular rabbit hole. I figure they're easier to review together, but happy to edit/split out/remove anything that doesn't fit.

Trying to run a second server will fail unless the user has configured
a non-default port.  This happens every time a user switches user,
because the display manager is implemented as a systemd user session.
Use a lock file to avoid that happening.

This gets rid of an error message for most users, but forces advanced users
to override the systemd configuration.  Such users should be smart enough to
see the condition failure in the logs, check fluidsynth.service, and understand
the hint about `systemctl edit`.
I got the following error while investigating an issue where FluidSynth
failed binding to port 9800:

    fluidsynth: error: Failed to bind server socket: 98

It took a long while to realise "98" was an error code, not a sign that
"9800" had been truncated somehow.

Rephrase the errors to avoid confusion.
This is particularly useful when started by systemd.  Without this change,
the service exits normally without telling systemd it started, leading to
an unhelpful "protocol" message from systemd.
Copy link
Member

@derselbst derselbst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks!

@derselbst derselbst merged commit 0461d75 into FluidSynth:master Mar 1, 2025
52 of 55 checks passed
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

Successfully merging this pull request may close these issues.

2 participants