pdns icon indicating copy to clipboard operation
pdns copied to clipboard

API: gmysql Deadlock

Open Bodenhaltung opened this issue 5 years ago • 22 comments

  • Program: Authoritative
  • Issue type: Bug report

Short description

API Updates result in a MySQL Deadlock

Environment

  • Operating system: ArchLinux
  • Software version: pdns-4.2.1-1
  • Software source: Operating system repository

Steps to reproduce

  1. Send a few IP changes to the api.

Expected behaviour

No Errors.

Actual behaviour

MySQL Error:

[webserver] 50746175-0898-4b7c-812a-b8244a6c0a81 HTTP ISE for "/api/v1/servers/localhost/zones/domain.tld": Exception: GSQLBackend unable to nullify ordername and update auth for domain.tld for domain_id 1: Could not execute mysql statement: update records set ordername=NULL,auth=? where domain_id=? and name=? and disabled=0: Deadlock found when trying to get lock; try restarting transaction

Version 4.2.0-7 works still fine.

MySQL 8.0.16-7 Percona.

Record Table:

| records | CREATE TABLE `records` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `domain_id` int(11) DEFAULT NULL,
  `name` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `type` varchar(10) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `content` varchar(64000) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `ttl` int(11) DEFAULT NULL,
  `prio` int(11) DEFAULT NULL,
  `disabled` tinyint(1) DEFAULT '0',
  `change_date` int(11) DEFAULT NULL,
  `ordername` varchar(255) CHARACTER SET latin1 COLLATE latin1_swedish_ci DEFAULT NULL,
  `auth` tinyint(1) DEFAULT NULL,
  PRIMARY KEY (`id`),
  KEY `rec_name_index` (`name`),
  KEY `nametype_index` (`name`,`type`),
  KEY `domain_id` (`domain_id`),
  KEY `orderindex` (`ordername`)
) ENGINE=InnoDB AUTO_INCREMENT=9601267 DEFAULT CHARSET=utf8 |

Bodenhaltung avatar Dec 31 '19 20:12 Bodenhaltung