Syncing with unreachable servers eats battery



  • Hi,
    Davdroid (latest version from fdroid) works like a charm apart from one issue:
    It has battery eating wakelocks when using periodic sync.

    I have two servers I want to sync with, one at home and the other at the office. So naturally at max one of them is available or while on the road none.
    When I switch on periodic sync (every 2h), this results in partial wakelocks from davdroid leading the list (as checked with BetterBatteryStats).

    So for now I sync manually, but ideally I would like to sync automatically under the hood.
    No idea about the internal architecture, but would it be possible to change the way servers are contacted to make it less battery/resource intensive for unreachable servers?

    thx
    afx


  • developer

    It has battery eating wakelocks when using periodic sync.

    DAVdroid doesn't have any wakelocks. Synchronization is initiated by Android's ContentResolver and DAVdroid's sync adapter is only called passively.

    No idea about the internal architecture, but would it be possible to change the way servers are contacted to make it less battery/resource intensive for unreachable servers?

    For unreachable servers, DAVdroid reports the I/O error back to Android, which tries again in a few minutes (because it assumes the connection is only disabled temporarily, for instance because you have just entered a tunnel without mobile network). I guess those retries are the source of your problem, but I don't have an idea what to do in this case.



  • Drat...
    Looks like there is no easy solution ;-(

    Can you influence the retry strategy?

    Another idea would be to limit periodic sync to known networks, so that a specific configuration works only when the phone's wifi address matches a pattern.

    thx
    afx


  • developer

    @afx said:

    Can you influence the retry strategy?

    Not that I know.

    Another idea would be to limit periodic sync to known networks, so that a specific configuration works only when the phone's wifi address matches a pattern.

    I guess that would be the best approach.



  • @rfc2822 said:

    Another idea would be to limit periodic sync to known networks, so that a specific configuration works only when the phone's wifi address matches a pattern.

    I guess that would be the best approach.

    Please! ;-)

    I'll play guinea pig.

    thx
    afx


  • developer

    Has been implemented in 6ffa6fa9a75104aad4a7305ac8715e6f6793dfce and will be available with DAVdroid 1.0.6.


  • developer

    Please check whether it works with 1.0.6 (available now).



  • Already installed ;-)
    I'll report back how it works. So far I see nothing in the battery stats which is already good!
    I assume only one AP/SSID per sync account can be used?

    thx
    afx


  • developer

    @afx said:

    I assume only one AP/SSID per sync account can be used?

    Yes.



  • Everything has been fine and working as it should until today.
    Now I get connection errors for my home server while I am at the office. Which should not happen according to the SSID restrictions. (I've sent one of the error notification in).
    I turned on the log, hopefully that will reveal something.

    cheers
    afx


  • developer

    Connection errors with notifications? I/O errors should be soft errors without notification. Please describe the details of your connection errors and send debug info and logs.



  • @rfc2822 said:

    Connection errors with notifications? I/O errors should be soft errors without notification. Please describe the details of your connection errors and send debug info and logs.

    Where should I send the logs to?
    I've started the log after my last post and now I got the error again, so I hope it contains something useful.

    I am at the office WLAN and/or GSM connectivity and I get the connection error notifications. When I look at them they are about a connection to the home server which should never be attempted according to the SSID restriction.

    cheers
    afx


  • developer

    Please post them here. I'll have another look at the code and try the SSID restriction myself, but the whole problem sounds strangeā€¦

    Are you sure that you have set the SSID restriction for all applicable accounts? It's a per-account setting.



  • Here you go, all logs since I switched it on yesterday:
    0_1460445515138_davdroid-connection-error.zip

    What is even more strange, I only get it on my home account, but not on my office account (which uses SoGO).
    And I even get it while I am in my home network (with the Synology Caldav server).
    But manual sync in my home net works just fine.

    cheers
    afx



  • I just realized where the error comes from.
    There was still a sync account configured via Caldavsync, I just did not realize that the error message came from this other sync account. No idea why it tried to sync as it was not set up to do so automatically.
    I am sorry for the mess, I just deleted that account.

    cheers
    afx


  • developer

    @afx Thanks for the update. I have flagged this topic as solved, as it seems to work :)


Log in to reply
 

Looks like your connection to Bitfire App Forums was lost, please wait while we try to reconnect.