<?xml version="1.0" encoding="UTF-8"?> 
<?xml-stylesheet href="https://dev.horde.org/themes/horde//default/feed-rss.xsl" type="text/xsl"?> 
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"> 
 <channel> 
  <title>mailbox listing speed-up (IMAP_Tree rewrite)</title> 
  <pubDate>Sun, 05 Apr 2026 19:21:54 +0000</pubDate> 
  <link>https://bugs.horde.org/ticket/6972</link> 
  <atom:link rel="self" type="application/rss+xml" title="mailbox listing speed-up (IMAP_Tree rewrite)" href="https://bugs.horde.org/ticket/6972/rss" /> 
  <description>mailbox listing speed-up (IMAP_Tree rewrite)</description> 
 
   
   
  <item> 
   <title>After our recent horde/imp upgrade at umich, we&#039;ve seen logi</title> 
   <description>After our recent horde/imp upgrade at umich, we&#039;ve seen login times rise

from ~5-10 seconds to ~10-30 seconds.   The bulk of this time is spent

building the mailbox list in IMP_Tree (imp/lib/IMAP/Tree.php).  We&#039;ve

made some changes which dramatically reduce the IMP_Tree startup time

and would love some feedback and basic sanity checking before we move

forward with them.



On an unloaded test server in our environment, imap_getmailboxes and

imap_list commands can take up to 1.7 seconds each against our Cyrus system.



First, IMP_Tree calls imap_getmailboxes for each namespace with a %

appended to get one level deep of subfolders. 



Second, IMP_Tree::_initSubscribed executes imap_list for each namespace

with an * appended to get all sublevels of folders.



Last, it recursively crawls each folder found during the first set of

imap_getmailboxes and calls imap_getmailboxes on each folder with %

again until all branches have been plumbed.



Our improvements are premised on the fact that one level searches (%)

and searches which return full trees of results (*) actually take the

same time to return from Cyrus.  So we are bypassing all other searches

and starting off with one single full (*) search from the root of the

user&#039;s mailbox.



One quirk we had to side step then was that % searches will return

objects for folders which have children that can&#039;t be directly accessed

themselves.  The * search will not.



So we just iterate through the php data structure and detect parentless

children and fake up an object for them.  Then, if tree_view is turned

on, we separate non-personal mailboxes into  IMPTREE_OTHER_KEY and

IMPTREE_SHARED_KEY.



Since the list of folders at this point has all the children, we bypass

the recursive calls to expand. 

</description> 
   <pubDate>Tue, 24 Jun 2008 19:49:09 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46775</link> 
  </item> 
   
  <item> 
   <title>Works okay for me so far.</title> 
   <description>Works okay for me so far.</description> 
   <pubDate>Wed, 25 Jun 2008 04:18:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46788</link> 
  </item> 
   
  <item> 
   <title>I&#039;ve been working on this for about a week now.  The patch h</title> 
   <description>I&#039;ve been working on this for about a week now.  The patch has the right idea, but there is a boatload of code that needs to be taken out (10 KB so far) and there are several bugs not covered by this patch.  Additionally, I am looking at not storing polled, subscribed, and unsubscribed information in separate lists to reduce session size even more (the data will be rebuilt from the tree).</description> 
   <pubDate>Wed, 25 Jun 2008 04:38:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46789</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?r1=1.187&amp;r2=1.188&amp;ty=u</description> 
   <pubDate>Wed, 25 Jun 2008 18:20:06 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46812</link> 
  </item> 
   
  <item> 
   <title>First attempt has been committed to HEAD.  Now testing is ne</title> 
   <description>First attempt has been committed to HEAD.  Now testing is needed.  Those using a non-HEAD version can download the file from:

http://cvs.horde.org/co.php/imp/lib/IMAP/Tree.php?r=1.188&amp;p=1



and directly replace the existing imp/lib/IMAP/Tree.php</description> 
   <pubDate>Wed, 25 Jun 2008 18:21:55 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46813</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/config/servers.php.dist?r1=1.82&amp;r2=1.83&amp;ty=u
http://cvs.horde.org/diff.php/imp/lib/Session.php?r1=1.168&amp;r2=1.169&amp;ty=u</description> 
   <pubDate>Wed, 25 Jun 2008 18:52:36 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46816</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?r1=1.188&amp;r2=1.189&amp;ty=u</description> 
   <pubDate>Wed, 25 Jun 2008 19:29:47 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46817</link> 
  </item> 
   
  <item> 
   <title>It started using folder subscriptions even though I have the</title> 
   <description>It started using folder subscriptions even though I have them turned off. but once I cleared my dovecot .subscriptions file (had some old folders in it) the current code is working well for me. I&#039;m a pretty small test case though.</description> 
   <pubDate>Thu, 26 Jun 2008 04:33:56 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46824</link> 
  </item> 
   
  <item> 
   <title>&gt; It started using folder subscriptions even though I have t</title> 
   <description>&gt; It started using folder subscriptions even though I have them turned 

&gt; off. but once I cleared my dovecot .subscriptions file (had some old 

&gt; folders in it) the current code is working well for me. I&#039;m a pretty 

&gt; small test case though.



I use dovecot and I saw this too - imap_lsub on dovecot appears to return the list of mailboxes in the subscribed folder regardless of whether they are present on the server or not.  Seems like this is broken IMAP behavior, but maybe I&#039;ll ask Timo (dovecot dev) if this is correct or not.



To workaround, we should probably get the list of folders from imap_list() and cross-reference with the list of folders from imap_lsub().</description> 
   <pubDate>Thu, 26 Jun 2008 18:21:22 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46896</link> 
  </item> 
   
  <item> 
   <title>I&#039;m not actually too worried about that, though that would b</title> 
   <description>I&#039;m not actually too worried about that, though that would be nice - what&#039;s more curious is that I don&#039;t use subscriptions (they&#039;re turned off in my prefs) and IMP started to use them.</description> 
   <pubDate>Thu, 26 Jun 2008 18:27:14 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46898</link> 
  </item> 
   
  <item> 
   <title>&gt; I&#039;m not actually too worried about that, though that would</title> 
   <description>&gt; I&#039;m not actually too worried about that, though that would be nice - 

&gt; what&#039;s more curious is that I don&#039;t use subscriptions (they&#039;re turned 

&gt; off in my prefs) and IMP started to use them.



I don&#039;t see the subscriptions issue with the latest version - maybe it was fixed in the last few days.



As for the other issue, dovecot is exhibiting correct behavior.  From RFC 3501 [6.3.9]:



      The returned untagged LSUB response MAY contain different mailbox

      flags from a LIST untagged response.  If this should happen, the

      flags in the untagged LIST are considered more authoritative.



      ...



      The server MUST NOT unilaterally remove an existing mailbox name

      from the subscription list even if a mailbox by that name no

      longer exists.



So if viewing only subscribed folders, we do need to cross-reference with imap_list() results to get an accurate representation of the current subscribed folders.</description> 
   <pubDate>Thu, 26 Jun 2008 19:34:36 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46900</link> 
  </item> 
   
  <item> 
   <title>I have prefs set to display namespaces separately and use su</title> 
   <description>I have prefs set to display namespaces separately and use subscriptions. Now, if there is a shared folder from another user, the parent node saying &quot;Other Users&#039; Folders&quot; is displayed (empty), even if I didn&#039;t subscribe to any of those other users&#039; folders.



Additionally, the user itself is clickable, though I&#039;m not sure if this is an issue with the IMAP server or IMP, i.e. I have the hierarchy:



Other User&#039;s Folders

  username

    foldername



if the user &quot;username&quot; shared his folder &quot;foldername&quot;. And both &quot;username&quot; and &quot;foldername&quot; appear as clickable, valid mailboxes.</description> 
   <pubDate>Thu, 26 Jun 2008 21:18:41 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46905</link> 
  </item> 
   
  <item> 
   <title>&gt; I have prefs set to display namespaces separately and use </title> 
   <description>&gt; I have prefs set to display namespaces separately and use 

&gt; subscriptions. Now, if there is a shared folder from another user, 

&gt; the parent node saying &quot;Other Users&#039; Folders&quot; is displayed (empty), 

&gt; even if I didn&#039;t subscribe to any of those other users&#039; folders.



I thought this was a feature?  Or did we decide in the past that if a public/other namespace is empty, we would only show if subscriptions were off?  We do need to show this namespace somewhere, even if it is empty, if simply to allow the user to create subfolders in this namespace.



&gt; Additionally, the user itself is clickable, though I&#039;m not sure if 

&gt; this is an issue with the IMAP server or IMP, i.e. I have the 

&gt; hierarchy:

&gt;

&gt; Other User&#039;s Folders

&gt;   username

&gt;     foldername

&gt;

&gt; if the user &quot;username&quot; shared his folder &quot;foldername&quot;. And both 

&gt; &quot;username&quot; and &quot;foldername&quot; appear as clickable, valid mailboxes.



Can you check the output from _getList() and see if &quot;namespace.username.folder&quot; is being returned from the IMAP server, or if both &quot;namespace.username.folder&quot; and &quot;namespace.username&quot; is being returned.  Obviously, if it is the former than IMP_Tree is buggy, and if it is the latter then the IMAP server is buggy.</description> 
   <pubDate>Thu, 26 Jun 2008 21:59:42 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46907</link> 
  </item> 
   
  <item> 
   <title>&gt;&gt; I have prefs set to display namespaces separately and use</title> 
   <description>&gt;&gt; I have prefs set to display namespaces separately and use

&gt;&gt; subscriptions. Now, if there is a shared folder from another user,

&gt;&gt; the parent node saying &quot;Other Users&#039; Folders&quot; is displayed (empty),

&gt;&gt; even if I didn&#039;t subscribe to any of those other users&#039; folders.

&gt;

&gt; I thought this was a feature?  Or did we decide in the past that if a 

&gt; public/other namespace is empty, we would only show if subscriptions 

&gt; were off?  We do need to show this namespace somewhere, even if it is 

&gt; empty, if simply to allow the user to create subfolders in this 

&gt; namespace.



At least for the shared folders namespace, you can&#039;t create any folder directly under it anyway. And we don&#039;t show the Public Folders node either, if there aren&#039;t any folders below it.



&gt;&gt; Additionally, the user itself is clickable, though I&#039;m not sure if

&gt;&gt; this is an issue with the IMAP server or IMP, i.e. I have the

&gt;&gt; hierarchy:

&gt;&gt;

&gt;&gt; Other User&#039;s Folders

&gt;&gt;   username

&gt;&gt;     foldername

&gt;&gt;

&gt;&gt; if the user &quot;username&quot; shared his folder &quot;foldername&quot;. And both

&gt;&gt; &quot;username&quot; and &quot;foldername&quot; appear as clickable, valid mailboxes.

&gt;

&gt; Can you check the output from _getList() and see if 

&gt; &quot;namespace.username.folder&quot; is being returned from the IMAP server, 

&gt; or if both &quot;namespace.username.folder&quot; and &quot;namespace.username&quot; is 

&gt; being returned.  Obviously, if it is the former than IMP_Tree is 

&gt; buggy, and if it is the latter then the IMAP server is buggy.



It only contains &quot;namespace.username.folder&quot;.</description> 
   <pubDate>Thu, 26 Jun 2008 22:33:26 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46909</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?r1=1.192&amp;r2=1.193&amp;ty=u</description> 
   <pubDate>Fri, 27 Jun 2008 00:56:49 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46911</link> 
  </item> 
   
  <item> 
   <title>With my latest changes, everything seems to be working (at l</title> 
   <description>With my latest changes, everything seems to be working (at least for me).</description> 
   <pubDate>Fri, 27 Jun 2008 02:15:16 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46917</link> 
  </item> 
   
  <item> 
   <title>Not for me, the issue with the empty parent node still exist</title> 
   <description>Not for me, the issue with the empty parent node still exists. I noticed though, that this doesn&#039;t happen from the start, but only after first showing all folders, and then going back to only showing subscribed folders (in the folders navigator).</description> 
   <pubDate>Fri, 27 Jun 2008 07:09:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46920</link> 
  </item> 
   
  <item> 
   <title>&gt; With my latest changes, everything seems to be working (at</title> 
   <description>&gt; With my latest changes, everything seems to be working (at least for me).



Before the patch,we were able to see/use shared folders with the &#039;imap_config&#039; option. 

now, we don&#039;t see shared folders any more with or without the imap_config option. We use courier-imap-4.3.0.



$servers[&#039;imap&#039;] = array(

    &#039;name&#039; =&gt; &#039;Courier IMAP Server&#039;,

    &#039;server&#039; =&gt; &#039;127.0.0.1&#039;,

    &#039;hordeauth&#039; =&gt; true,

    &#039;protocol&#039; =&gt; &#039;imap/notls&#039;,

    &#039;port&#039; =&gt; 143,

    &#039;maildomain&#039; =&gt; &#039;mbpgroup.com&#039;,

    &#039;smtphost&#039; =&gt; &#039;127.0.0.1&#039;,

    &#039;smtpport&#039; =&gt; 25,

    &#039;realm&#039; =&gt; &#039;&#039;,

    &#039;preferred&#039; =&gt; &#039;&#039;,

    &#039;quota&#039; =&gt; array(

        &#039;driver&#039; =&gt; &#039;imap&#039;,

        &#039;params&#039; =&gt; array(),

    ),

    &#039;acl&#039; =&gt; array(

        &#039;driver&#039; =&gt; &#039;rfc2086&#039;,

/*    ),

   &#039;imap_config&#039; =&gt; array(

        &#039;children&#039; =&gt; true,

        &#039;namespace&#039; =&gt; array(

            &#039;&#039; =&gt; array(

                &#039;name&#039; =&gt; &#039;&#039;,

                &#039;delimiter&#039; =&gt; &#039;.&#039;,

                &#039;type&#039; =&gt; &#039;personal&#039;,

                &#039;hidden&#039; =&gt; false

            ),

            &#039;#shared.&#039; =&gt; array(

                &#039;name&#039; =&gt; &#039;#shared.&#039;,

                &#039;delimiter&#039; =&gt; &#039;.&#039;,

                &#039;type&#039; =&gt; &#039;personal&#039;,

                &#039;hidden&#039; =&gt; false

            ),

      ),

        &#039;search_charset&#039; =&gt; array(

            &#039;UTF-8&#039; =&gt; true

        )

*/    )

);

</description> 
   <pubDate>Fri, 27 Jun 2008 08:04:43 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46921</link> 
  </item> 
   
  <item> 
   <title>changing the pref value of tree_view gives me this in http&#039;s</title> 
   <description>changing the pref value of tree_view gives me this in http&#039;s logs :

[Fri Jun 27 10:28:52 2008] [error] [client 192.168.100.188] PHP Notice:  Undefined variable: name in /var/www/html/horde/imp/lib/IMAP/Tree.php on line 483, referer: http://192.168.1.22/horde/services/prefs.php?app=imp&amp;group=display

[Fri Jun 27 10:28:52 2008] [error] [client 192.168.100.188] PHP Notice:  Undefined index:   in /var/www/html/horde/imp/lib/IMAP/Tree.php on line 483, referer: http://192.168.1.22/horde/services/prefs.php?app=imp&amp;group=display

[Fri Jun 27 10:28:52 2008] [error] [client 192.168.100.188] PHP Notice:  Undefined variable: name in /var/www/html/horde/imp/lib/IMAP/Tree.php on line 483, referer: http://192.168.1.22/horde/services/prefs.php?app=imp&amp;group=display

</description> 
   <pubDate>Fri, 27 Jun 2008 08:31:18 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46923</link> 
  </item> 
   
  <item> 
   <title>&gt; changing the pref value of tree_view gives me this in http</title> 
   <description>&gt; changing the pref value of tree_view gives me this in http&#039;s logs :

&gt; [Fri Jun 27 10:28:52 2008] [error] [client 192.168.100.188] PHP 

&gt; Notice:  Undefined variable: name in 

&gt; /var/www/html/horde/imp/lib/IMAP/Tree.php on line 483, referer: 

&gt; http://192.168.1.22/horde/services/prefs.php?app=imp&amp;group=display



There is something really wrong with your namespace detection.  Put in:

  print_r($this-&gt;_namespaces);

above line 469 (&quot;foreach ($this-&gt;_namespaces as $key =&gt; $val) {&quot;) and report the output.

</description> 
   <pubDate>Fri, 27 Jun 2008 16:48:57 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46943</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?r1=1.193&amp;r2=1.194&amp;ty=u</description> 
   <pubDate>Fri, 27 Jun 2008 17:02:58 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46946</link> 
  </item> 
   
  <item> 
   <title>&gt; Not for me, the issue with the empty parent node still exi</title> 
   <description>&gt; Not for me, the issue with the empty parent node still exists. I 

&gt; noticed though, that this doesn&#039;t happen from the start, but only 

&gt; after first showing all folders, and then going back to only showing 

&gt; subscribed folders (in the folders navigator).



Works for me still.  I tried playing around with a few more things so maybe my last commit will help.</description> 
   <pubDate>Fri, 27 Jun 2008 17:03:35 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46947</link> 
  </item> 
   
  <item> 
   <title>Great! It fixed both, the linking, and the empty node proble</title> 
   <description>Great! It fixed both, the linking, and the empty node problem.</description> 
   <pubDate>Fri, 27 Jun 2008 21:32:22 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t46950</link> 
  </item> 
   
  <item> 
   <title>This code seems to be working well for everyone.  I think we</title> 
   <description>This code seems to be working well for everyone.  I think we should keep it in HEAD a bit longer and if we see no further major issues, merge to FW_3 for 4.2.2.  Or maybe this is such an upgrade over the current code that it would be worth it to merge to 4.2.1, reasoning that any bugs in it are less critical than the bugs in the current code?</description> 
   <pubDate>Mon, 30 Jun 2008 18:22:02 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47022</link> 
  </item> 
   
  <item> 
   <title>I vote for merging it into 4.2.1.  We&#039;ll be backporting it i</title> 
   <description>I vote for merging it into 4.2.1.  We&#039;ll be backporting it if it isn&#039;t.



So.. at this point, these changes effect lib/IMAP/Tree.php, lib/Session.php and config/servers.php?</description> 
   <pubDate>Mon, 30 Jun 2008 18:39:34 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47024</link> 
  </item> 
   
  <item> 
   <title>I agree on merging it - it seems to have cleared up 4-5 bugs</title> 
   <description>I agree on merging it - it seems to have cleared up 4-5 bugs so far.</description> 
   <pubDate>Mon, 30 Jun 2008 18:43:07 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47025</link> 
  </item> 
   
  <item> 
   <title>&gt; So.. at this point, these changes effect lib/IMAP/Tree.php</title> 
   <description>&gt; So.. at this point, these changes effect lib/IMAP/Tree.php, 

&gt; lib/Session.php and config/servers.php?



Really, only lib/IMAP/Tree.php is needed.  The other 2 files remove a no-longer needed configuration variable.</description> 
   <pubDate>Mon, 30 Jun 2008 18:59:44 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47030</link> 
  </item> 
   
  <item> 
   <title>Changes have been made in CVS for this ticket:

http://cvs.h</title> 
   <description>Changes have been made in CVS for this ticket:

http://cvs.horde.org/diff.php/imp/config/servers.php.dist?r1=1.50.2.21&amp;r2=1.50.2.22&amp;ty=u
http://cvs.horde.org/diff.php/imp/docs/CHANGES?r1=1.699.2.319&amp;r2=1.699.2.320&amp;ty=u
http://cvs.horde.org/diff.php/imp/lib/IMAP/Tree.php?r1=1.25.2.51&amp;r2=1.25.2.52&amp;ty=u
http://cvs.horde.org/diff.php/imp/lib/Session.php?r1=1.74.2.41&amp;r2=1.74.2.42&amp;ty=u</description> 
   <pubDate>Mon, 30 Jun 2008 20:11:40 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47045</link> 
  </item> 
   
  <item> 
   <title>On further reflection, agreed that merging to 4.2.1 makes th</title> 
   <description>On further reflection, agreed that merging to 4.2.1 makes the most sense.</description> 
   <pubDate>Mon, 30 Jun 2008 20:12:27 +0000</pubDate> 
   <link>https://bugs.horde.org/ticket/6972#t47047</link> 
  </item> 
   
   
 
 </channel> 
</rss> 
