Way back in #1369332: Avoid deadlock issues on the {node} table, that was solved for the then-node table. However, now, this issue can be reproduced on the node_field_data table, using this updated script:


use \Drupal\node\Entity\Node;

for ($i = 0; $i < 5000; $i++) {
  $node = Node::create([
    'type' => 'article',
    'title' => 'A title',
    'uid' => 1,
    'body' => [
      'format' => 'filtered_html',
      'value' => 'Foo',

and running it via seq 1 100 | xargs -L 1 -P 15 drush php-script ./node-deadlock.php.

The resulting errors:

SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction: INSERT INTO {node_field_data} (nid, vid, type, langcode, status, title, uid, created, changed, promote, sticky, revision_translation_affected, default_langcode) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6, :db_insert_placeholder_7, :db_insert_placeholder_8, :db_insert_placeholder_9, :db_insert_placeholder_10, :db_insert_placeholder_11, :db_insert_placeholder_12); Array
    [:db_insert_placeholder_0] => 679
    [:db_insert_placeholder_1] => 679
    [:db_insert_placeholder_2] => article
    [:db_insert_placeholder_3] => en
    [:db_insert_placeholder_4] => 1
    [:db_insert_placeholder_5] => A title
    [:db_insert_placeholder_6] => 1
    [:db_insert_placeholder_7] => 1485382678
    [:db_insert_placeholder_8] => 1485382678
    [:db_insert_placeholder_9] => 1
    [:db_insert_placeholder_10] => 0
    [:db_insert_placeholder_11] => 1
    [:db_insert_placeholder_12] => 1

Since the error is thrown in SqlContentEntityStorage, this is presumably not node-specific.

Proposed resolution

Find the issue (in the old issue, it was a default value being set to 0 instead of null) and fix.

The workaround for now is to change the transaction isolation, as mentioned here.

Remaining tasks

User interface changes

API changes

Data model changes


jhedstrom created an issue. See original summary.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

bmx269’s picture

bmx269’s picture

Any updates on this?

Parashram’s picture

Hi @bmx269,
please mention the steps to reproduce.


jhedstrom’s picture

@Parashram the steps in the issue summary still work to reproduce the issue on the latest 8.4.x.

anavarre’s picture

Confirmed I was able to easily reproduce with the steps outlined in the IS.