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

Protect call to client.enableAllSendQueues #3886

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Nov 18, 2024

@bmarty bmarty added the PR-Bugfix For bug fix label Nov 18, 2024
@bmarty bmarty requested a review from a team as a code owner November 18, 2024 14:15
@bmarty bmarty requested review from ganfra and removed request for a team November 18, 2024 14:15
Copy link
Contributor

📱 Scan the QR code below to install the build (arm64 only) for this PR.
QR code
If you can't scan the QR code you can install the build via this link: https://i.diawi.com/h7pUsb

Copy link

sonarcloud bot commented Nov 18, 2024

Copy link

codecov bot commented Nov 18, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.90%. Comparing base (7222a1f) to head (9717775).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #3886   +/-   ##
========================================
  Coverage    82.90%   82.90%           
========================================
  Files         1785     1785           
  Lines        45105    45105           
  Branches      5326     5326           
========================================
  Hits         37396    37396           
  Misses        5843     5843           
  Partials      1866     1866           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ganfra
Copy link
Member

ganfra commented Nov 18, 2024

Mmmm, this is weird, this means there is an old client still referenced?

@bmarty
Copy link
Member Author

bmarty commented Nov 18, 2024

Mmmm, this is weird, this means there is an old client still referenced?

Nothing is done to stop SendQueues. This is maybe another way to fix the issue?

Edit actually the scope should be destroyed, so this should work

@ganfra
Copy link
Member

ganfra commented Nov 18, 2024

Mmmm, this is weird, this means there is an old client still referenced?

Nothing is done to stop SendQueues. This is maybe another way to fix the issue?

It's bound to the LoggedInFlowNode lifecycle, so this should be stopped at this point :/

@jmartinesp
Copy link
Member

jmartinesp commented Nov 19, 2024

According to the logs, the user was signed out but the app wasn't killed, so when the app was opened again it tried restoring the saved navigation state, which I guess either returned a new instance or retained one of our MatrixClient wrappers and then failed when it tried using the underlying Client:

2024-11-16T14:01:24.646079Z ERROR elementx: [Push/Notification/DefaultNotifiableEventResolver] Unable to resolve event: ----.
java.lang.IllegalStateException: NotificationClient object has already been destroyed
	at org.matrix.rustcomponents.sdk.NotificationClient.getNotification(SourceFile:147)
	at io.element.android.libraries.matrix.impl.notification.RustNotificationService$getNotification$2.invokeSuspend(SourceFile:55)
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(SourceFile:9)
	at kotlinx.coroutines.DispatchedTask.run(SourceFile:107)
	at com.google.android.gms.tasks.zzc.run(SourceFile:49)
	at kotlinx.coroutines.scheduling.TaskImpl.run(SourceFile:3)
	at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(SourceFile:93)
 | 
2024-11-16T14:01:24.647532Z  WARN elementx: [Push/PushHandler] Unable to get a notification data | 
2024-11-16T14:02:31.132845Z  WARN elementx: [MainActivity] onCreate, with savedInstanceState: true | 
2024-11-16T14:02:31.158780Z  WARN elementx: [MainActivity] onNewIntent | 
2024-11-16T14:02:31.159743Z  WARN elementx: [MainActivity] onResume | 
2024-11-16T14:02:31.223778Z DEBUG elementx: Current app migration version: 7. No migration needed. | 
2024-11-16T14:02:31.240437Z  WARN elementx: [MainActivity] onMainNodeInit | 
2024-11-16T14:02:31.241957Z DEBUG elementx: Restore state | 
2024-11-16T14:02:31.242295Z  WARN elementx: Restore with non-empty map | 
2024-11-16T14:02:31.242762Z DEBUG elementx: [Lifecycle] onCreate RootFlowNode | 
2024-11-16T14:02:31.246803Z DEBUG elementx: [Lifecycle] onCreate LoggedInFlowNode | 
2024-11-16T14:02:31.247212Z DEBUG elementx: [Navigation] Navigating to session ---, Current state: Root | 
2024-11-16T14:02:31.247596Z DEBUG elementx: [Navigation] Navigating to space !mainSpace:local. Current state: Session(owner=---, sessionId=---) | 
2024-11-16T14:02:31.248198Z DEBUG elementx: [Lifecycle] onCreate LoggedInAppScopeFlowNode | 
2024-11-16T14:02:31.248975Z DEBUG elementx: Navigating to Room(sessionId=---, roomId=---, threadId=null) | 
2024-11-16T14:02:31.252992Z DEBUG elementx: [Lifecycle] onCreate RoomListNode | 
2024-11-16T14:02:31.253392Z  INFO elementx: setAllSendQueuesEnabled(true) | 
2024-11-16T14:02:31.253413Z DEBUG elementx: [Lifecycle] onCreate LoggedInNode | 
2024-11-16T14:02:31.255261Z DEBUG elementx: [Lifecycle] onCreate RoomFlowNode | 
2024-11-16T14:02:31.256300Z DEBUG elementx: [Lifecycle] onCreate ComposableNode | 
2024-11-16T14:02:31.257910Z DEBUG elementx: Room membership: JOINED | 
2024-11-16T14:02:31.259225Z DEBUG elementx: [Lifecycle] onCreate JoinedRoomFlowNode | 
2024-11-16T14:02:31.260418Z DEBUG elementx: [Lifecycle] onCreate ComposableNode | 
2024-11-16T14:02:31.261355Z DEBUG elementx: Room factory is destroyed, returning null for --- | 
2024-11-16T14:02:31.262613Z DEBUG elementx: Save matrix session keys = [---] | 
2024-11-16T14:02:32.749333Z TRACE elementx: Uncaught exception: java.lang.IllegalStateException: Client object has already been destroyed | 

@ganfra
Copy link
Member

ganfra commented Nov 19, 2024

So there is probably a scenario where MatrixClientsHolder is not updated correctly

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
PR-Bugfix For bug fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants