PowerDNS-Admin icon indicating copy to clipboard operation
PowerDNS-Admin copied to clipboard

BUG: Multiple SQL errors when concurrently adding domains

Open jbe-dw opened this issue 3 years ago • 2 comments

Hello,

Adding many domains in parallel with terraform outputs several errors in the log. The domains looks ok afterwards (at least in the ui)

Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [2022-02-15 10:01:46,009] [domain.py:169] ERROR - Cannot update domain table. Error: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: (MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '13.20.10.in-addr.arpa' for key 'ix_domain_name'")
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [SQL: INSERT INTO domain (name, master, type, serial, notified_serial, last_check, dnssec, account_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)]
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [parameters: ('13.20.10.in-addr.arpa', '[]', 'Master', 2022021501, 0, 0, 0, 43)]
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: (Background on this error at: http://sqlalche.me/e/13/gkpj)

Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [2022-02-15 10:01:46,057] [domain.py:169] ERROR - Cannot update domain table. Error: (raised as a result of Query-invoked autoflush; consider using a session.no_autoflush block if this flush is occurring prematurely)
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: (MySQLdb._exceptions.IntegrityError) (1062, "Duplicate entry '13.20.10.in-addr.arpa' for key 'ix_domain_name'")
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [SQL: INSERT INTO domain (name, master, type, serial, notified_serial, last_check, dnssec, account_id) VALUES (%s, %s, %s, %s, %s, %s, %s, %s)]
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [parameters: ('13.20.10.in-addr.arpa', '[]', 'Master', 2022021501, 0, 0, 0, 43)]
Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: (Background on this error at: http://sqlalche.me/e/13/gkpj)

Feb 15 10:01:46 dns-back-dc3-01 gunicorn[27486]: [2022-02-15 10:01:46,059] [domain.py:109] ERROR - Domain does not exist. ERROR: 'NoneType' object has no attribute 'id'

This message can be repeated up to ten times. I'm not an SQL Alchemy expert, so I just report the bug.

jbe-dw avatar Feb 15 '22 11:02 jbe-dw

@jbe-dw did you resolved that ? please help

trinv avatar Apr 28 '22 14:04 trinv

No because this messages shown up when I created a lot of domains simultaneously with Terraform but the domains were created and appeared in PowerDNS.

It's hard to see which condition make it happen, I'll have to review the domain code to see why this happens.

jbe-dw avatar Apr 29 '22 19:04 jbe-dw