[horde] ActiveSync Ping/Sync flooding in webserver log

Joao S Veiga jsveiga at rf.com.br
Tue Jul 25 17:55:02 UTC 2017

> Quoting Volker Then <horde40 at volkerthen.com>:
> I checked the accounts now on an older Outlook version, but again  
> the sync process floods the logfiles. Constant Login/Logouts on the  
> IMAP server, and loads of error messages in the horde.log,  
> "integrity constraint violation". Any way that I can fix this?

Hi Volker,

(disclaimer: dirty&ugly hack ahead)

I started getting this when one of my stubborn users insisted on  
setting up his Outlook (Outlook/16.0 (16.0.8229.2086; x86)) as a  
client by himself. I do have iOS and Android clients using Activesync,  
but the few other Outlook clients (and Thunderbird) I have set just  
with IMAP directly.

So this guy somehow found the Horde Activesync in the server and  
started using for his Outlook, and I immediately started getting the  
same problems you describe.

My web server logs don't get flooded, because I have long before  
disabled logging entries with Activesync, but I did get the duplicate  
key errors in the horde log, and after investigating why my  
dovecot/auth process was always running, I found that his Outlook was  
logging in/out some 2-3 times a second!! It would authenticate, ENABLE  
QRESYNC, LOGOUT, then start again.

My "solutions" (disclaimer: I don't know if this created any side  
effect problems to the user; he was not supposed to be using  
Activesync; and he says "it's all working now", so I let him be  
instead of blocking his device. Since he's the only Outlook using  
Activesync, and the only one causing trouble, I assumed it's not  
Horde's fault, but Outlook's, so I'm not trying to "fix" Horde but to  
workaround this Outlook annoyance. This might be a temporary solution  
for you or not):

For the duplicate key issue, I just deleted that row in the database  
table. If outlook wants to insert it again, let it be inserted. I did  
not happen again:

delete from horde_activesync_state where sync_key =  

For the 3 times a second login/logouts, I just inserted a delay for  
Outlook Activesync logins, at /usr/share/php/Horde/ActiveSync.php, in  

public function authenticate(Horde_ActiveSync_Credentials $credentials)

--- /usr/share/php/Horde/ActiveSync.php_orig    2017-07-17  
16:48:36.611217042 -0300
+++ /usr/share/php/Horde/ActiveSync.php 2017-07-17 16:51:20.904983830 -0300
@@ -554,6 +554,12 @@
          if (!$this->_driver->setup($user)) {
              return false;
+        // slow down outlook
+        $pos = strrpos($this->_request->getHeader('User-Agent'), 'Outlook');
+        if ($pos !== false) {
+            sleep(8);
+        }
+        //end slow down outlook

          return true;

You can tune this to specific users/devices/Outlook versions, and use  
a shorter delay. Again, it's just a workaround, but worked for me.


Joao (aaand cue the pitchforks...)

More information about the horde mailing list