-
Notifications
You must be signed in to change notification settings - Fork 228
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
Restarting the server on the fly ignores set levels and mixes everybody at 100% #955
Comments
Just a to clarify - does that imply you've reproduced this in earlier versions, or just by inference? |
@gilgongo: not everybody was on 3.6.2 when we noticed (around 17 clients on the server). and i didn't ask for every version because i think the code concerning the levels hasn't been touched in the last few releases (correct me, if i'm wrong) |
I don't think the server has any way to store this information (currently). So the two options to improve this would be:
|
Also, when you say "restarting" do you mean a kill -s SIGUSR1/2 as part of recording, or a kill -HUP (or stop/start)? |
@gilgongo |
UDP is a connectionless protocol. Stopping the server cannot be directly detected by the client. One of two things needs to happen: either the server says "I'm disconnecting you" or the client says "It's been rather a long time since I heard from the server". The former only happens with When the server restarts, the server has no way - currently - of knowing what clients were connected. It just waits for them to start talking to it again. Hence the generous amount of time they give it to recover. What it sounds like we need here then is:
Now, there may be an existing message the server sends to the client when it first hears from it - can't remember... but I don't think the client's prepared to suddenly be told "You need to send state" when it thinks everything's okay. |
Regarding "a generous amount of time".... the server is always sending the audio mix... this can serve as a keep-alive... the server is up unless there is no audio mix output I am assuming the audio mix output exists as long as there is at least one user connected... I agree that the server needs a "send state" request if it receives a message from an unexpected client. |
I'm pretty sure that's what's used -- audio is the only thing that's meant to run constantly. If it stops, you know the server's "not there"... but it could be one packet, two packets... twenty packets... buffer now seriously under running... Cloud servers sometimes do get swapped out by long running high priority tasks on the same metal - you'll see that "ping" suddenly go from 30ms to 500ms (or the maximum reported)... but the client hangs on in there, waiting for things to settle. And often after a few tens of seconds, they do. The server hasn't noticed anything (maybe a few dropped packets on its side, too, of course). The problem only comes when the process terminates - i.e. the server stops existing. That doesn't normally happen. It's either a deliberate act (i.e. "stop the server", perhaps as part of "restart the server") or it's due to a crash. Some crash-type failures may result in an automatic restart. But yes, simple solution: server tells client "No, no, believe me: I don't know you (any more)" and so client sends state. |
I'm wondering if we could (ab)use some existing side effect in the protocol to detect a server restart, e.g.:
|
We should select a max time with no server transmissions to declare the server down and restart. It is almost arbitrary. @hoffie When the server restarts, there will be no destination to send a restart message unless the server has some persistent data of connected clients just prior to the restart. What information persist across a restart? |
Yes, that's true at the time of the restart (and it will be true for all other proposed detection mechanisms). The reason why it could work is that clients will "reconnect" quickly (technically: they will probably not notice that they had not been connected and will continue to behave as if nothing happened). We would explicitly be making use of the fact that the server noticed knows that it was restarted. We would only have to make clients recognize this an act like it was a fresh connection. Have you tried it? In a quick test, restarting a server will cause a new welcome message to be sent to existing clients. |
I think there are some things the client "knows" to tell the server on a fresh connect and some things the server knows to tell the client, currently. What we have here is the server "knowing" it's a fresh connect -- but the client not having realised. So we need a way to make it clear to the client "something happened you weren't expecting" and it then needs to act appropriately. |
Looks like there are already several opportunities in the server code which signal the client that it was reconnected (= is considered to be a new client by the server): Line 593 in 7d0801a
|
Interestingly, some of the messages explicitly allows for getting into an unexpected state So the problem is reduced -- the server knows to try to poke at the client for the information it needs, it's just the client side. What does it decide to do on a ClientIDMes arriving? Seems to be this... Line 710 in 7d0801a
which just triggers the UI to do something (probably not resend current values). Potentially |
since this a very rare event: can't the server just (re)start with all channels on 0% until it gets the actual values from the clients? |
They don't. |
Another thought after reading some code in this area: Could it be that the necessary code for sending the proper fader levels to the server is there, but is not triggered due to the following mismatch between server and client state?
If this is true, the fix might be a change in |
If so, that shouldn't happen - I think any such check could be removed. I don't think that's it, though - I think the client only sends on connect or on change. Because the client's have no need to pass each other level information (with the exclusion of the recent addition of the "has me muted" indicator). |
Yeah, my suspicion was that the highlighted changed is not properly noticed by the client. The following test seems to contradict my suspicion:
I then analyzed the resulting dump (thanks a lot to @softins for the tcpdump filter example and the wireshark dissector. This is a huge help!).
So... protocol-wise everything seems fine to me in this case: The clients do properly send their intended gain levels to the server. I did not verify how the audio behaves in this case, but I think the test shows that:
Edit: Attached the pcap, in case someone wants to check themselves. Edit 2: Seems like I can reproduce the issue partially: After a server restart, sometimes only one CHANNEL_GAIN message per client can be observed. This would explain the behavior from the issue description although I'm still unsure about the reason. Timing may play a role, repeated restarts may play a role. Will continue investigating as time permits. |
This ensures that clients will reset their audio mixer board state upon reconnect. Otherwise, gain levels may not be sent reliably to the server. Fixes jamulussoftware#955. Signed-off-by: Christian Hoffmann <[email protected]>
Previously, gain levels had only been updated when a channel's name changed. This leads to missing gain level updates when reconnecting to a restarted server. Therefore, always update gain levels when receiving a new channel list. Fixes jamulussoftware#955. Signed-off-by: Christian Hoffmann <[email protected]>
By now I'm pretty confident that my hypothesis is correct, i.e. that
So, essentially, this is a race condition:
Two possible fixes come to mind:
I have verified this with the following tests:
Test 2: Vanilla Jamulus client/server, reconnect in opposite order test2-vanilla-reconnect-in-reverse-order.pcap.log
Test 3: Vanilla Jamulus server with modified Jamulus client (PR #1009), reconnect in initial order test3-modified-client-reconnect-in-normal-order.log
Test 4: Vanilla Jamulus client with modified Jamulus server (PR #1010), reconnect in initial order
To move this forward, we would have to do the following:
I suggest that general discussion on this issue is kept here while discussion about correctness, upsides and downsides of the proposals are directed to the relevant PRs which are linked above. |
Great work @hoffie! I agree with the need to do more testing, but I have examined both PRs and the changes look good. One test is missing from the above: modified Jamulus client (PR #1009) with modified Jamulus server (PR #1010) For maximum compatibility, my initial view is that both PRs should be applied. That would improve the issue with both older clients on a new server, and with newer clients on an old server. Provided there is no problem with new clients talking to a new server.
I would think that the bandwidth consumed in this case is much less than that used by the audio streams, and so not significant. |
That's a fair point, @softins, and one I'd not thought of -- having both may well improve matters significantly more than just the one. Hopefully at some point the "random pan" bug that affects certain combinations of client and server will get squashed in the cross-fire of fixes like this, too. |
@softins I have done the test you suggested and it looks good (as expected). When combining both fixes, the client-side fix becomes irrelevant in the scenario. Of course, it will stay relevant when connecting to servers without the fix.
Yeah, I fully agree, just wanted to mention it. :)
Don't know what specific bug you refer to, but I want to add that my PRs intend to fix the gain bug mentioned in this issue, but in practice they should do even more: They will force the client to re-trigger sending all mixer properties. This should cover gain, pan, mute, solo and group (the latter two indirectly as they seem to be handled via mute protocol messages?). So, there is a real chance that the bug you are referring to may be fixed by this as well. I guess there is agreement that more testing is needed, especially for the client-side fix where I'm really unsure about possible side effects. However, I fail to come up with useful test cases. I might just run my own Jamulus stuff with both fixes applied and will try to check if anything breaks. Test 5: Modified Jamulus client (PR #1009) with modified Jamulus server (PR #1010), reconnect in initial order test5-modified-server-and-client-reconnect-in-normal-order.pcap.log
|
Sorry to jump on this thread, I have searched for other tickets and maybe this is closest. Does the behaviour described mix everyone at 100% or at "new client" level? And is there a separate subject anywhere about setting default new client level to something like 70% instead of 100% (which seems a poor default)? |
I'm not the expert on this issue, but I think it must be 100%. The "new client" level is a client-side setting, but this issue is that when the server is restarted, it doesn't know each client's fader settings. I assume the 100% is an initialised default within the server before it receives the actual setting from the client.
Don't know, sorry. Raise it as an issue, and hopefully that will attract discussion. |
This ensures that clients will reset their audio mixer board state upon reconnect. Otherwise, gain levels may not be sent reliably to the server. Fixes jamulussoftware#955. Signed-off-by: Christian Hoffmann <[email protected]>
…ssoftware#1010 Signed-off-by: Christian Hoffmann <[email protected]>
Previously, gain levels had only been updated when a channel's name changed. This leads to missing gain level updates when reconnecting to a restarted server. Therefore, always update gain levels when receiving a new channel list. Fixes jamulussoftware#955. Signed-off-by: Christian Hoffmann <[email protected]>
I've just gotten around to finishing tests with real audio. I ran two Jamulus clients which connect to a local server. One client (A) fed music into the server (and has himself muted in its mix). I was listening to another Jamulus client (B). I had set the level of the music-providing client (A) really low in B's mix to spot any differences after restarts.
I have not noticed any downsides of either PRs. I therefore agree that both PRs should be merged. Anyone hitting this issue can upgrade their server, their client or both to profit from the fix. |
This reverts PR jamulussoftware#1009 (f116811) as it has unintended side effects (jamulussoftware#1191). Basically, that PR assumed that applying stored fader levels would always be a safe thing to do. This is not the case, as changes in fader levels are currently not stored immediately, but rather in specific events only (e.g. disconnects). PR jamulussoftware#1009 was initially supposed to help with jamulussoftware#955 as a client-side fix. With the revert, we still have the server-side fix from jamulussoftware#1010. It is planned to re-apply jamulussoftware#1009 once fader-level storage has been fully understood and extended to cover all relevant places (jamulussoftware#1191).
This reverts PR jamulussoftware#1009 (f116811) as it has unintended side effects (jamulussoftware#1191). Basically, that PR assumed that applying stored fader levels would always be a safe thing to do. This is not the case, as changes in fader levels are currently not stored immediately, but rather in specific events only (e.g. disconnects). PR jamulussoftware#1009 was initially supposed to help with jamulussoftware#955 as a client-side fix. With the revert, we still have the server-side fix from jamulussoftware#1010. It is planned to re-apply jamulussoftware#1009 once fader-level storage has been fully understood and extended to cover all relevant places (jamulussoftware#1191).
commit 9298a08 Merge: 36f0cea 4f4a99c Author: dingodoppelt <[email protected]> Date: Sat Mar 13 23:30:33 2021 +0100 Merge branch 'improve-multi-thread' of https://github.com/menzels/jamulus into menzels-improve-multi-thread commit 36f0cea Author: Christian Hoffmann <[email protected]> Date: Sat Mar 13 00:11:16 2021 +0100 Changelog: Improve formatting (jamulussoftware#1218) * Fix author's Github handle * Improve structure and readability * Group related entries (e.g. Windows-related, Bug fixes) * Use consistent style regarding cases, tenses and punctuation. * Unify "coded by", "suggested by" and "created by" to "contributed by" * Sort entries by end-user relevance * Add attributions for new translations * @-mention authors * Further improvements by @softins commit d2c7975 Merge: 02e2d37 d5bb37e Author: Christian Hoffmann <[email protected]> Date: Sat Mar 13 00:00:19 2021 +0100 Merge pull request jamulussoftware#1231 from softins/translation-attribution Add translation attributions. commit 02e2d37 Merge: be82183 b6d78ad Author: ann0see <[email protected]> Date: Fri Mar 12 18:53:50 2021 +0100 Merge pull request jamulussoftware#1221 from hoffie/fix-italian-versine commit d5bb37e Author: Tony Mountifield <[email protected]> Date: Fri Mar 12 15:12:37 2021 +0000 Add translation attributions. commit b6d78ad Author: Christian Hoffmann <[email protected]> Date: Wed Mar 10 17:03:06 2021 +0100 Installer: Fix typo in Italian translation versine -> versione Thanks to @Zyfuss in jamulussoftware#1217 (comment) commit be82183 Author: Tony Mountifield <[email protected]> Date: Wed Mar 10 11:02:55 2021 +0000 Set version to 3.7.0rc1 commit aa00386 Author: Tony Mountifield <[email protected]> Date: Wed Mar 10 10:49:42 2021 +0000 Additions to ChangeLog and contributors list. commit 5111a05 Merge: 5d2574a c58a080 Author: Christian Hoffmann <[email protected]> Date: Wed Mar 10 11:22:58 2021 +0100 Merge pull request jamulussoftware#1203 from hoffie/improve-translation-checker-macros-detection Tools: Improve Wininstaller translation checker commit 5d2574a Merge: 17d8f74 ef78ff5 Author: Tony Mountifield <[email protected]> Date: Tue Mar 9 21:24:15 2021 +0000 Merge pull request jamulussoftware#1194 from npostavs/np.driverInfo-set0 commit 17d8f74 Merge: 3a17f92 ab1bbe6 Author: Christian Hoffmann <[email protected]> Date: Tue Mar 9 17:25:06 2021 +0100 Merge pull request jamulussoftware#1210 from hoffie/revert-1009 Revert "Client: Always update gain levels" commit 3a17f92 Author: Tony Mountifield <[email protected]> Date: Tue Mar 9 15:47:31 2021 +0000 Fix accelerator and update qm for FR and SE. commit ab1bbe6 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 23:01:02 2021 +0100 Revert "Client: Always update gain levels" This reverts PR jamulussoftware#1009 (f116811) as it has unintended side effects (jamulussoftware#1191). Basically, that PR assumed that applying stored fader levels would always be a safe thing to do. This is not the case, as changes in fader levels are currently not stored immediately, but rather in specific events only (e.g. disconnects). PR jamulussoftware#1009 was initially supposed to help with jamulussoftware#955 as a client-side fix. With the revert, we still have the server-side fix from jamulussoftware#1010. It is planned to re-apply jamulussoftware#1009 once fader-level storage has been fully understood and extended to cover all relevant places (jamulussoftware#1191). commit 2d7025e Merge: ca2ae79 b6ce552 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 21:51:56 2021 +0100 Merge pull request jamulussoftware#1208 from Snayler/wininstallerpt pt_PT translation of wininstaller for 3.7.0 commit ca2ae79 Author: Olivier Humbert <[email protected]> Date: Mon Mar 8 21:46:33 2021 +0100 Update French translation for 3.7.0 (jamulussoftware#1199) * French translation update * fixes a French translation mistake after a double-check * Updates French translation commit b6ce552 Author: Miguel de Matos <[email protected]> Date: Mon Mar 8 17:39:30 2021 +0000 pt_PT translation of wininstaller for 3.7.0 commit ef78ff5 Author: Noam Postavsky <[email protected]> Date: Sun Mar 7 10:45:37 2021 -0500 windows/sound.cpp: Explicitly set driverInfo to 0 Until now, it was semi-accidentally set to zero by virtue of being allocated on fresh memory. commit c58a080 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 10:01:30 2021 +0100 Tools: Improve Wininstaller translation checker The checker will now detect if the macros are commented out. jamulussoftware#1198 (review) Signed-off-by: Christian Hoffmann <[email protected]> commit d87562e Author: dzpex <[email protected]> Date: Mon Mar 8 09:51:56 2021 +0100 Installer: Add Italian translation (jamulussoftware#1198) * Update it.nsi * Update installerlng.nsi commit 4f4a99c Author: Stefan Menzel <[email protected]> Date: Sat Mar 6 20:26:51 2021 +0100 fix mt handling commit 8af2860 Merge: 8bf813e 6e630f4 Author: Stefan Menzel <[email protected]> Date: Sat Feb 20 01:58:01 2021 +0100 Merge remote-tracking branch 'origin/master' into improve-multi-thread commit 8bf813e Author: Stefan Menzel <[email protected]> Date: Mon Feb 15 21:16:49 2021 +0100 cleanup and formatting commit f04f15b Author: Stefan Menzel <[email protected]> Date: Mon Feb 15 20:03:37 2021 +0100 fix indentation commit 6159fc4 Author: Stefan Menzel <[email protected]> Date: Mon Feb 15 20:03:20 2021 +0100 use bigger type to avoid multiplication overflow warning commit 2e52b70 Author: Stefan Menzel <[email protected]> Date: Sat Feb 13 23:46:54 2021 +0100 use custom threadpool commit 6b112e7 Author: Stefan Menzel <[email protected]> Date: Sat Feb 13 23:45:31 2021 +0100 add .cache to gitignore commit cdd2d88 Author: Stefan Menzel <[email protected]> Date: Sat Feb 13 23:45:15 2021 +0100 add custom threadpool impl commit e08c28d Author: Stefan Menzel <[email protected]> Date: Sat Feb 6 23:13:09 2021 +0100 move opus encoder setup out of loop commit 5708c2e Author: Stefan Menzel <[email protected]> Date: Sat Feb 6 23:12:19 2021 +0100 improve multithread performance spreading the workload equally among available threads
commit d083a2a Author: dingodoppelt <[email protected]> Date: Sat Mar 13 00:51:47 2021 +0100 allow formatting commit 77fd5fb Author: dingodoppelt <[email protected]> Date: Fri Mar 12 21:23:56 2021 +0100 send chat message from outside to all clients commit 79b7b9e Author: dingodoppelt <[email protected]> Date: Fri Mar 12 20:39:45 2021 +0100 accept external chat message via protocol message commit 36f0cea Author: Christian Hoffmann <[email protected]> Date: Sat Mar 13 00:11:16 2021 +0100 Changelog: Improve formatting (jamulussoftware#1218) * Fix author's Github handle * Improve structure and readability * Group related entries (e.g. Windows-related, Bug fixes) * Use consistent style regarding cases, tenses and punctuation. * Unify "coded by", "suggested by" and "created by" to "contributed by" * Sort entries by end-user relevance * Add attributions for new translations * @-mention authors * Further improvements by @softins commit d2c7975 Merge: 02e2d37 d5bb37e Author: Christian Hoffmann <[email protected]> Date: Sat Mar 13 00:00:19 2021 +0100 Merge pull request jamulussoftware#1231 from softins/translation-attribution Add translation attributions. commit 02e2d37 Merge: be82183 b6d78ad Author: ann0see <[email protected]> Date: Fri Mar 12 18:53:50 2021 +0100 Merge pull request jamulussoftware#1221 from hoffie/fix-italian-versine commit d5bb37e Author: Tony Mountifield <[email protected]> Date: Fri Mar 12 15:12:37 2021 +0000 Add translation attributions. commit b6d78ad Author: Christian Hoffmann <[email protected]> Date: Wed Mar 10 17:03:06 2021 +0100 Installer: Fix typo in Italian translation versine -> versione Thanks to @Zyfuss in jamulussoftware#1217 (comment) commit be82183 Author: Tony Mountifield <[email protected]> Date: Wed Mar 10 11:02:55 2021 +0000 Set version to 3.7.0rc1 commit aa00386 Author: Tony Mountifield <[email protected]> Date: Wed Mar 10 10:49:42 2021 +0000 Additions to ChangeLog and contributors list. commit 5111a05 Merge: 5d2574a c58a080 Author: Christian Hoffmann <[email protected]> Date: Wed Mar 10 11:22:58 2021 +0100 Merge pull request jamulussoftware#1203 from hoffie/improve-translation-checker-macros-detection Tools: Improve Wininstaller translation checker commit 5d2574a Merge: 17d8f74 ef78ff5 Author: Tony Mountifield <[email protected]> Date: Tue Mar 9 21:24:15 2021 +0000 Merge pull request jamulussoftware#1194 from npostavs/np.driverInfo-set0 commit 17d8f74 Merge: 3a17f92 ab1bbe6 Author: Christian Hoffmann <[email protected]> Date: Tue Mar 9 17:25:06 2021 +0100 Merge pull request jamulussoftware#1210 from hoffie/revert-1009 Revert "Client: Always update gain levels" commit 3a17f92 Author: Tony Mountifield <[email protected]> Date: Tue Mar 9 15:47:31 2021 +0000 Fix accelerator and update qm for FR and SE. commit ab1bbe6 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 23:01:02 2021 +0100 Revert "Client: Always update gain levels" This reverts PR jamulussoftware#1009 (f116811) as it has unintended side effects (jamulussoftware#1191). Basically, that PR assumed that applying stored fader levels would always be a safe thing to do. This is not the case, as changes in fader levels are currently not stored immediately, but rather in specific events only (e.g. disconnects). PR jamulussoftware#1009 was initially supposed to help with jamulussoftware#955 as a client-side fix. With the revert, we still have the server-side fix from jamulussoftware#1010. It is planned to re-apply jamulussoftware#1009 once fader-level storage has been fully understood and extended to cover all relevant places (jamulussoftware#1191). commit 2d7025e Merge: ca2ae79 b6ce552 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 21:51:56 2021 +0100 Merge pull request jamulussoftware#1208 from Snayler/wininstallerpt pt_PT translation of wininstaller for 3.7.0 commit ca2ae79 Author: Olivier Humbert <[email protected]> Date: Mon Mar 8 21:46:33 2021 +0100 Update French translation for 3.7.0 (jamulussoftware#1199) * French translation update * fixes a French translation mistake after a double-check * Updates French translation commit b6ce552 Author: Miguel de Matos <[email protected]> Date: Mon Mar 8 17:39:30 2021 +0000 pt_PT translation of wininstaller for 3.7.0 commit ef78ff5 Author: Noam Postavsky <[email protected]> Date: Sun Mar 7 10:45:37 2021 -0500 windows/sound.cpp: Explicitly set driverInfo to 0 Until now, it was semi-accidentally set to zero by virtue of being allocated on fresh memory. commit c58a080 Author: Christian Hoffmann <[email protected]> Date: Mon Mar 8 10:01:30 2021 +0100 Tools: Improve Wininstaller translation checker The checker will now detect if the macros are commented out. jamulussoftware#1198 (review) Signed-off-by: Christian Hoffmann <[email protected]> commit d87562e Author: dzpex <[email protected]> Date: Mon Mar 8 09:51:56 2021 +0100 Installer: Add Italian translation (jamulussoftware#1198) * Update it.nsi * Update installerlng.nsi
Describe the bug
Restarting the server sets levels to 100%
To Reproduce
restart a running server with clients on it and notice how it ignores the set gain levels and mixes everybody at 100%
Expected behavior
the server should mix everybody at the individually set levels
Operating system
linux, windows, macos
Version of Jamulus
3.6.2 and before
The text was updated successfully, but these errors were encountered: