6.0.0-beta1
7/14/25

[#12887] "UID SEARCH": "BAD Invalid Search criteria"
Summary "UID SEARCH": "BAD Invalid Search criteria"
Queue Synchronization
Queue Version Git master
Type Bug
State Resolved
Priority 1. Low
Owners mrubinsk (at) horde (dot) org
Requester jmozdzen (at) nde (dot) ag
Created 12/22/2013 (4222 days ago)
Due
Updated 12/31/2013 (4213 days ago)
Assigned 12/22/2013 (4222 days ago)
Resolved 12/22/2013 (4222 days ago)
Github Issue Link
Github Pull Request
Milestone
Patch No

History
12/31/2013 05:31:22 AM Git Commit Comment #6 Reply to this comment
Changes have been made in Git (FRAMEWORK_5_1):

commit 815582c5c85aea33f643d3f7fcbced84d85adb7f
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sun Dec 22 13:23:19 2013 -0500

     Bug: 12887  Fix issue that caused sync breakage when SMS messages 
are deleted.

  .../lib/Horde/ActiveSync/Connector/Importer.php    |   14 +++++++++++---
  1 files changed, 11 insertions(+), 3 deletions(-)

http://git.horde.org/horde-git/-/commit/815582c5c85aea33f643d3f7fcbced84d85adb7f
12/22/2013 08:08:58 PM jmozdzen (at) nde (dot) ag Comment #5 Reply to this comment
Fixed for Horde_ActiveSync 2.10.0
Hello Mike,

thank you for the impressingly quick fix!

Happy holidays to you,

Jens
12/22/2013 06:27:33 PM Michael Rubinsky Comment #4
State ⇒ Resolved
Reply to this comment
Fixed for Horde_ActiveSync 2.10.0
12/22/2013 06:27:02 PM Git Commit Comment #3 Reply to this comment
Changes have been made in Git (master):

commit 089ed363d3fbea464ff54738d51270db202abcc3
Author: Michael J Rubinsky <mrubinsk@horde.org>
Date:   Sun Dec 22 13:23:19 2013 -0500

     Bug: 12887  Fix issue that caused sync breakage when SMS messages 
are deleted.

  .../lib/Horde/ActiveSync/Connector/Importer.php    |   14 +++++++++++---
  1 files changed, 11 insertions(+), 3 deletions(-)

http://git.horde.org/horde-git/-/commit/089ed363d3fbea464ff54738d51270db202abcc3
12/22/2013 06:12:55 PM Michael Rubinsky Version ⇒ Git master
Queue ⇒ Synchronization
 
12/22/2013 06:12:34 PM Michael Rubinsky Comment #2
State ⇒ Assigned
Assigned to Michael Rubinsky
Reply to this comment
You should be able to set your client to not sync SMS messages.

That being said, there is code in the activesync library to work 
around SMS sync attempts (that is what the IGNORE_SMS stuff is from). 
Obviously, that identifier is never supposed to reach the IMAP server 
so I'll have to figure out where it is leaking from.
12/22/2013 05:26:56 PM jmozdzen (at) nde (dot) ag Comment #1
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ "UID SEARCH": "BAD Invalid Search criteria"
Queue ⇒ Horde Framework Packages
Milestone ⇒
Patch ⇒ No
State ⇒ Unconfirmed
Reply to this comment
Horde_Imap_Client 2.16.1(please correct queue version if this is *not* 
for 5.1.x, I seem to be unable to identify this from "pear list" 
results)

After some connectivity problem, the ActiveSync client is unable to 
resync with the Horde server when deleting a message. I believe the 
message was deleted on both sides (mobile device, Horde) to cause this 
situation.

The horde log reports an IMAP error when moving the message to the 
Trash folder:

--- cut here: /var/log/horde/horde5.log ---
2013-12-22T17:48:11+01:00 ERR: HORDE [horde] Returning HTTP 500 while 
handling Sync command. [pid 12659 on line 156 of 
"/srv/www/htdocs.www.nde.ag.ssl/horde/rpc.php"]
2013-12-22T17:48:11+01:00 ERR: HORDE [horde] Error in communicating 
with ActiveSync server: Der E-Mail-Server hat einen IMAP-Fehler 
gemeldet. [pid 12659 on line 162 of 
"/usr/share/php5/PEAR/Horde/Rpc/ActiveSync.php"]
2013-12-22T17:48:11+01:00 ERR: HORDE [horde] #0 
/usr/share/php5/PEAR/Horde/Imap/Client/Socket.php(3941): 
Horde_Imap_Client_Socket->_getLine(Object(Horde_Imap_Client_Interaction_Pipeline))
#1 /usr/share/php5/PEAR/Horde/Imap/Client/Socket.php(3871): 
Horde_Imap_Client_Socket->_sendCmdChunk(Object(Horde_Imap_Client_Interaction_Pipeline), 
Array)
#2 /usr/share/php5/PEAR/Horde/Imap/Client/Socket.php(2231): 
Horde_Imap_Client_Socket->_sendCmd(Object(Horde_Imap_Client_Interaction_Pipeline))
#3 /usr/share/php5/PEAR/Horde/Imap/Client/Base.php(2370): 
Horde_Imap_Client_Socket->_search(Object(Horde_Imap_Client_Search_Query), 
Array)
#4 /usr/share/php5/PEAR/Horde/ActiveSync/Imap/Adapter.php(566): 
Horde_Imap_Client_Base->search(Object(Horde_Imap_Client_Mailbox), 
Object(Horde_Imap_Client_Search_Query))
#5 /usr/share/php5/PEAR/Horde/Core/ActiveSync/Driver.php(1170): 
Horde_ActiveSync_Imap_Adapter->moveMessage('INBOX', Array, 
'INBOX/Trash')
#6 /usr/share/php5/PEAR/Horde/ActiveSync/Connector/Importer.php(274): 
Horde_Core_ActiveSync_Driver->moveMessage('INBOX', Array, 'INBOX/Trash')
#7 /usr/share/php5/PEAR/Horde/ActiveSync/Request/Sync.php(1031): 
Horde_ActiveSync_Connector_Importer->importMessageMove(Array, 
'F6937edd4')
#8 /usr/share/php5/PEAR/Horde/ActiveSync/Request/Sync.php(794): 
Horde_ActiveSync_Request_Sync->_parseSyncCommands(Array)
#9 /usr/share/php5/PEAR/Horde/ActiveSync/Request/Sync.php(208): 
Horde_ActiveSync_Request_Sync->_parseSyncFolders()
#10 /usr/share/php5/PEAR/Horde/ActiveSync/Request/Base.php(249): 
Horde_ActiveSync_Request_Sync->_handle()
#11 /usr/share/php5/PEAR/Horde/ActiveSync.php(894): 
Horde_ActiveSync_Request_Base->handle()
#12 /usr/share/php5/PEAR/Horde/Rpc/ActiveSync.php(143): 
Horde_ActiveSync->handleRequest('Sync', 'SEC1EBBAABA7FB1...')
#13 /srv/www/htdocs.www.nde.ag.ssl/horde/rpc.php(156)
Horde_Rpc_ActiveSync->getResponse(NULL)
#14 {main} [pid 12659 on line 162 of 
"/usr/share/php5/PEAR/Horde/Rpc/ActiveSync.php"]
2013-12-22T17:48:11+01:00 ERR: HORDE [horde] Buffer contents:  [pid 
12659 on line 162 of "/usr/share/php5/PEAR/Horde/Rpc/ActiveSync.php"]
--- cut here ---

The IMAP log shows the subject error:

--- cut here: IMAP log ---
Sun, 22 Dec 2013 17:48:10 +0100
S: * OK [CAPABILITY IMAP4 IMAP4rev1 LITERAL+ ID STARTTLS AUTH=PLAIN 
SASL-IR] imapserver.somcomany.com  Cyrus IMAP v2.3.13-kolab-nocaps 
server ready
1 [SASL-IR AUTHENTICATE Command - method: PLAIN, username: 
someuser@somecompany.com]
CACHE: Using the Horde_Imap_Client_Cache_Backend_Db storage driver.
C: 2 NAMESPACE
S: * NAMESPACE (("INBOX/" "/")) (("user/" "/")) (("" "/"))
S: 2 OK Completed
C: 3 SELECT INBOX (CONDSTORE)
S: * FLAGS (\Answered \Flagged \Draft \Deleted \Seen NonJunk 
$Forwarded $MDNSent Junk KMAILFORWARDED KMAILTODO KMAILWATCHED 
KMAILIGNORED $TODO
S: * OK [PERMANENTFLAGS (\Answered \Flagged \Draft \Deleted \Seen 
NonJunk $Forwarded $MDNSent Junk KMAILFORWARDED KMAILTODO KMAILWATCHED 
KMAILI
S: * 38 EXISTS
S: * 0 RECENT
S: * OK [UNSEEN 25]
S: * OK [UIDVALIDITY 1256576950]
S: * OK [UIDNEXT 37902]
S: * OK [HIGHESTMODSEQ 29204]
S: * OK [URLMECH INTERNAL]
S: 3 OK [READ-WRITE] Completed
C: 4 UID STORE 37868 +FLAGS \seen
S: * 22 FETCH (FLAGS (\Seen) MODSEQ (29158) UID 37868)
S: 4 OK Completed
CACHE: Stored messages (mailbox: INBOX; UIDs: 37868)
C: 5 LSUB "" INBOX/*
C: 6 LSUB "" user/*
C: 7 LSUB "" *
[...]
S: 7 OK Completed (0.040 secs 649 calls)
C: 8 LIST "" INBOX/*
C: 9 LIST "" user/*
C: 10 LIST "" *
S: * LIST (\HasChildren) "/" "INBOX/subfolder"
[...]
S: 10 OK Completed (0.070 secs 994 calls)
SEARCH: Expired from cache (mailbox: INBOX)
C: 11 UID SEARCH UID IGNORESMS_SMS_1387536480986,37870,37873,37872
S: 11 BAD Invalid Search criteria
C: 12 LOGOUT
S: * BYE LOGOUT received
S: 12 OK Completed
--- cut here ---

After resetting the ActiveSync device in Horde, the next resync will work.

The remote client is an Android device (up-to-date Samsung S4) and 
judging from the message above, it seems mentionable that an SMS 
received on the device and displayed by the standard email application 
was deleted on the mobile device, probably causing that 
"IGNORESMS_SMS_1387536480986"of the "uid search" statement.

This is obviously a pretty old IMAP server and I'm preparing an 
upgrade, so if this is hard to fix, please respond with "won't fix". 
But it would help me to cover the next four to eight weeks at least 
and might be probably good to react to this situation some other way 
(or not use that syntax in the first place, for such an old server), 
so it *would* be helpful if a fix was possible. I cannot tell if the 
SMS part is the cause and might affect newer Cyrus IMAP servers, too.

Regards,
Jens

Saved Queries