Android - freeze when syncing start

Operating system

Android

Version

2,12,3

Sync target

WebDAV

What issue do you have?

As a first post here - Hi to everyone !

I have to ask this question and ask for help. Forum does not have this problem and on the github i haven't also find anything related.

Problem:

  • application on the Android phone freezes (interface) when starting the synchronization

Effect:

  • when I am able to open something (note etc.) before the freeze occurs I can browse this note, but all of the remaining interface (menu, buttons) does not work (no action effect)

  • it DOES not occur, when I e.g. select to sync only on wi-fi and then use only gsm network. The interface works OK till I start the synchronization or turn-on the wi-fi switch

  • I'm, using nextcloud/webdav sync method

  • When the application is installed first time everything works OK

  • When I configure the sync method and execute first synchronization everything works OK

  • The problem arises in the next sync run.

  • I have c.a 350 notes (effect of migration from evernote)

  • I think when I've configured joplin first time and configure sync (with only joplin default notes) the sync was working OK.

  • I was trying all options in the sync dialog (thread count etc.) but without any success

I was looking at the logcat on android but nothing substantial occurs. I would like to pinpoint the error and provide more meaningful error description but without any tips I think I cannot do this. I was looking at the code but not found easy way to debug/catch this error. I suppose the android interface is a mix of the native android code and main joplin application wrapped as web view (?). Anyway, long way to understand what's happening.

My take with this problem is that somehow before the synchronization process start, joplin is trying to count (?) prepare (?) anything for the sync and in this process something hangs (browsing through data).

Any tips how can I resolve this error or debug the app to find what casuses this would be very helpful for me.

Thanks !
Slawek

This is "normal", or at least this is how the app currently works. You can't do anything until the initial synchronisation has finished.

Maybe I do not clearly explain the problem. The initial synchronization works OK. But after the synchronization is finished and I close the app, I cannot use the application anymore. The synchronization is stalled on the very beginning causing the interface to freeze. It does not "unfreeze" in meaningful time (I was waiting at least 30 minutes). The interface is not responding.

If I enable the "sync only with wi-fi" mode and turn off the wi-fi the interface is responsible and I can browse through the local (synchronized previously) notes. But whenever I turn the wi-fi (automatic sync started) or click the sync button, the interface freezes again. The sync button shows "Cancel" message so the sync somewhat started but the interface is freezed (not responding). Only the last loaded note can be scrolled (but not edited, nor links inside it works). "Standard" main UI thread lock as in e.g. java swing gui development.

I cannot say more about it. Log inside the application does not show anything meaningful. I can try to debug/find the cause but I (as for now) don't have enough knowledge to enable more diagnostic info or build it myself (android app) to debug it through e.g. android studio. I would like to help find the cause but honestly don't have too much time digging through development env from the ground up myself.

I've found what the problem is. There is no explicit error on Joplin side, but the UI is freezing during note indexing. I'll post the info as a separate ticket on the github project's page.

I've successfully compile and run the app from the source on the android phone.

Problem:

  • i've circa 1500 notes (history from the evernote) and more than 5000 (didn't count) attachments (images etc.)
  • when sync'ing on the mobile the device synchronizes the data for the first time
  • on the next sync application is performing indexing. The indexing in my case take a very long time and during this phase the interface is freezed (ui lock). On Samsung S20FE (Snapdragon 865) the indexing (notes + attachments) take a very long time. I have successfully synchronize only notes and attachments leave on the manual download. The indexing takes some time (didn't count but leave phone always on with priority boost on joplin app) and it finished successfully.
  • next sync is much faster and only a small fraction of tile (ca 0,5-1 sec) the interface is freezed during indexing

With WebDAV it's to be expected since the app needs to parse a giant XML file at the beginning of each sync and this can freeze the app. This is unfortunately the only way to compare what's on the phone and what's on the server, since WebDAV doesn't support delta sync like Joplin Server or Dropbox

I've created the ticket. Of course the source of the problem is better known by you :slight_smile:

Only one issue is that the UI is freezed. Maybe it could be responsive during this process. When I didn't run this on the dev mode, the application for me was "unresponsive" and nothing could be done only to kill the app.

One observation. If you say that this is done at the beginning of each sync, this is contrary to what I observe. Only the first synchronization does have this issue (on that scale). Next synchronization indeed have also UI blocking effect but only for (on my phone) ca. 0,5-1 second. So maybe only the first indexing (sorry, didn't have enough time and knowledge to dig deeper what this means) is taking (with my notes) that long time. Next indexing (because the base index is created earlier) is much faster because (maybe?) app is only indexing changed notes (journal).

One more detail. The first (after the installation) sync is OK. The next (second from the beginning) have this issue. Between the first synchronization and the second the app is performing this indexing. The blocking is happening after these lines.

INFO 21:06:10: Synchronizer: Indexing resources...
INFO 21:06:10: ResourceService::indexNoteResources: Start.

We need the full log though. All I can see here is that there's 0 seconds between these two statements

Ok, I'll try to reproduce it tomorrow. After the second line there is a freeze.

Logs attached on the github issue #9379 (cannot post links).

Ca 7 minutes of indexing with 100% cpu on android emulator, i7 cpu. More in the logs.

Yes but it's the same issue: you need to include in your log whatever lines show the time gap. In that new log, all operations take between 0 and 1 second so there's nothing we can do based on this.

Please bear with me, but I'm talking about this lines in "second.txt" log.

INFO 01:07:13: ResourceService::indexNoteResources: Start
INFO 01:14:35: ResourceService::indexNoteResources: Completed

That's not 1 second but more that 7 minutes.

When this indexing finished next sync's will be like that

INFO 00:52:05: ResourceService::indexNoteResources: Start
INFO 00:52:05: ResourceService::indexNoteResources: Completed

And it's indeed 0-1 second.

Ah, and in this time gap the UI is not responsive.