-
Notifications
You must be signed in to change notification settings - Fork 438
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 using signaling settings while being refetched #8427
Merged
Antreesy
merged 2 commits into
master
from
fix-using-signaling-settings-while-being-refetched
Aug 17, 2023
Merged
Fix using signaling settings while being refetched #8427
Antreesy
merged 2 commits into
master
from
fix-using-signaling-settings-while-being-refetched
Aug 17, 2023
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
danxuliu
added
2. developing
bug
feature: signaling 📶
Internal and external signaling backends
labels
Dec 2, 2022
/backport to stable25 |
nickvergessen
modified the milestones:
v16.0.0-beta.1,
🚀 Next Beta (26),
v16.0.0-beta.2,
v16.0.0-rc.1,
🚀 Next RC (26),
🖤 Next Major (27)
Feb 23, 2023
Signed-off-by: Daniel Calviño Sánchez <[email protected]>
danxuliu
force-pushed
the
fix-using-signaling-settings-while-being-refetched
branch
from
August 15, 2023 03:41
38ad130
to
e74272e
Compare
/backport to stable27 |
/backport to stable26 |
Antreesy
approved these changes
Aug 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested, seems to work as expected.
Code is clean and readable, algorithm is clean.
Thanks for notes and explanations!
When the external signaling server returns the error "token_expired" the signaling settings are fetched again. However, if there are further requests and "token_expired" is returned again the previous fetch is canceled and a new one started instead, which caused the settings to be temporary set to "null". The signaling settings are expected to always be an object, so setting them to "null" could cause an error if they were used during that time (for example, during a reconnection, which caused the signaling object to "hang" and not do any further connection attempt). Preventing the settings to be nullified is only half of the story, though; "token_expired" can be thrown when trying to connect, and errors thrown when trying to connect cause a reconnection attempt. This could end in a reconnection loop, as each "token_expired" error would cause another fetch of the settings, cancelling the previous fetch and thus preventing the settings to be updated, and as the previous settings would be still used any connection attempt would end again in another "token_expired" error. To solve all that now any connection attempt done after receiving a "token_expired" error is deferred until the signaling settings were updated. Note that the previous signaling settings are kept to ensure that a signaling object is always available, even if outdated. However, any usage of the outdated signaling settings is expected to cause a "token_expired" error to be thrown; right now that only happens during connections, so only that code needs to wait for the settings to be fetched again. Signed-off-by: Daniel Calviño Sánchez <[email protected]>
danxuliu
force-pushed
the
fix-using-signaling-settings-while-being-refetched
branch
from
August 17, 2023 20:31
fce3a03
to
0a14a20
Compare
Antreesy
deleted the
fix-using-signaling-settings-while-being-refetched
branch
August 17, 2023 21:51
This was referenced Aug 17, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up to #7472
When the external signaling server returns the error
token_expired
the signaling settings are fetched again. However, if there are further requests andtoken_expired
is returned again the previous fetch is canceled and a new one started instead, which caused the settings to be temporary set tonull
. The signaling settings are expected to always be an object, so setting them tonull
could cause an error if they were used during that time (for example, during a reconnection, which caused the signaling object to "hang" and not do any further connection attempt).Preventing the settings to be nullified is only half of the story, though;
token_expired
can be thrown when trying to connect, and errors thrown when trying to connect cause a reconnection attempt. This could end in a reconnection loop, as eachtoken_expired
error would cause another fetch of the settings, cancelling the previous fetch and thus preventing the settings to be updated, and as the previous settings would be still used any connection attempt would end again in anothertoken_expired
error.To solve all that now any connection attempt done after receiving a
token_expired
error is deferred until the signaling settings were updated.Note that the previous signaling settings are kept to ensure that a signaling object is always available, even if outdated. However, any usage of the outdated signaling settings is expected to cause a
token_expired
error to be thrown; right now that only happens during connections, so only that code needs to wait for the settings to be fetched again.How to test
sleep(5);
toSignalingController::getSettings()
to delay getting the signaling settingsgetSignaling().forceReconnect(true)
Result with this pull request
The first reconnection attempt fails with
token_expired
, and then the connection with the signaling server is established again once the signaling settings were updatedResult without this pull request
The first and second reconnection attempts fail with
token_expired
, andthis.settings is null
is thrown in the third and last attempt, as it was done while fetching the settings again for the second time, which cancelled the first fetching and caused the settings to be set to null