Events are being duplicated



  • Hi rfc2822,

    I know it’s a developer’s nightmare but Kuba stated correctly. IT HAPPENS RANDOMLY.

    I’ve deleted my recent duplicates and recreated the event exactly as before.
    But the duplication didn’t take place this time.

    But the problem REALLY EXISTS and as Kuba confirms, it’s not just the fault of my sh**ty LG phone still waiting for Android 7…

    Is there any way I can inspect the calendar storage since the problem seems to come from the way davdroid uses this layer? (Remember: I can make the problem go away be deleting all the calendar storage data and resyncing).

    Tobias



  • I’ve recently switched to an old S2 with Android 7 (thanks, LineageOS!) and haven’t experienced the issue since. Not sure if it’s the case of OS or phone model now.


  • developer

    @benjamin-kwiatek said in Events are being duplicated:

    Is there any way I can inspect the calendar storage since the problem seems to come from the way davdroid uses this layer? (Remember: I can make the problem go away be deleting all the calendar storage data and resyncing).

    The best approach I know is to have DAVdroid logs on all the time and wait for some duplication, and then graze through all the logs.

    You can also query the calendar storage by various methods. If you have a rooted phone, you can fetch the whole DB. Or you can do adb shell and then query the provider like content query --uri content://com.android.calendar/calendars (requires USB debugging active). You can view

    • content query --uri content://com.android.calendar/calendars
    • content query --uri content://com.android.calendar/events
    • Instances

    etc.



  • I have the same problem since a while running my own DaviCal server.

    Until today I thought that the problem is related to the S-Planner app. But with the last update of DavDroid S-Planner crashes nearly on every operation, so I switched to DigiCal. But the duplicated entries remains.

    The duplications in my case only appear on birthdays (which is 95% of my repeated events).
    About 20% of the birthdays are not duplicated
    About 50% of the birthdays are twice
    About 30% of the birthdays are triple

    Desktop applications (like Thunderbird Lightning or Apple Calendar) does not show this behaviour.



  • @transeuropa

    Even more annoying is that my adressbook has since the same time also duplicated entries.


  • developer

    I have seen this problem when using Evolution and just reproduced an Evolution bug for recurring events.

    Have you used other clients to edit the affected events? Which clients? Is this reproducible? Have you had a look at the .ics to see whether they are correct?

    Please post the .ics of events for the duplicated events. We need much more info!



  • Hi there,

    recurring events may be additionally problematic. But as I’ve said: the problem is with plain single events.

    However, I do use Android (Business calendar for that matter) and iCal on the Mac (nowadays just called Calendar) interchangeably to create and update my events.

    But I have tried all the possible combinations (creation here, alteration there, etc and vice versa) for the event that had duplicated itself before. But I could not reproduce the problem.

    I suspect the bug is a little more subtle…

    Gruß Tobias



  • For some reason I am no longer affected by this issue, I didn’t change anything backend-wise. Hope the others experiencing this problem will find a fix!





  • @kuba-orlik

    Are you actively removed the duplicated entries and make them new or did the duplications disappeared automatically?



  • @transeuropa I dropped my old phone into a river. I’ve switched to a different device and I’m not experiencing the issue afterwards.

    Not a strategy I’d recommend trying out, though.



  • @kuba-orlik

    well, not an option for me 😨
    anyway - throwing the phone into a river does not alter the ics entries within the database - therefore I doubt that an invalid entry is the culprit. Probably it is related to caching of DavDroid?

    Harald



  • I’ve just now noticed that one of my repeating events got duplicated. Seems like my river strategy didn’t pay off 😞

    So I confirm this issue exists on Android 7.

    What’s interesting is that if I delete a single instance of the event, the other (duplicated) one disappears as well.


  • developer

    @kuba-orlik Would be interesting which device you now have. As said above, we need much more information. Every information we can get, because we have too little information to find the cause of your problem.

    I also guess that you didn’t switch server, so for me it sounds like that could be related to your server… especially when considering that most people (including myself, using DAVdroid every day) don’t have that problem. But who knows, without logs and reproducing we won’t find it out.



  • @rfc2822

    I have now found time to try your adb-shell suggestion on a duplicate event.

    There are only 2 differing fields: modified_time and _id.
    I have marked them yellow in the attached pdf.

    Gruß Tobias

    0_1504353653520_Duplicate event.pdf



  • @rfc2822 My device is Samsung S2 (i9100). I confirm that I haven’t switched the server.



  • Guys, I honestly think that leads in the wrong direction because I did switch servers (from nextcloud to Apple icloud).
    I’ve had the same issue with both servers.

    To me, the most logical explanation would be that the bug is in the communication between davdroid and calendar storage.
    Something like davdroid asking „Is there an event with the following properties?“ and calendar storage getting the lookup wrong answering „No, I don’t have an event like this. I’ll just create a new one“.

    I provided all the properties of a duplicate events yesterday. I would suspect that there’s some problematic property that causes the lookup (you’re probably doing an SQL select, aren’t you?) to fail…

    Gruß Tobias



  • I just checked the state of the mobile phone of my wife which is using the same calendar as I do concerning the birthdays and - SURPRISE - she’s not affected at all, neither a duplicated nor a triple entry, like I described in the .ics examples above.

    We are using both:

    • Android 7.0
    • DavDroid 1.7.2
    • same history (using S-Planner until DavDroid 1.7)

    The difference is:

    • She have a Samsung Galaxy S6
    • I have a Samsung Galaxy S7 Edge (with external storage if that does matter?)
      and I’m 99% sure that I was not affected in the past when I used a Samsung Galaxy S6 Edge.

    Regards,
    Harald



  • Hi @rfc2822,

    finally I’ve got the logs for a duplicate event. It took a while for one to show up after I turned on debugging.

    What I did was:

    1. download all the log from my mobile to my computer.
    2. grep for which log files contain the event id (just one file)
    3. read that log file and delete all the lines that have to do with other calendars (the duplicate event is in calendar #5).
    4. delete lines to do with other events
    5. delete lines to do with net.fortuna.ical4j.model.Recur (too many).

    This leaves
    0_1504821641078_log.txt

    From what I understood, the event is first uploaded to iCloud and then after a minute or so, downloaded as changed again.

    I hope you can really fix the problem now. It’s totally annoying.

    LG Tobias

    PS: The two events again only differ in modified_time and _id:

    0_1504822118093_Duplicate-Event.pdf


  • developer

    @benjamin-kwiatek Thanks for the logs. What I can see:

    1. DAVdroid finds a new event and assigns file name and UID dd100933-7e4e-4b08-bd65-e36b9e3e2161.ics.
    2. DAVdroid uploads dd100933-7e4e-4b08-bd65-e36b9e3e2161.ics. The server accepts the file (201 Created), but does not return an ETag – which is OK, but implies that DAVdroid will have to download the event again in order to get a well-defined state with ETag. This is usual for various servers, well-tested and shouldn’t cause any problems.
    3. DAVdroid requests the list of events, and finds dd100933-7e4e-4b08-bd65-e36b9e3e2161.ics has ETag "C=2994@U=7c3254a4-7d84-4430-ad67-1eaa094b814c" on the server, so it will be downloaded.
    4. DAVdroid downloads dd100933-7e4e-4b08-bd65-e36b9e3e2161.ics, parses it and updates it in the database:
    2017-08-27 12:54:30 2 [syncadapter.CalendarSyncManager] Updating dd100933-7e4e-4b08-bd65-e36b9e3e2161.ics in local calendar
    2017-08-27 12:54:30 2 [ical4android.AndroidEvent] Built event object
    	PARAMETER #0 = mType: 1, mUri: content://com.android.calendar/events?account_name=meine.adresse%40gmail.com&account_type=bitfire.at.davdroid&caller_is_syncadapter=true&account_name=meine.adresse%40gmail.com&account_type=bitfire.at.davdroid&caller_is_syncadapter=true, mSelection: null, mExpectedCount: null, mYieldAllowed: false, mValues: eventTimezone=Europe/Berlin title=XXX availability=0 eventStatus=1 dtend=1504386000000 hasAttendeeData=1 allDay=0 dtstart=1504375200000 calendar_id=5 eventEndTimezone=Europe/Berlin, mValuesBackReferences: null, mSelectionArgsBackReferences: null
    2017-08-27 12:54:30 2 [ical4android.BatchOperation] Committing 3 operations …
    2017-08-27 12:54:30 2 [ical4android.BatchOperation] Running operations 0 to 2
    2017-08-27 12:54:30 2 [ical4android.BatchOperation] … 2 record(s) affected
    

    The update process consists of deleting the previous event, deleting the exceptions (in this case: none), and then inserting the event again. So these are 3 operations (delete, delete, insert) with 2 affected rows (original event, new event).

    The inserted event is OK, doesn’t cause any errors and is only inserted once.

    I really can’t see any problem …


 

Maybe you're interested in these topics?

  • 4
  • 6
  • 31
  • 4
  • 4