Bug 305987 - "Could not create collection" when adding new top-level mailbox for IMAP account:
Summary: "Could not create collection" when adding new top-level mailbox for IMAP acco...
Status: RESOLVED WORKSFORME
Alias: None
Product: Akonadi
Classification: Frameworks and Libraries
Component: IMAP resource (show other bugs)
Version: GIT (master)
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Christian Mollekopf
URL:
Keywords:
: 295024 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-08-29 13:04 UTC by Nick Leverton
Modified: 2014-02-20 18:50 UTC (History)
11 users (show)

See Also:
Latest Commit:
Version Fixed In: 4.10.2


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Nick Leverton 2012-08-29 13:04:04 UTC
To reproduce: 

Configure an IMAP resource (doesn't seem to matter whether online or disconnected,   This issue occurs with both Exchange IMAP and Dovecot IMAP).

Right click on the account's top-level folder and choose "Add folder"

Expected result:

New mailbox is created on the IMAP server and on the local resource.

Actual result:

New folder is created on the IMAP server but does not appear locally.  Akonadi repeatedly gives an error "Could not create collection".

Akonadi error log contains repeated entries :
Error during executing query "INSERT INTO CollectionTable (remoteId, remoteRevision, name, parentId, resourceId, cachePolicyInherit) VALUES (:0, :1, :2, :3, :4, :5)" :  "Duplicate entry '189-DovecotTopLevel' for key 'CollectionTable_parentAndNameIndex' QMYSQL3: Unable to execute statement" 

the 189 and the DovecotTopLevel string obviously vary depending on parent ID and name of created mailbox.




Reproducible: Always
Comment 1 Laurent Montel 2012-08-31 06:53:40 UTC
Ok tree list is not refreshing.
When we recreate account it's here.
ok
Comment 2 Luis Silva 2012-09-11 12:54:30 UTC
I can confirm this bug exists in master d911ba6
Comment 3 Myriam Schweingruber 2012-09-11 13:07:44 UTC
Setting status to confirmed.
Comment 4 Torsten Eichstädt 2012-10-10 18:59:04 UTC
KMail tries to create IMAP folder that already exists over and over again.
Error message: "<Account name>: Could not create collection <folder name> resourceld: 7"

Before I created the folder online on the web interface of my IMAP account, the error message was similar when I tried to create the folder, at least it also said 'resourceld'.  But when I was on the web interface, I saw a folder ceated with a ' 1' (blank, one) appended.

The IMAP server of my provider seems to be home grown, it says
'* OK IMAP server ready H miweb105 92345'

Maybe this can help you to find the error..
Comment 5 Tim Ruffing 2012-10-21 14:58:29 UTC
I can confirm that. Note that creating a subfolder of a folder works, only creating a folder at top level fails.
A workaround is to remove and recreate the account.
Comment 6 Luis Silva 2013-01-28 11:18:18 UTC
*** Bug 295024 has been marked as a duplicate of this bug. ***
Comment 7 Luis Silva 2013-01-28 11:21:52 UTC
Recreating the account is not a valid workaround, especially for large accounts. 
It is also not a permanent solution as creating new folders trigers this bug again.
Comment 8 Nick Leverton 2013-03-07 18:03:12 UTC
Still happening in 4.10.0, I'm afraid.
Comment 9 András Manţia 2013-03-28 21:45:46 UTC
Git commit d8fd7a28e7d6d8a89dd398311d423118ff529718 by Andras Mantia.
Committed on 28/03/2013 at 22:45.
Pushed by amantia into branch 'KDE/4.10'.

1) Fix creation of new toplevel folders (and all its subfolder): it used to generate a broken remote id and separtor ("i") causing weird problems.
2) Make sure toplevel imap folders are shown immediately, without a need to sync the account (workarounds an ETM bug 291143)
3) Warn the user if creating a folder failed on server-side and remove the folder locally. Otherwise if creation failed, it was impossible to create again a folder with the same name,
as it was already a folder with that name in the akonadi cache...
4) Make sure deleting folder "foo" doesn't deleted all folders starting with "foo" as it did before.
5) Just fix folder deletion. :) It could fail in certain cases.
6) Fix and adapt the tests.

Reporters of closed bugs: if you can still see the bug in 4.10.2, please reopen and state the details.

REVIEW: 109276
FIXED-IN: 4.10.2291143291143
Related: bug 312435, bug 305269, bug 301088, bug 292418, bug 291143

M  +6    -1    resources/imap/addcollectiontask.cpp
M  +1    -1    resources/imap/changecollectiontask.cpp
M  +16   -0    resources/imap/imapresource.cpp
M  +7    -0    resources/imap/imapresource.h
M  +11   -8    resources/imap/removecollectionrecursivetask.cpp
M  +1    -0    resources/imap/removecollectionrecursivetask.h
M  +10   -0    resources/imap/resourcetask.cpp
M  +2    -0    resources/imap/resourcetask.h
M  +4    -1    resources/imap/tests/dummyresourcestate.cpp
M  +7    -5    resources/imap/tests/testremovecollectiontask.cpp

http://commits.kde.org/kdepim-runtime/d8fd7a28e7d6d8a89dd398311d423118ff529718
Comment 10 meyerm 2013-07-22 09:32:44 UTC
Unfortunately, I still see this bug in KMail 4.10.5.

- Creating a folder via webinterface works, the folder is not shown in KMail or the Akonadiconsole, it IS shown in the webinterface.
- Creating a folder via KMail works, the folder is not shown in KMail, it IS shown in the Akonadiconsole and the webinterface.
- Creating a folder in Akonadiconsole works, the folder is not shown in KMail, it IS shown in the Akonadiconsole and the webinterface.
Comment 11 Chao Feng 2013-07-24 14:09:25 UTC
Same issue here. But it show up after I restart Kmail. Is this happen to you too?
Comment 12 Kevin Ottens 2013-11-16 07:28:48 UTC
The IMAP resource has a new maintainer, reassigning to him.
Comment 13 Christian Mollekopf 2014-02-20 14:29:57 UTC
Please reopen if you can reproduce this with kdepim >= 4.11.3
Comment 14 meyerm 2014-02-20 18:50:39 UTC
Just tried out my testcase #2 with 4.12.2. Same result (folder is created, shown in akonadi console but not in KMail).