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 to get websocketInstance #2852

Merged
merged 7 commits into from
Mar 10, 2023
Merged

Conversation

mahibi
Copy link
Collaborator

@mahibi mahibi commented Mar 9, 2023

This PR fixes to set the externalSignalingServer to the user, see 8c991c6
Furthermore, race conditions of Workers are now avoided by using WorkManager chains, see 609e5a2

🏁 Checklist

  • ⛑️ Tests (unit and/or integration) are included or not needed
  • 🔖 Capability is checked or not needed
  • 🔙 Backport requests are created or not needed: /backport to stable-xx.x
  • 📅 Milestone is set
  • 🌸 PR title is meaningful (if it should be in the changelog: is it meaningful to users?)

@mahibi mahibi changed the title Fix to get websocketInstance. Fix to get websocketInstance Mar 9, 2023
@mahibi mahibi added this to the 16.1.0 milestone Mar 9, 2023
@mahibi
Copy link
Collaborator Author

mahibi commented Mar 9, 2023

/backport to stable-16.0

@mahibi mahibi force-pushed the bugfix/noid/fixWebsocketConnection branch from 7d7af29 to baa7c56 Compare March 9, 2023 19:47
@mahibi mahibi self-assigned this Mar 9, 2023
@mahibi mahibi added the 3. to review Waiting for reviews label Mar 9, 2023
@mahibi mahibi added 2. developing Work in progress and removed 3. to review Waiting for reviews labels Mar 10, 2023
@mahibi mahibi marked this pull request as draft March 10, 2023 09:16
mahibi added 5 commits March 10, 2023 14:25
Add toast warning for debug mode

Rename "magic" stuff

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
This is necessary as many of the workers store user data. When running in parallel, there are race conditions and user data that was stored by one worker gets directly overwritten by the next worker. E.g. this happened with the "externalSignalingServer" attribute of user:
SignalingSettingsWorker saved the user with the externalSignalingServer value, but then
CapabilitiesWorker kicked in and saved the user without this value.

Because of this, in WebsocketConnectionsWorker getExternalSignalingServer() of the user was null.
Because of this, webSocketConnectionHelper.getExternalSignalingInstanceForServer(..) was not called.
So the webSocketInstanceMap in WebSocketConnectionHelper was never filled.
This is why WebSocketConnectionHelper.getMagicWebSocketInstanceForUserId(..) in ChatController failed to get a webSocketInstance.

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
this is already done in onAttach which seems to do the job fine after using workManager queues and fixing to set externalSignalingServer to user.
See commits da1714bb and 29a37086

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi force-pushed the bugfix/noid/fixWebsocketConnection branch from baa7c56 to abd1d4b Compare March 10, 2023 13:44
@mahibi mahibi marked this pull request as ready for review March 10, 2023 13:44
// Ensure that the listener is added if the web socket instance was not set up yet when
// onAttach() was called.
webSocketInstance?.getSignalingMessageReceiver()?.addListener(localParticipantMessageListener)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

fyi @danxuliu this is now solved...

@mahibi mahibi added 3. to review Waiting for reviews and removed 2. developing Work in progress labels Mar 10, 2023
Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi requested a review from tobiasKaminsky March 10, 2023 14:19
@mahibi mahibi requested a review from AlvaroBrey March 10, 2023 14:19
@github-actions
Copy link
Contributor

Codacy

Lint

TypemasterPR
Warnings108108
Errors00

SpotBugs

CategoryBaseNew
Correctness99
Dodgy code165165
Internationalization55
Malicious code vulnerability33
Performance1111
Security22
Total195195

Signed-off-by: Marcel Hibbe <dev@mhibbe.de>
@mahibi mahibi merged commit abd609c into master Mar 10, 2023
@delete-merged-branch delete-merged-branch bot deleted the bugfix/noid/fixWebsocketConnection branch March 10, 2023 15:25
@github-actions
Copy link
Contributor

APK file: https://www.kaminsky.me/nc-dev/android-artifacts/2852-talk.apk

qrcode

To test this change/fix you can simply download above APK file and install and test it in parallel to your existing Nextcloud Talk app.

@AndyScherzinger AndyScherzinger modified the milestones: 16.1.0, 17.0.0 May 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3. to review Waiting for reviews
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants