Object with that ID already exists
Object with that id already exists
Problem
LMTP rejecting messages with the exception "object with that id already exists".
Description
This issue rarely occurs when checkpoint (MySQL DB) value not updating. When this issue occurred, /opt/zimbra/log/mailbox.log
will be logged with similar lines.
[LmtpServer-xxx] [name=affected.user@example.com;mid=xxx;ip=xxx.xxx.xxx.xxx;] lmtp - rejecting message from=sender@example.com,to=affected.user@example.com com.zimbra.cs.mailbox.MailServiceException: object with that id already exists: 159560 ExceptionId:LmtpServer-xxx:1645554762772:c850cab6de85e27d Code:mail.ALREADY_EXISTS Arg:(itemId, IID, "159560") . . Caused by: java.sql.SQLIntegrityConstraintViolationException: (conn=20) Duplicate entry '2447-159560' for key 'PRIMARY'
Whenever a message sent/received, item_id_checkpoint will be increased to +1 and this will be the message id of that newly created message.
Example: Current item_id_checkpoint is 368, and if a user receives a new message then item_id_checkpoint will increase to +1 (369) and message id for the new message also will be 369.
Solution
Step 1:
- Get the group id and item_id_checkpoint for the affected mailbox. Mailbox id =
zmprov gmi affected.user@example.com
mysql -e "select item_id_checkpoint,group_id from zimbra.mailbox where id=<mailbox id>"
Step 2:
- Check the highest item id in mail_item and mail_item_dumpster tables.
mysql -e "select max(id) from <mboxgroup id>.mail_item where mailbox_id=<mailbox id>" mysql -e "select max(id) from <mboxgroup id>.mail_item_dumpster where mailbox_id=<mailbox id>"
Step 3:
- The highest id from either one of the mail_item tables should less than/equal to mailbox.item_id_checkpoint. If it doesn't, move the affected account into maintenance state
zmprov ma <affected.user@example.com> zimbraAccountStatus maintenance
Step 4: To avoid conflict, updating check point value manually
mysql -e "update zimbra.mailbox set item_id_checkpoint=item_id_checkpoint+1000 where id=<mailbox id>"
Step 5:
- Clear cache of the affected account.
zmsoap -A -z UnloadMailboxRequest/account @name="affected.user@example.com"
Step 6:
- Moving affected account into active state
zmprov ma affected.user@example.com zimbraAccountStatus active
Step 7:
- Test by sending email to the affected account.
Submitted by: Raghu Noti |