http://issues.apache.org/SpamAssassin/show_bug.cgi?id=4642
Summary: concurrency problem in the PostgreSQL specific Bayes-
module
Product: Spamassassin
Version: 3.1.0
Platform: Other
OS/Version: other
Status: NEW
Severity: normal
Priority: P5
Component: Learner
AssignedTo: [email protected]
ReportedBy: [EMAIL PROTECTED]
the PostgreSQL specific Bayes-module uses the plpgsql functions _put_token()
that takes an array of bytea-values and loops through the array doing either an
update or an insert.
However the approach used is subject to a racecondition in the case of multiple
clients learning mails with similiar tokens (multiple spamds or sa-learns),
because it might happen that a new token gets inserted(and commited) after the
function got called but before it tries the insert resulting in the following
error message in the postgresql log:
ERROR: duplicate key violates unique constraint "bayes_token_pkey"
CONTEXT: SQL statement "INSERT INTO bayes_token (id, token, spam_count,
ham_count, atime) VALUES ( $1 , $2 , $3 , $4 , $5 )"
PL/pgSQL function "put_tokens" line 18 at SQL statement
beginning with PostgreSQL 8.0 there is support of subtransactions/exceptions in
postgresql/plpgsql that could be used to solve that problem - an example for
that is available on:
http://developer.postgresql.org/docs/postgres/plpgsql-control-structures.html#PLPGSQL-ERROR-TRAPPING
(example 36-1)
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.