[turba] LDAP Write then Read On-screen Object-not-found Error When Adding Address

Jan Schneider jan at horde.org
Thu Feb 12 11:11:40 UTC 2015


Zitat von Andy Dorman <AndyDorman at comehome.net>:

> Our Horde setup uses OpenLDAP for authentication and personal address books.
>
> Our OpenLDAP setup is a master LDAP server replicating to local LDAP  
> running on each webmail machine.  All the local LDAP processes are  
> configured to redirect writes to the master which are then  
> replicated back, usually in less than a second.
>
> I have run into a problem when adding an address book entry.  After  
> submitting a new entry we get a Horde "object not found" error up on  
> the screen.  If we navigate back to the address book we can see the  
> new entry has been added.
>
> I assumed this probably meant Turba was checking for the new address  
> before it has been replicated back to the local LDAP.
>
> However, I found a clever bit of work in  
> /usr/share/horde/turba/lib/Form/AddContact.php that is obviously  
> intended to avoid problems with replication delay most of the  
> time...except it doesn't actually appear to work as intended.
>
> The code block looks like this:
>
> // Try 3 times to get the new entry. We retry to allow setups like
> // LDAP replication to work.
> for ($i = 0; $i < 3; ++$i) {
>     try {
>         $ob = $driver->getObject($key);
>         $notification->push(sprintf(_("%s added."),  
> $ob->getValue('name')), 'horde.success');
>         $url = empty($info['url'])
>             ? $ob->url('Contact', true)
>             : new Horde_Url($info['url']);
>         $url->redirect();
>     } catch (Horde_Exception_NotFound $e) {
>     }
>     sleep(1);
> }
>
> I am not an experienced PHP programmer (my background is mostly  
> perl), but it looked to me like the first time through the loop the  
> getObject call was failing (as expected while replication was  
> catching up) and the catch call to Horde_Exception_NotFound was  
> triggering the on-screen error report.
>
> As an experiment I replaced "Horde_Exception_NotFound" with  
> "Exception" and the on-screen error report is gone and the new  
> addresses are successfully added.
>
> So is there possibly a way to call Horde_Exception_NotFound in the  
> catch argument above and NOT have it post the on-screen error?
>
> If someone can confirm this is actually a bug and not something I  
> have mis-configured, I will post a bug report.

No, this just means that the exception thrown from getObject() is  
*not* a Horde_Exception_NotFound. The question is, why not, and what  
else is it? Add a Horde::debug($e); call below your catch line (using  
Exception instead of Horde_Exception_NotFound) and let us know the  
outcome in /tmp/horde_debug.txt.

-- 
Jan Schneider
The Horde Project
http://www.horde.org/
https://www.facebook.com/hordeproject



More information about the turba mailing list