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

Automatic Sync stops after running in the background for a while #93

Closed
DoraTrix opened this issue Oct 6, 2023 · 10 comments
Closed

Automatic Sync stops after running in the background for a while #93

DoraTrix opened this issue Oct 6, 2023 · 10 comments

Comments

@DoraTrix
Copy link

DoraTrix commented Oct 6, 2023

New user of the app, it's great so far, thanks!

One pain-point: I am using the app on two separate Windows boxes, plus my Android phone, with Dropbox as the sync medium. On all of these devices, after the app has been running for some amount of time (by the logs, ~29 hrs on PC, ~46 on Android), automatic syncing stops. There's no failure in the log, it just stops triggering? On both platforms, this can be resolved (once noticed) by closing (force-closing, on Android) the app and restarting it.

Version:

  • Android: 3.45.1 (this is the latest in the Play Store)
  • Windows: 3.45.2

OS:

  • Android: Android 13 (One UI 5.1)
  • Windows: Win 10 Home (22H2 - 19045.3448), Win 11 Home (22H2 - 22621.2283)

Things I'm not sure are relevant:

  • On PC, the sync interval seems fixed at 20 minutes (or immediately if you make a local change/addition/deletion). On Android it's sometimes 20, sometimes 5, or 15, or 25... 🤷‍♀️
  • Any chance the Dropbox API is rate-limited somehow and OTL is getting throttled at some point?
  • On android, the app-specific battery setting was "optimized" and not "unrestricted" - I know some other apps with background features prompt me on install to go change that, I've tweaked it and will let you know if that helps (doesn't really explain PC though).
  • Could be related to OS restarting?
@mhoeher
Copy link
Owner

mhoeher commented Oct 15, 2023

Hi @DoraTrix,

first of all: Sorry for the late reply. I am currently on a business trip in India and hence barely found time looking into any updates on the "private side" of life 😉

Regarding the issue you describe: This sounds strange. Basically, the background sync is done by triggering periodically in the background a sync on each library. I also have to admit I didn't notice such symptoms recently, but then, I personally use the app on another set of devices (macOS and iOS; mainly).

If possible:

  1. Could you try to extract logs on both devices and send them to me?
  2. On Android, this would have to be done by using add, if possible.
  3. On Windows, you would have to quit the app and start it again from a command prompt using the option --enable-console - this will cause the app to write any logs to standard output (from where you could copy it or redirect it to a file).
  4. In both cases, make sure the logs don't contain anything you don't want to expose (in particular, file paths...). In doubt, send such information by mail (martin AT rpdev DOT net).
  5. On Android, the app should start up automatically (it already listens for BOOT_COMPLETED). So this shouldn't be an issue.
  6. On Windows, as you stated, by adding the app to auto start, it should start up after build as well. If you can see the tray icon after restart, this should have worked.
  7. About rate limiting when using DropBox: The app already handles this, so this should not cause issues (in theory...).

Thanks a lot in advance!

@DoraTrix
Copy link
Author

No worries, I have no strong expectations for response times on free projects!

When I went and checked, the Android app had in fact stopped again after I tweaked the background/power settings for it, so that didn't help. Here is a c/p of the sync log from there - https://pastebin.com/raw/wWcW6pqt. I'm not clear on what you mean by "done by using add, if possible".

I've left it running in the "not syncing" state if there's anything that can help there, a memdump or whatnot?

I'll change the startup for the PC installs to a sub-call from a command window and get those logs in here once it happens again.

@DoraTrix
Copy link
Author

Is the --enable-console switch actually making it log to stdout? I tried using a >> to dump to a log file, and it's not and still showing in the command window, which I've never run into before.

Anyway, here's just a snip from the cmd window, after a successful sync, but maybe relevant?

OpenTodoList.BackgroundService: Debug: Checking connectivity for account DropboxAccount(REDACTED) (:0, )
OpenTodoList.DropboxAccount: Debug: Access token of QUuid("{REDACTED}") is recent enough - try to connect with it. (:0, )
OpenTodoList.DropboxAccount: Debug: Account QUuid("{REDACTED}") finished connectivity check with false (:0, )
OpenTodoList.DropboxAccount: Debug: SynqClient::JobError::NetworkRequestFailed : "Error transferring https://api.dropboxapi.com/2/files/list_folder - server replied: Bad Request" (:0, )

@DoraTrix
Copy link
Author

Ok - after it stops syncing, it's just regular repetitions of this, with no success messages. There are two different QUuid's being referenced if that makes a difference, but possibly Account and Library are supposed to be different?

OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96e5a0)) "Main Dropbox" has not been synced
 for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96e860)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96df70)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96df70)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96e650)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf96d470)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.main: Debug: Application state changed to Qt::ApplicationActive (:0, )
OpenTodoList.main: Debug: Application state changed to Qt::ApplicationInactive (:0, )
OpenTodoList.main: Debug: Application state changed to Qt::ApplicationActive (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
OpenTodoList.BackgroundService: Debug: Library QSharedPointer(Library(0x22ecf965540)) "Main Dropbox" has not been synced for more than 15min, starting sync now (:0, )
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )
qml: Debug: Manually started syncing Main Dropbox (qrc:/Menues/LibraryPageActions.qml:40, expression for onTriggered)
OpenTodoList.BackgroundService: Debug: Sync of library with uid QUuid("{REDACTED UID #1}") requested (:0, )
OpenTodoList.BackgroundService: Debug: Account QUuid("{REDACTED UID #2}") still busy checking connectivity... (:0, )

@mhoeher
Copy link
Owner

mhoeher commented Oct 22, 2023

Hi @DoraTrix,

sorry again for the long days of silence, the last few days were quite busy plus I caught a bad cold on top 🤧

Thanks for gathering the logs. It looks a little bit, like the Dropbox token refresh somehow "hangs". Some words of explanation here:

Dropbox uses OAuth for authenticating clients towards the server. When you set up a Dropbox account in the app, a long living token is generated and stored locally. In addition, the app needs to generate a short lived token (for which the long lived one can be used) to run any queries against the REST API of Dropbox. This "refresh" of the short lived token happens in the connectivity check mentioned in the logs. For whatever reason, it seems the last network request in the refresh still is pending. I'll try to have a look into this, maybe some kind of timeout already would help to solve this issue.

For your reference, this is the ticket over on GitLab to track development of a fix: https://gitlab.com/rpdev/opentodolist/-/issues/641

@DoraTrix
Copy link
Author

DoraTrix commented Oct 22, 2023 via email

@mhoeher
Copy link
Owner

mhoeher commented Oct 25, 2023

Hi @DoraTrix,

I tried to implement a fix for the sync issue. If possible, could you please try to download a pre-built version from this pipeline over on GitLab and see if the problem still occurs?

Basically, I added a watchdog timer which - after a minute - stops the online check (so it would be restarted eventually, instead of letting the app run into a dead end).

If you're interested, here's the actual change: https://gitlab.com/rpdev/opentodolist/-/merge_requests/399/diffs

Thanks a lot in advance!

@DoraTrix
Copy link
Author

DoraTrix commented Oct 26, 2023 via email

@DoraTrix
Copy link
Author

So far so good! The watchdog is kicking in and it's still syncing on both Windows and Android.

@mhoeher
Copy link
Owner

mhoeher commented Oct 31, 2023 via email

@mhoeher mhoeher closed this as completed Oct 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants