Zammad worker sends out multiple mails

Infos:

  • Used Zammad version: 6.5.2-1765903927
  • Used Zammad installation type: .deb package from official repository
  • Operating system: Ubuntu 20.04.4
  • Browser + version: Multiple versions of Chrome, Firefox
  • Database in use: PostgreSQL 16.9

Expected behavior:

  • Ticket get’s updated and one mail is send to the customer.

Actual behavior:

  • Ticket get’s updated, sometimes up to 5 update mails will be send out

Steps to reproduce the behavior:

  • ?

Hello everyone,

We’re experiencing an issue with our Zammad instance (6.5.2) and PostgreSQL 16 where the zammad-worker sends multiple duplicate emails via SendGrid. We believe this occurs because the worker can’t update the database tables due to serialization errors.

Background:
Our setup was working perfectly with Zammad 6.5.1. After upgrading to 6.5.2 on patch day, we encountered several challenges:

  1. The 6.5.2 update introduced API changes that affected our ERP system integration, requiring a temporary downgrade to 6.5.1 while our developer updated the ERP system.
  2. During this downtime, we attempted to migrate from MySQL 8 to PostgreSQL 16, but encountered issues with pgloader and needed to use an alternative version.
  3. After completing the migration, we upgraded back to Zammad 6.5.2.

The system worked for some time until approximately 3 days ago when we started seeing duplicate emails.

Symptoms:

  • Multiple identical emails being sent for the same ticket
  • PostgreSQL serialization errors in the logs

Example of duplicate emails:

I, [2026-01-21T10:17:32.195105#36511-1408100]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:17:36.298995#36511-1292140]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:17:45.128879#36511-1408020]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:17:59.480096#36511-1382000]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:04.254184#36511-1408020]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:18.703516#36511-1292140]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:22.221931#36511-1412820]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:34.798782#36511-1407900]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:50.532401#36511-1382300]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:18:54.505683#36511-1408020]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:19:08.520819#36511-1412800]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:19:11.335216#36511-1407940]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:19:54.935924#36511-1407880]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:20:18.192498#36511-1428600]  INFO -- :   Parameters: {"key"=>"Ticket-112215", "callback"=>"TicketZoom", "state"=>{"ticket"=>{"owner_id"=>"6790", "state_id"=>"4"}, "article"=>{"body"=>"[FILTERED]", "type"=>"email", "internal"=>false, "subtype"=>"reply", "to"=>"<privacy_redacted_mail_address>", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "from"=>"<name_redacted>", "ticket_id"=>"112215", "content_type"=>"text/html", "sender_id"=>"1", "type_id"=>"1", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4"}}, "params"=>{"ticket_id"=>112215, "overview_id"=>2, "shown"=>true}, "prio"=>9803, "notify"=>false, "active"=>true, "attachments"=>[], "updated_at"=>"2026-01-21T09:15:39.098Z", "id"=>"339953"}
I, [2026-01-21T10:20:32.922957#36511-1407880]  INFO -- :   Parameters: {"number"=>"75105008", "title"=>"Ihr Aushang", "group_id"=>"14", "owner_id"=>"6790", "customer_id"=>23788, "state_id"=>"4", "priority_id"=>"2", "article"=>{"from"=>"<name_redacted>", "to"=>"<privacy_redacted_mail_address>", "cc"=>"", "subject"=>"Aw: RE: Ihr Aushang [Ticket#75105008]", "body"=>"[FILTERED]", "content_type"=>"text/html", "ticket_id"=>112215, "type_id"=>1, "sender_id"=>1, "internal"=>false, "in_reply_to"=>"", "form_id"=>"af230ef4-4198-47d2-87d8-13087b331aa4", "subtype"=>"reply"}, "updated_at"=>"2026-01-20T19:03:28.886Z", "preferences"=>{}, "organization_id"=>3354, "pending_time"=>nil, "aidverlinkung"=>"", "eigenetags"=>"Eingang/First-Level::Auftrag/l_id", "fidverlinkung"=>"1769", "vidverlinkung"=>"2377", "vvidverlinkung"=>"", "ridverlinkung"=>"", "lidverlinkung"=>"11492512", "widverlinkung"=>"417406", "lsidverlinkung"=>"59976", "seidverlinkung"=>"", "syncidverlinkung"=>"", "serequestidverlinkung"=>"", "kidverlinkung"=>"", "marketplace"=>"", "external_orderid"=>"", "kfzidverlinkung"=>"", "owi_datum"=>nil, "shidverlinkung"=>"", "reidverlinkung"=>"", "bidverlinkung"=>"", "id"=>"112215", "all"=>"true"}

Example of duplicate emails in SendGrid:

STATUS MESSAGE LAST EVENT RECEIVED OPENS CLICKS
Delivered To: redacted_mail_address
RE: Ihr Aushang [Ticket#75105008] 2026/01/21 9:23am UTC+00:00 0 0
Delivered To: redacted_mail_address
RE: Ihr Aushang [Ticket#75105008] 2026/01/21 9:21am UTC+00:00 0 0
Delivered To: redacted_mail_address
RE: Ihr Aushang [Ticket#75105008] 2026/01/21 9:21am UTC+00:00 0 0
Delivered To: redacted_mail_address
RE: Ihr Aushang [Ticket#75105008] 2026/01/21 9:20am UTC+00:00 0 0

PostgreSQL Configuration:

Our PostgreSQL is not set to use serialization:

postgres=# SHOW default_transaction_isolation;
default_transaction_isolation
-------------------------------
read committed
(1 row)

Error Logs:

2026-01-19 15:47:58.219 UTC zammad@zammad DETAIL: Reason code: Canceled on identification as a pivot, during commit attempt.
2026-01-19 15:47:58.219 UTC zammad@zammad HINT: The transaction might succeed if retried.
2026-01-19 15:47:58.219 UTC zammad@zammad STATEMENT: COMMIT
2026-01-19 15:47:58.220 UTC zammad@zammad WARNING: there is no transaction in progress
2026-01-19 15:47:58.303 UTC zammad@zammad ERROR: could not serialize access due to read/write dependencies among transactions
2026-01-19 15:47:58.303 UTC zammad@zammad DETAIL: Reason code: Canceled on identification as a pivot, during write.
2026-01-19 15:47:58.303 UTC zammad@zammad HINT: The transaction might succeed if retried.
2026-01-19 15:47:58.303 UTC zammad@zammad STATEMENT: UPDATE "active_job_locks" SET "updated_at" = $1 WHERE "active_job_locks"."id" = $2

Delayed Jobs Status:

[1] pry(main)> Delayed::Job.count
=> 0
[2] pry(main)> Delayed::Job.where('attempts > 0').count
=> 0

Last system updates:
The last update run was January 16 but only rsync got updated.

Troubleshooting Steps Already Taken:

  • Restarted Zammad and Elasticsearch
  • Reduced worker pool from 15 to 5
  • Executed ActiveJobLock.delete_all
  • Rebuilt search index with zammad:searchindex:rebuild
  • Reindexed all tables with ActiveRecord::Base.connection.tables.each { |t| ActiveRecord::Base.connection.execute(“REINDEX TABLE #{t}”) }
  • Tried to search the forum to find a solution, without success.
  • abused Gemini without any success.

We’re looking for any insights or suggestions on how to resolve this serialization issue

Thank you in advance for your help!

Henry Hofmann