konradrenner / kolabnotes-android

Note taking app with integrated Kolab sync
GNU Lesser General Public License v3.0
68 stars 17 forks source link

CommandFailedException: A1 NO Permission denied #80

Closed grote closed 8 years ago

grote commented 9 years ago

When I try to add my Kolab account, many (>100) IMAP connections established to my server. The interval is maybe every second one connection.

This goes on for some time and when it stops, I get a notification: CommandFailedException: A1 NO Permission denied

Is there any way to get more debug information, maybe the IMAP conversation?

konradrenner commented 9 years ago

Do you have this problem just since the latest version of the app? Are shared folders enabled for sync with this account?

konradrenner commented 9 years ago

Some logging is done here: org.kore.kolabnotes.android.async.KolabSyncAdapter I defenitly have to add more logging :-(

grote commented 9 years ago

I didn't use the app productively until now, so I can't talk about previous versions. Shared folders are enabled. I setup the app for another person who has an account on my server and there, this problem does not exist. So the app must be trying something in IMAP where it does not have the permission to in my folder/ACL setup.

Maybe I can convince my IMAP server somehow to log the conversation to find out where the problem is.

grote commented 9 years ago

Alright, so it turns out protocol logging in Cyrus IMAP is very easy. Syncing my account takes a long time (5min until fail), because your app seems to do an EXAMINE on all folders very slowly and I have plenty. It looks like each EXAMINE command is done within a new connection, but I could be wrong here. I am no IMAP expert, but wouldn't it be enough to do a GETANNOTATION to find the Notes folders?

The NO Permission denied error comes right after the app tries to examine a folder that I have not subscribed at the moment. But the subscription is not the problem, but limited access rights. For some reason, I myself don't have all rights on the problematic folder. IMHO, the app should just ignore this and go on instead of failing the entire sync.

I will try fixing the permissions and then get back to you if that helped, but it most likely will.

Also, when the sync fails, it looks like it succeeded. The date of the last sync is even updated. In the Accounts Settings, there is no indication of a problem.

konradrenner commented 9 years ago

Thanks for your analysis. I see the point. The problem are the shared folders because the app does not scan all folders if this feature is disabled, but if it is enabled it has to check every folder, if there are notes in there (sadly I don't know a way how to check if a folder is a shared or notes folder without annotation checking, if the feature of shared folders is disabled, just the given root folder is checked).

The connection is opened just once, but the command is sent many times (this is the way Java Mail works).

The sync time is tricky because it is set from Android itself. I will look if I can do something there.

I don't know if it is a good idea to "ignore" sync errors in general, would it be ok for you, if just the "no permission" errors are ignored (of course a notification will be presented)?

grote commented 9 years ago

I don't think that you should ignore all IMAP command errors, but this one in particular you should. If you want to show a notification, it would be nice if it included the folder name of the folder that has insufficient permissions.

After fixing the permissions, the sync now completed successfully. However, I have a second top-level notes folder with a different name than 'Notes'. Your app did not find this Notebook. However, the other person I shared this folder with sees it in the app.

I'd still be interested to know why you need to call EXAMINE on all folders. This seems to be what causes the sync to take several minutes here. The GETANNOTATION calls succeed very fast within one imapd process.

konradrenner commented 9 years ago

The EXAMINE thing is intersseting, I will look why Java Mail is using it that intensive.

If you have another root folder for notes, you have to create another account and specify the Name of the folder in the account settings in the field "root folder" or "Wurzelordner" depending on your locale.

So in this issue there are 2 things, which I will look on: 1. why is Java Mail doing this EXAMINE so often

  1. just inform an user if he has no permissions for an operation on a folder instead of failing the sync

I already have seen the other issue and will check what the problem is ;-)

grote commented 9 years ago

Thanks! I will do the second account, but normally I would expect Kolab Notes to find all Notebooks even if they are not subfolders of 'Notes'.

This issue is only about the permission denied error, so I created a new one for the EXAMINE slowness. If you want, there could be another one for finding all Notebooks.

Thanks for your great work on this app! :)

konradrenner commented 9 years ago

The EXAMINE issue will be handled with issue #82

konradrenner commented 9 years ago

The concept of specifying root folders is kind of important for me because I think it is nice if you could specify different sync intervalls for different folders and have a separation in the navigation drawer for them. Also I don't want to sync every folder on the smartphone, I have dedicated folders for work, private, etc.

grote commented 9 years ago

I think the concept of specifying root folders is not very intuitive. At least it wasn't for me and I doubt for non-technical users it is. Wouldn't it be better to show a list/tree of notebooks during account creation and let the user choose the ones she wants to have within this account?

konradrenner commented 9 years ago

This is a real good idea. I could imagine a solution like Kontact does with IMAP folders: "select server abonnoment". Maybe you can open another issue? This would defenitly an enhancement.

grote commented 9 years ago

Done in #83.

konradrenner commented 9 years ago

@grote thank you for providing such an awesome open source groupware server! Thanks to the open documentation I was able to create this app! Hopefully this app is another puzzle stone to make Kolab the most attractive alternative to proprietary groupware solutions ;-)

konradrenner commented 8 years ago

Starting with version 1.1.0 there will be a dedicated notification for the "no permission" exception and the sync will not fail completley, just the notebook where it appears