Skip to content

Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction #1551

Open
@adrianbj

Description

@adrianbj

Short description of the issue

I received the following exception when updating an existing row in a Profields Table field.

ProcessWire\WireDatabaseQueryException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction #40001 in /var/www/html/wire/core/FieldtypeMulti.php:253 caused by PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction #4000

Steps to reproduce the issue

This is the code that triggered this error, but I have been using this code for a long time and this is the first time I have seen this, Given the nature of the error, I am not really surprised though as it's probably all about timing. Anyway, I don't know how you can really reproduce this, but

$item = $recipient->received_emails->get('email_message.id=' . $email->id);
if($item) {
    $item->message_id = $data->message->headers->{'message-id'};
    $item->delivery_status = $data->event;
    $recipient->save('received_emails');
}

Here's what looks to be the relevant parts of the stack trace.

image

I'm not completely sure, but perhaps there is some useful info here: https://www.drupal.org/node/1369332 ? There are many other references to / solutions for this error, but it's not a one size fits all issue. Let me know if there is anything else I can provide.

Setup/Environment

Server Details

Software Version
ProcessWire 3.0.196
PHP 8.0.17
Webserver Apache
MySQL Server 10.3.34-MariaDB-0+deb10u1-log
MySQL Client mysqlnd 8.0.17
Server Settings
Parameter Value
allow_url_fopen 1
max_execution_time 180 (changeable)
max_input_nesting_level 64
max_input_time 60
max_input_vars 10000
memory_limit 1024M
post_max_size 220M
upload_max_filesize 200M
xdebug
xdebug.max_nesting_level
mod_rewrite 1
mod_security
EXIF Support 1
FreeType 1
GD Settings
Parameter Value
Version 2.2.5
GIF 1
JPG 1
PNG 1
WebP 1
iMagick Settings
Parameter Value
Version 6.9.10
GIF 1
JPG 1
PNG 1
SVG 1
PDF 1
WebP 1
Module Details
Module ClassName Version
TextformatterVideoEmbedOptions 0.3.6
TextformatterVideoEmbed 2.0.2
AddUserSwitcherAction 0.0.1
AdminModalception 1.0.1
AdminOnSteroids 2.0.21
AdminPageFieldEditLinks 3.1.4
BreadcrumbDropdowns 0.3.7
CustomInputfieldDependencies 0.2.4
Dashboard 1.2.1
DashboardPanelAddNew 1.2.1
DashboardPanelChart 1.2.1
DashboardPanelCollection 1.2.1
DashboardPanelHelloWorld 0.0.1
DashboardPanelNotice 1.2.1
DashboardPanelNumber 1.2.1
DashboardPanelPageList 1.2.1
DashboardPanelShortcuts 1.2.1
DashboardPanelTemplate 1.2.1
Duplicator 1.4.21
DynamicDescriptionNotes 0.1.6
FieldtypeAdminComments 1.0.8
FieldtypeAssistedURL 1.0.0
FieldtypeColor 1.1.7
FieldtypeFields 0.0.2
FieldtypePhone 3.1.0
FieldtypeQRCode 1.0.13
FieldtypeRepeaterMatrix 0.0.5
FieldtypeRuntimeOnly 0.1.8
FieldtypeSeoMaestro 1.1.0
FieldtypeTable 0.2.2
FieldtypeVerifiedURL 0.0.5
FileValidatorSvgSanitizer 0.0.5
HannaCodeDialog 0.4.4
InputfieldAceExtended 1.1.3
InputfieldAdminComments 1.0.8
InputfieldAssistedURL 1.0.1
InputfieldColor 1.1.5
InputfieldPhone 3.1.0
InputfieldRepeaterMatrix 0.0.5
InputfieldRepeaterMatrixDuplicate 2.0.1
InputfieldSeoMaestro 1.1.0
InputfieldTable 0.2.2
Less 0.0.3
ListerNativeDateFormat 0.1.2
LoginRegister 0.0.2
MarkupSitemap 0.8.2
ModuleReleaseNotes 0.11.1
ModuleSettingsImportExport 0.2.9
PageActionEmail 0.0.2
PageActionExportCSV 0.0.6
PageActionExportPDF 0.0.1
PageActionExportText 0.0.1
PageRenameOptions 2.0.1
PageSnapshot 2.1.1
PasswordForceChange 1.0.5
PasswordGenerator 0.1.7
ProCache 4.0.1
ProcessAdminActions 0.8.10
ProcessAdminComments 1.0.7
ProcessChangelog 1.14.7
ProcessChangelogHooks 1.10.3
ProcessDatabaseBackups 0.0.6
ProcessDuplicator 1.4.21
ProcessEmails 0.0.1
ProcessGoogleAnalytics 1.2.1
ProcessHannaCode 0.3.0
ProcessJumplinks 1.5.61
ProcessLinkChecker 0.9.10
ProcessMessages 0.0.1
ProcessMigrator 0.7.7
ProcessPageFieldSelectCreator 0.5.11
ProcessPageListerPro 1.1.3
ProcessProCache 4.0.1
ProcessProfilerPro 0.0.2
ProcessSettingsFactory 1.0.7
ProcessTemplateParents 0.0.7
ProcessTracyAdminer 1.1.3
ProcessUserActivity 0.0.4
ProcessVersionControl 2.4.3
ProcessWireUpgrade 0.1.1
ProcessWireUpgradeCheck 0.0.9
ProfilerPro 0.0.3
ProtectedMode 1.1.0
RockPdf 2.0.6
SeoMaestro 1.1.0
SettingsFactory 1.0.7
TemplateParents 0.0.7
TextformatterHannaCode 0.3.0
TfaTotp 0.0.4
TracyDebugger 4.23.26
UserActivity 0.0.4
VersionControl 2.4.6
VersionControlCleanup 1.0.2
WireMailgun 1.2.1

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions