A NOTE has been added to this issue.
======================================================================
http://dbmail.org/mantis/view.php?id=723
======================================================================
Reported By: hinote
Assigned To:
======================================================================
Project: DBMail
Issue ID: 723
Category: Database layer
Reproducibility: sometimes
Severity: major
Priority: normal
Status: new
target:
======================================================================
Date Submitted: 01-Sep-08 14:57 CEST
Last Modified: 02-Sep-08 18:46 CEST
======================================================================
Summary: simultaneous mailbox creation
Description:
When multiple dbmail processes start creating new mailbox (this can happen
via IMAP by user client command or with dbmail-smtp run with -M option) at
the same time, only first db_createmailbox() run correctly, others return
error. With dbmail-smtp, messages are rejected and not submitted into
dbmail since the INSERT query fails.
The db_createmailbox() function should check the mailbox for existence
after unsuccessful attempt to run the INSERT query.
======================================================================
----------------------------------------------------------------------
hinote - 01-Sep-08 20:52
----------------------------------------------------------------------
the bug causes following error messages:
Aug 29 12:00:00 maildb dbmail/smtp[32104]: Error:[sql]
dbpgsql.c,db_query(+287): query failed [INSERT INTO dbmail_mailboxes
(name, owner_idnr,seen_flag, answered_flag, deleted_flag, flagged_flag,
recent_flag, draft_flag, permission) VALUES ('INBOX/Spam
Archive/2008-08-29/1200-1259', 4, 1, 1, 1, 1, 1, 1, 1)] : [ERROR:
duplicate key value violates unique constraint
"dbmail_mailboxes_owner_name_idx" ]
Aug 29 12:00:00 maildb dbmail/smtp[32104]: Error:[db]
db.c,db_createmailbox(+3446): could not create mailbox
Aug 29 12:00:00 maildb dbmail/smtp[32104]: Error:[db]
db.c,db_find_create_mailbox(+3509): could not create mailbox [INBOX/Spam
Archive/2008-08-29/1200-1259] because [Database error while creating]
Aug 29 12:00:00 maildb dbmail/smtp[32104]: Error:[sort]
sort.c,sort_deliver_to_mailbox(+131): mailbox [INBOX/Spam
Archive/2008-08-29/1200-1259] not found
----------------------------------------------------------------------
hinote - 02-Sep-08 18:46
----------------------------------------------------------------------
The db_subscribe() function may also fail due to the same reason -
simultaneous attempts to make INSERT query to add subscription.
The dbmail-createmailbox-2.patch attached is a cumulative patch for
dbmail-2.2.10 which fixes both problems (with mailbox creation and mailbox
subscription performed by different dbmail processed at the same time).
Other INSERT and DELETE queries that deal with mailboxes should be
reviewed carefully as well (todo).
Issue History
Date Modified Username Field Change
======================================================================
01-Sep-08 14:57 hinote New Issue
01-Sep-08 14:57 hinote File Added: dbmail-createmailbox.patch
01-Sep-08 15:05 jasb Issue Monitored: jasb
01-Sep-08 20:52 hinote Note Added: 0002592
02-Sep-08 18:46 hinote File Added: dbmail-createmailbox-2.patch
02-Sep-08 18:46 hinote Note Added: 0002594
======================================================================
_______________________________________________
Dbmail-dev mailing list
[email protected]
http://twister.fastxs.net/mailman/listinfo/dbmail-dev