I'm sending mails over drupal_mail with a cron queue. There are 5 parrallel ultimate cron worker jobs that all process the queue items (mails to be sent). If i do tests with hundreds of mails then in case of about 2% i get the following error.
Disabling the mail_tracking module will make the error go away.
Jul 23 10:30:17 <servername> drupal: http://<servername>|1406104217|cst_mail_cron|85.25.214.136|http://<servername>/bgp-start/uc-queue_cst_send_mail_5/3a2add577a32fb5600b7e19fdeb8ea43||0||Queue item 18870 from queue cst_send_mail failed with message exception 'PDOException' with message 'SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry 'b96b019690baf7e7aa00114997cf40ac' for key 'PRIMARY'' in <path_to_httpdocs>/includes/database/database.inc:2171#012Stack trace:#012#0 <path_to_httpdocs>/includes/database/database.inc(2171): PDOStatement->execute(Array)#012#1 <path_to_httpdocs>/includes/database/database.inc(683): DatabaseStatementBase->execute(Array, Array)#012#2 <path_to_httpdocs>/includes/database/mysql/query.inc(36): DatabaseConnection->query('INSERT INTO {ma...', Array, Array)#012#3 <path_to_httpdocs>/sites/all/modules/mail_tracking/includes/mail_tracking.mail.inc(426): InsertQuery_mysql->execute()#012#4 <path_to_httpdocs>/sites/all/modules/mail_tracking/includes/mail_tracking.mail.inc(91): MailTrackingMailSystem->saveToken(Array)#012#5 <path_to_httpdocs>/includes/mail.inc(183): MailTrackingMailSystem->mail(Array)#012#6 <path_to_httpdocs>/sites/all/modules/Custom/cst_mail_cron/cst_mail_cron.module(99): drupal_mail('mimemail', 'cst_mail_cron_d...', 'dummy@gmx-to...', Object(stdClass), Array, 'Dummy test
Comments
Comment #1
matthijsIt looks like the MD5 hash of the message id, recipient and request time isn't unique enough.
Is it possible that you have the same recipient twice? Otherwise I have to improve the token generation and store the token before the actual rewrite...
Comment #2
fox_01 commentedThis error comes from a test where i have generated 500 queue items that were sent with drupal_mail(). There were all the same message ids and same recipients but only a few % errors occur
Comment #3
deggertsen commentedI'm getting a similar error. Any luck fixing it? See #2338777: Duplicate entry preventing Simplenews Scheduler from functioning properly
Comment #4
matthijsYes, I will :-)
Comment #5
matthijs@deggertsen: I didn't notice it before, but it you've got a different duplicate key error then fox_01. Please open a new issue for this one...
Comment #6
deggertsen commentedReferencing my possible related issue. Thanks for looking into this Matthijs
Comment #8
matthijsThe latest dev should fix this issue, please give it a try!
Comment #9
matthijs