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

Ensure sync thread is started #6884

Merged
merged 9 commits into from
Aug 22, 2022
Merged

Conversation

bmarty
Copy link
Member

@bmarty bmarty commented Aug 19, 2022

Type of change

  • Feature
  • Bugfix
  • Technical
  • Other :

Content

  • Fix Messages are not arriving #6782. This is this commit: 0b1b228. - I am still investigating, because sometimes, the SyncThread stays in the PAUSE state, which is not correct.
  • Improve SDK Debug API
  • Log Thread before rageshake are sent.
  • Rename thread names

Motivation and context

Regression from #6710, release in Element and SDK v1.4.31 (2022-08-01)

Screenshots / GIFs

NA

Tests

  • See the step to repro here.

Tested devices

  • Physical
  • Emulator
  • OS version(s):

Checklist

@bmarty bmarty requested a review from ouchadam August 19, 2022 08:15
setActiveSession(session)
session.configureAndStart(applicationContext, startSyncing = startSync)
}
return activeSessionReference.get()
Copy link
Contributor

@ouchadam ouchadam Aug 19, 2022

Choose a reason for hiding this comment

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

this might be clashing with https://github.com/vector-im/element-android/blob/develop/vector/src/main/java/im/vector/app/VectorApplication.kt#L176

I've always wondered if we should stop syncing when entering the foreground 🤔

EDIT - I guess the difference is foreground sync thread vs background sync workers

Copy link
Member Author

Choose a reason for hiding this comment

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

I've always wondered if we should stop syncing when entering the foreground

in foreground we should always have sync polling. Did you mean 'background'?

Also in VectorApplication, the Session may not be restored yet.

I am still investigating, but I agree this code is quite tricky...

@opusforlife2
Copy link
Contributor

I am still investigating, because sometimes, the SyncThread stays in the PAUSE state, which is not correct.

I don't know about you guys, but I have occasionally encountered the Paused state on my device since forever. I don't remember if it started in a particular version. The solution has always been to remove the app from Recent Apps and then open it again, which causes the sync to resume.

@bmarty
Copy link
Member Author

bmarty commented Aug 22, 2022

I am still investigating, because sometimes, the SyncThread stays in the PAUSE state, which is not correct.

I don't know about you guys, but I have occasionally encountered the Paused state on my device since forever. I don't remember if it started in a particular version. The solution has always been to remove the app from Recent Apps and then open it again, which causes the sync to resume.

Thanks for the feedback.

On my side I did not repro in the past days.
We will investigate this issue separately.

Moving this PR to ready to review.

@bmarty bmarty marked this pull request as ready for review August 22, 2022 07:51
@bmarty bmarty added the Z-NextRelease For issues and PRs which should be included in the NextRelease. label Aug 22, 2022
}
return activeSessionReference.get()
?.also {
if (startSync && !it.syncService().isSyncThreadAlive()) {
Copy link
Contributor

@ouchadam ouchadam Aug 22, 2022

Choose a reason for hiding this comment

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

for my understanding of the error scenario

  • app is not started
  • receive a push
  • session instance is created with startSyncing = false and cached
  • next time the app is launched the sync is not started because the session instance already exists and we only configureAndStart brand new instances

the fix is to always start the sync (if startStart = true) on our cached instances if they're not already syncing?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, that's it, sorry, the code is not crystal clear.

@sonarqubecloud
Copy link

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 1 Code Smell

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@bmarty
Copy link
Member Author

bmarty commented Aug 22, 2022

checkCantVerifyPopup[test(AVD) - 9] FAILED for some other reason.

@bmarty bmarty merged commit e86058b into develop Aug 22, 2022
@bmarty bmarty deleted the feature/bma/sync_thread_investigation branch August 22, 2022 10:09
@bmarty bmarty mentioned this pull request Aug 22, 2022
15 tasks
@opusforlife2
Copy link
Contributor

I don't know about you guys, but I have occasionally encountered the Paused state on my device since forever.

It's still a bit early to be sure, but I don't think I've encountered this after switching to ntfy for push notifications, from F-Droid's 60 second polling. It might have been specific to that particular config.

@opusforlife2
Copy link
Contributor

Yep. Too early. Got a Paused even with ntfy. I have no STR, sadly, otherwise I would have created a new issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Z-NextRelease For issues and PRs which should be included in the NextRelease.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Messages are not arriving
3 participants