Bug 335776 - IMAP agent crashes frequently
Summary: IMAP agent crashes frequently
Status: RESOLVED DUPLICATE of bug 338658
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: 4.13
Platform: openSUSE Linux
: NOR crash
Target Milestone: ---
Assignee: Christian Mollekopf
URL:
Keywords: drkonqi
Depends on:
Blocks:
 
Reported: 2014-06-04 06:25 UTC by András Manţia
Modified: 2016-08-03 19:09 UTC (History)
9 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
debug info by dfaure (8.77 KB, text/plain)
2014-09-10 16:53 UTC, Christian Mollekopf
Details

Note You need to log in before you can comment on or make changes to this bug.
Description András Manţia 2014-06-04 06:25:31 UTC
Application: akonadi_imap_resource (4.13)
KDE Platform Version: 4.13.60
Qt Version: 4.8.6
Operating System: Linux 3.11.10-7-desktop x86_64
Distribution: "openSUSE 13.1 (Bottle) (x86_64)"

-- Information about the crash:
Not sure when it happens, most of the time when I come back to my computer, the imap agents are crashed with the attached backtrace. It happens often with KDE master.

The crash can be reproduced sometimes.

-- Backtrace:
Application: MyKolab of type IMAP E-Mail Server (akonadi_imap_resource), signal: Aborted
ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3)0, 0) result 0. Errno: 0
Using host libthread_db library "/lib64/libthread_db.so.1".
[Current thread is 1 (Thread 0x7ff901a50880 (LWP 5118))]

Thread 3 (Thread 0x7ff8e3f93700 (LWP 5123)):
#0  0x00007ff8fc13e99d in read () from /lib64/libc.so.6
#1  0x00007ff8e8d68e41 in ?? () from /usr/lib64/tls/libnvidia-tls.so.331.49
#2  0x00007ff8fb0fe5c0 in ?? () from /usr/lib64/libglib-2.0.so.0
#3  0x00007ff8fb0bf12c in g_main_context_check () from /usr/lib64/libglib-2.0.so.0
#4  0x00007ff8fb0bf59b in ?? () from /usr/lib64/libglib-2.0.so.0
#5  0x00007ff8fb0bf70c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#6  0x00007ff900d0e2f0 in QEventDispatcherGlib::processEvents (this=0x7ff8dc0008e0, flags=...) at kernel/qeventdispatcher_glib.cpp:427
#7  0x00007ff900ccee3b in QEventLoop::processEvents (this=0x7ff8e3f92ce0, flags=...) at kernel/qeventloop.cpp:149
#8  0x00007ff900ccefce in QEventLoop::exec (this=0x7ff8e3f92ce0, flags=...) at kernel/qeventloop.cpp:204
#9  0x00007ff900b94827 in QThread::exec (this=0x28bec30) at thread/qthread.cpp:537
#10 0x00007ff900b949d4 in QThread::run (this=0x28bec30) at thread/qthread.cpp:604
#11 0x00007ff900b972f7 in QThreadPrivate::start (arg=0x28bec30) at thread/qthread_unix.cpp:349
#12 0x00007ff9008d90db in start_thread () from /lib64/libpthread.so.0
#13 0x00007ff8fc14b90d in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7ff8e1016700 (LWP 23216)):
#0  0x00007fffa25fe8d6 in clock_gettime ()
#1  0x00007ff8fc158a0d in clock_gettime () from /lib64/libc.so.6
#2  0x00007ff900c067f2 in do_gettime (sec=0x7ff8e1015978, frac=0x7ff8e1015970) at tools/qelapsedtimer_unix.cpp:127
#3  0x00007ff900c0684f in qt_gettime () at tools/qelapsedtimer_unix.cpp:144
#4  0x00007ff900d108f8 in QTimerInfoList::updateCurrentTime (this=0x7ff8d80011a0) at kernel/qeventdispatcher_unix.cpp:354
#5  0x00007ff900d10cba in QTimerInfoList::timerWait (this=0x7ff8d80011a0, tm=...) at kernel/qeventdispatcher_unix.cpp:460
#6  0x00007ff900d0d5e1 in timerSourcePrepareHelper (src=0x7ff8d8001140, timeout=0x7ff8e1015ab4) at kernel/qeventdispatcher_glib.cpp:136
#7  0x00007ff900d0d787 in timerSourcePrepare (source=0x7ff8d8001140, timeout=0x7ff8e1015ab4) at kernel/qeventdispatcher_glib.cpp:169
#8  0x00007ff8fb0becad in g_main_context_prepare () from /usr/lib64/libglib-2.0.so.0
#9  0x00007ff8fb0bf523 in ?? () from /usr/lib64/libglib-2.0.so.0
#10 0x00007ff8fb0bf70c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#11 0x00007ff900d0e2f0 in QEventDispatcherGlib::processEvents (this=0x7ff8d8001240, flags=...) at kernel/qeventdispatcher_glib.cpp:427
#12 0x00007ff900ccee3b in QEventLoop::processEvents (this=0x7ff8e1015ce0, flags=...) at kernel/qeventloop.cpp:149
#13 0x00007ff900ccefce in QEventLoop::exec (this=0x7ff8e1015ce0, flags=...) at kernel/qeventloop.cpp:204
#14 0x00007ff900b94827 in QThread::exec (this=0x27efde0) at thread/qthread.cpp:537
#15 0x00007ff900b949d4 in QThread::run (this=0x27efde0) at thread/qthread.cpp:604
#16 0x00007ff900b972f7 in QThreadPrivate::start (arg=0x27efde0) at thread/qthread_unix.cpp:349
#17 0x00007ff9008d90db in start_thread () from /lib64/libpthread.so.0
#18 0x00007ff8fc14b90d in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7ff901a50880 (LWP 5118)):
[KCrash Handler]
#6  0x00007ff8fc099849 in raise () from /lib64/libc.so.6
#7  0x00007ff8fc09acd8 in abort () from /lib64/libc.so.6
#8  0x00007ff900b89c60 in qt_message_output (msgType=QtFatalMsg, buf=0x283cae8 "ASSERT failure in createItemSyncInstance: \"Calling items retrieval methods although no item retrieval is in progress\", file /home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/resourceba"...) at global/qglobal.cpp:2359
#9  0x00007ff900b89ddf in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7ff900d56230 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fffa25efb78) at global/qglobal.cpp:2405
#10 0x00007ff900b8a5b1 in qFatal (msg=0x7ff900d56230 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qglobal.cpp:2588
#11 0x00007ff900b8985f in qt_assert_x (where=0x7ff9015b3e02 "createItemSyncInstance", what=0x7ff9015b3db8 "Calling items retrieval methods although no item retrieval is in progress", file=0x7ff9015b3d60 "/home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/resourcebase.cpp", line=174) at global/qglobal.cpp:2062
#12 0x00007ff9014f6ffa in Akonadi::ResourceBasePrivate::createItemSyncInstanceIfMissing (this=0x2854dc0) at /home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/resourcebase.cpp:173
#13 0x00007ff9014f4ecd in Akonadi::ResourceBase::setItemStreamingEnabled (this=0x280bf10, enable=true) at /home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/resourcebase.cpp:1140
#14 0x0000000000422d7a in ImapResource::onItemRetrievalCollectionFetchDone (this=0x280bf10, job=0x2a597d0) at /home/andris/development/sources/kde-trunk/kde/kdepim-runtime/resources/imap/imapresource.cpp:488
#15 0x000000000043f5fc in ImapResource::qt_static_metacall (_o=0x13fe, _c=5118, _id=6, _a=0xffffffffffffffff) at /home/andris/development/build/kde-trunk/kde/kdepim-runtime/resources/imap/moc_imapresource.cpp:125
#16 0x00007ff900cf01d0 in QMetaObject::activate (sender=0x2a597d0, m=0x6a1b00 <KJob::staticMetaObject>, local_signal_index=3, argv=0x7fffa25eff50) at kernel/qobject.cpp:3539
#17 0x00007ff8fcd9fc91 in KJob::result (this=0x2a597d0, _t1=0x2a597d0) at /home/andris/development/build/kde-trunk/kdelibs/kdecore/kjob.moc:207
#18 0x00007ff8fcd9f169 in KJob::emitResult (this=0x2a597d0) at /home/andris/development/sources/kde-trunk/kdelibs/kdecore/jobs/kjob.cpp:318
#19 0x00007ff9014c0393 in Akonadi::JobPrivate::delayedEmitResult (this=0x256ba10) at /home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/job.cpp:165
#20 0x00007ff9014c15ec in Akonadi::Job::qt_static_metacall (_o=0x2a597d0, _c=QMetaObject::InvokeMetaMethod, _id=7, _a=0x296b510) at /home/andris/development/build/kde-trunk/kde/kdepimlibs/akonadi/moc_job.cpp:70
#21 0x00007ff900ce9af9 in QMetaCallEvent::placeMetaCall (this=0x2809f40, object=0x2a597d0) at kernel/qobject.cpp:524
#22 0x00007ff900cead7d in QObject::event (this=0x2a597d0, e=0x2809f40) at kernel/qobject.cpp:1194
#23 0x00007ff8ffad3270 in QApplicationPrivate::notify_helper (this=0x24d1e10, receiver=0x2a597d0, e=0x2809f40) at kernel/qapplication.cpp:4562
#24 0x00007ff8ffad080c in QApplication::notify (this=0x7fffa25f0d50, receiver=0x2a597d0, e=0x2809f40) at kernel/qapplication.cpp:3944
#25 0x00007ff8fd6aca4b in KApplication::notify (this=0x7fffa25f0d50, receiver=0x2a597d0, event=0x2809f40) at /home/andris/development/sources/kde-trunk/kdelibs/kdeui/kernel/kapplication.cpp:311
#26 0x00007ff900cd1b4f in QCoreApplication::notifyInternal (this=0x7fffa25f0d50, receiver=0x2a597d0, event=0x2809f40) at kernel/qcoreapplication.cpp:953
#27 0x00007ff900cd5849 in QCoreApplication::sendEvent (receiver=0x2a597d0, event=0x2809f40) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#28 0x00007ff900cd2b7c in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x249bb80) at kernel/qcoreapplication.cpp:1577
#29 0x00007ff900cd279f in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1470
#30 0x00007ff900d0ea21 in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#31 0x00007ff900d0da2a in postEventSourceDispatch (s=0x24d6ab0) at kernel/qeventdispatcher_glib.cpp:280
#32 0x00007ff8fb0bf316 in g_main_context_dispatch () from /usr/lib64/libglib-2.0.so.0
#33 0x00007ff8fb0bf668 in ?? () from /usr/lib64/libglib-2.0.so.0
#34 0x00007ff8fb0bf70c in g_main_context_iteration () from /usr/lib64/libglib-2.0.so.0
#35 0x00007ff900d0e2cd in QEventDispatcherGlib::processEvents (this=0x24a1ac0, flags=...) at kernel/qeventdispatcher_glib.cpp:425
#36 0x00007ff8ffbacc24 in QGuiEventDispatcherGlib::processEvents (this=0x24a1ac0, flags=...) at kernel/qguieventdispatcher_glib.cpp:204
#37 0x00007ff900ccee3b in QEventLoop::processEvents (this=0x7fffa25f0ca0, flags=...) at kernel/qeventloop.cpp:149
#38 0x00007ff900ccefce in QEventLoop::exec (this=0x7fffa25f0ca0, flags=...) at kernel/qeventloop.cpp:204
#39 0x00007ff900cd21e2 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#40 0x00007ff8ffad03f6 in QApplication::exec () at kernel/qapplication.cpp:3823
#41 0x00007ff9014f11b1 in Akonadi::ResourceBase::init (r=0x280bf10) at /home/andris/development/sources/kde-trunk/kde/kdepimlibs/akonadi/resourcebase.cpp:570
#42 0x0000000000419f43 in Akonadi::ResourceBase::init<ImapResource> (argc=<optimized out>, argv=<optimized out>) at /opt/kde4/include/akonadi/resourcebase.h:193
#43 0x00007ff8fc085be5 in __libc_start_main () from /lib64/libc.so.6
#44 0x0000000000419e05 in _start () at ../sysdeps/x86_64/start.S:122

Reported using DrKonqi
Comment 1 Christian Mollekopf 2014-06-04 08:13:32 UTC
Can you check in the debug output if the online state changed just before it crashed?
You should see a message in doSetOnline ("online=...."),
Comment 2 Christian Mollekopf 2014-09-10 12:09:47 UTC
dfaure reported a disconnect just before a similar crash, so let's assume that's the cause.
This happens due to the CollectionFetchJob that is not aborted on disconnect, so we need to fix that.
Comment 3 Christian Mollekopf 2014-09-10 16:53:10 UTC
Created attachment 88644 [details]
debug info by dfaure

I suppose this version of the crash could be explained if for some reason the the task was killed (although we don't see a disconnect), and the batchfetcher continued afterwards. I.e. the abortActivity codepath disconnects the sessions which in turns triggers cancelTask in ResourceTask (thus ending the task). However, the internal BatchFetcher job continues to run as it only get's deleted once the session is deleted. Further both the session and the task are deleted via deleteLater, meaning the BatchFetcher still gets a chance to issues a signal through the ResourceTask that then triggers itemsRetrieved (resulting in a crash since cancelTask has already been called).
Comment 4 Sergio Martins 2014-09-25 10:45:40 UTC
Similar BT for me

#1  0x00007f34e891cd3a in abort () from /usr/lib/libc.so.6
#2  0x00007f34ed1161c4 in qt_message_output (msgType=QtFatalMsg, 
    buf=0x7f34e0dea818 "ASSERT failure in createItemSyncInstance: \"Calling items retrieval methods although no item retrieval is in progress\", file /data/extra2/sources/kde-master/kde/kdepimlibs/akonadi/resourcebase.cpp, lin"...) at global/qglobal.cpp:2359
#3  0x00007f34ed116343 in qt_message(QtMsgType, const char *, typedef __va_list_tag __va_list_tag *) (msgType=QtFatalMsg, msg=0x7f34ed2e0330 "ASSERT failure in %s: \"%s\", file %s, line %d", ap=0x7fff2719c8f8)
    at global/qglobal.cpp:2405
#4  0x00007f34ed116b15 in qFatal (msg=0x7f34ed2e0330 "ASSERT failure in %s: \"%s\", file %s, line %d") at global/qglobal.cpp:2588
#5  0x00007f34ed115dc3 in qt_assert_x (where=0x7f34edaa97cd "createItemSyncInstance", what=0x7f34edaa9468 "Calling items retrieval methods although no item retrieval is in progress", 
    file=0x7f34edaa9040 "/data/extra2/sources/kde-master/kde/kdepimlibs/akonadi/resourcebase.cpp", line=174) at global/qglobal.cpp:2062
#6  0x00007f34eda1b493 in Akonadi::ResourceBasePrivate::createItemSyncInstanceIfMissing (this=this@entry=0x7f34e0f35cc0) at /data/extra2/sources/kde-master/kde/kdepimlibs/akonadi/resourcebase.cpp:173
#7  0x00007f34eda180ed in Akonadi::ResourceBase::itemsRetrieved (this=<optimized out>, items=...) at /data/extra2/sources/kde-master/kde/kdepimlibs/akonadi/resourcebase.cpp:1166
#8  0x0000000000440745 in RetrieveItemsTask::onItemsRetrieved (this=0x7f34dac07e80, addedItems=...) at /data/extra2/sources/kde-master/kde/kdepim-runtime/resources/imap/retrieveitemstask.cpp:493
#9  0x00007f34ed27c28e in QMetaObject::activate (sender=0x7f34e0ca6480, m=0x478380 <BatchFetcher::staticMetaObject>, local_signal_index=0, argv=0x7fff2719cc00) at kernel/qobject.cpp:3567
#10 0x0000000000457b80 in BatchFetcher::itemsRetrieved (this=this@entry=0x7f34e0ca6480, _t1=...) at /data/extra2/sources/kde-master/build/kde/kdepim-runtime/resources/imap/moc_batchfetcher.cpp:111
#11 0x000000000045c399 in BatchFetcher::onHeadersReceived (this=0x7f34e0ca6480, mailBox=..., uids=..., sizes=..., attrs=..., flags=..., messages=...)
    at /data/extra2/sources/kde-master/kde/kdepim-runtime/resources/imap/batchfetcher.cpp:188
#12 0x00000000004588f3 in BatchFetcher::qt_static_metacall (_o=0x5af3, _c=23283, _id=6, _a=0xffffffffffffffff) at /data/extra2/sources/kde-master/build/kde/kdepim-runtime/resources/imap/moc_batchfetcher.cpp:60
#13 0x00007f34ed27c28e in QMetaObject::activate (sender=0x7f34d64e4c60, m=0x6a5b40 <KIMAP::FetchJob::staticMetaObject>, local_signal_index=1, argv=0x7fff2719ce80) at kernel/qobject.cpp:3567
#14 0x00007f34eb8ddf73 in KIMAP::FetchJob::headersReceived (this=0x7f34d64e4c60, _t1=..., _t2=..., _t3=..., _t4=..., _t5=..., _t6=...)
    at /data/extra2/sources/kde-master/build/kde/kdepimlibs/kimap/moc_fetchjob.cpp:137
#15 0x00007f34eb8e2f91 in KIMAP::FetchJobPrivate::emitPendings (this=0x7f34e0fd3740) at /data/extra2/sources/kde-master/kde/kdepimlibs/kimap/fetchjob.cpp:71
#16 0x00007f34eb8df817 in KIMAP::FetchJob::handleResponse (this=0x7f34d64e4c60, response=...) at /data/extra2/sources/kde-master/kde/kdepimlibs/kimap/fetchjob.cpp:286
#17 0x00007f34eb8ef2e0 in KIMAP::SessionPrivate::responseReceived (this=0x7f34e0e8f3c0, response=...) at /data/extra2/sources/kde-master/kde/kdepimlibs/kimap/session.cpp:300
#18 0x00007f34ed275bdb in QMetaCallEvent::placeMetaCall (this=0x7f34d65112e0, object=0x7f34e0e8f3c0) at kernel/qobject.cpp:524
#19 0x00007f34ed276e5f in QObject::event (this=0x7f34e0e8f3c0, e=0x7f34d65112e0) at kernel/qobject.cpp:1222
#20 0x00007f34ec0c04dc in QApplicationPrivate::notify_helper (this=0x7f34e0c4e380, receiver=0x7f34e0e8f3c0, e=0x7f34d65112e0) at kernel/qapplication.cpp:4562
#21 0x00007f34ec0bda78 in QApplication::notify (this=0x7fff2719dfb0, receiver=0x7f34e0e8f3c0, e=0x7f34d65112e0) at kernel/qapplication.cpp:3944
#22 0x00007f34e9e44551 in KApplication::notify (this=0x7fff2719dfb0, receiver=0x7f34e0e8f3c0, event=0x7f34d65112e0) at /data/extra2/sources/kde-master/kde/kdelibs/kdeui/kernel/kapplication.cpp:311
#23 0x00007f34ed25dd03 in QCoreApplication::notifyInternal (this=0x7fff2719dfb0, receiver=0x7f34e0e8f3c0, event=0x7f34d65112e0) at kernel/qcoreapplication.cpp:953
---Type <return> to continue, or q <return> to quit---
#24 0x00007f34ed2619fd in QCoreApplication::sendEvent (receiver=0x7f34e0e8f3c0, event=0x7f34d65112e0) at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:231
#25 0x00007f34ed25ed30 in QCoreApplicationPrivate::sendPostedEvents (receiver=0x0, event_type=0, data=0x7f34e0c35080) at kernel/qcoreapplication.cpp:1577
#26 0x00007f34ed25e953 in QCoreApplication::sendPostedEvents (receiver=0x0, event_type=0) at kernel/qcoreapplication.cpp:1470
#27 0x00007f34ec18d9f1 in QCoreApplication::sendPostedEvents () at ../../include/QtCore/../../src/corelib/kernel/qcoreapplication.h:236
#28 0x00007f34ec199577 in QEventDispatcherX11::processEvents (this=0x7f34e0c37130, flags=...) at kernel/qeventdispatcher_x11.cpp:75
#29 0x00007f34ed25b0ad in QEventLoop::processEvents (this=0x7fff2719df10, flags=...) at kernel/qeventloop.cpp:149
#30 0x00007f34ed25b240 in QEventLoop::exec (this=0x7fff2719df10, flags=...) at kernel/qeventloop.cpp:204
#31 0x00007f34ed25e396 in QCoreApplication::exec () at kernel/qcoreapplication.cpp:1225
#32 0x00007f34ec0bd662 in QApplication::exec () at kernel/qapplication.cpp:3823
#33 0x00007f34eda16513 in Akonadi::ResourceBase::init (r=r@entry=0x7f34e0ea5d60) at /data/extra2/sources/kde-master/kde/kdepimlibs/akonadi/resourcebase.cpp:579
#34 0x0000000000419abe in Akonadi::ResourceBase::init<ImapResource> (argc=<optimized out>, argv=<optimized out>) at /data/extra2/installation/kde-masterd/include/akonadi/resourcebase.h:193
#35 0x00007f34e8908040 in __libc_start_main () from /usr/lib/libc.so.6
#36 0x000000000041992b in _start ()
Comment 5 Daniel Vrátil 2014-09-25 13:14:33 UTC
I discovered one of the possible causes of the crash:

In ItemSync, when the ItemCreateJob fails, the TransactionSequence is rolled back and ItemSync emits finished() - to which ResourceBase reacts by marking the task as done and scheduling another task. However the BatchFetcher in IMAP resource is not aware of this and keeps feeding more items through ResourceBase::itemsRetrieved() - which eventually hits the assert in ResourceBase, because ResourceBase has already moved on to another non-sync task.

Not sure how to solve this - ItemSync is internal to ResourceBase, so there's no way how to tell resource implementation that ItemSync has failed and so that they should stop sending more items. Good-enough fix would probably be to make TransactionSequence in ItemSync to ignore ItemCreateJob failures and handle the error manually (somehow) and continue, or just abort, but let the caller to feed ItemSync all its items (just do nothing with them) and then terminate - i.e. prevent ItemSync for ever aborting prematurely. Proper fix would be to make Sync a cancellable operation, so that we can tell resource to stop feeding ResourceBase with items because there was an error.


Regarding the reasons for ItemCreateJob failure: in my case this was happening because somehow I had two items with the same RID in one Collection (probably the RID wasn't reset during MOVE or something), so MERGE handler will abort with "Multiple merge candidates" error and so the ItemCreateJob fails.
Comment 6 Christian Mollekopf 2014-09-25 17:39:40 UTC
(In reply to Daniel Vrátil from comment #5)
> I discovered one of the possible causes of the crash:
> 
> In ItemSync, when the ItemCreateJob fails, the TransactionSequence is rolled
> back and ItemSync emits finished() - to which ResourceBase reacts by marking
> the task as done and scheduling another task. However the BatchFetcher in
> IMAP resource is not aware of this and keeps feeding more items through
> ResourceBase::itemsRetrieved() - which eventually hits the assert in
> ResourceBase, because ResourceBase has already moved on to another non-sync
> task.
> 

Interesting, I actually checked this codepath and though it's fine.
ItemSync::slotResult is supposed to handle this case by silently ignoring errors and continuing anyways. I take that somehow doesn't work then?

> Not sure how to solve this - ItemSync is internal to ResourceBase, so
> there's no way how to tell resource implementation that ItemSync has failed
> and so that they should stop sending more items. 

Just as we can ask for more items, we should also be able to signal that the task was aborted.
But it's in any case a mess to pass this through the current API, so I'd prefer to postpone that for a new API.

>Good-enough fix would
> probably be to make TransactionSequence in ItemSync to ignore ItemCreateJob
> failures and handle the error manually (somehow) and continue, or just
> abort, but let the caller to feed ItemSync all its items (just do nothing
> with them) and then terminate - i.e. prevent ItemSync for ever aborting
> prematurely. Proper fix would be to make Sync a cancellable operation, so
> that we can tell resource to stop feeding ResourceBase with items because
> there was an error.
> 

I'm for simply continuing with the sync.

> 
> Regarding the reasons for ItemCreateJob failure: in my case this was
> happening because somehow I had two items with the same RID in one
> Collection (probably the RID wasn't reset during MOVE or something), so
> MERGE handler will abort with "Multiple merge candidates" error and so the
> ItemCreateJob fails.

Something to investigate.
Comment 7 Luis Silva 2016-08-03 19:09:39 UTC

*** This bug has been marked as a duplicate of bug 338658 ***