Deletion of recently created DNS records fails intermittently

Bug #2015762 reported by Albert Braden
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Designate
Fix Released
Undecided
Unassigned

Bug Description

Running kolla-ansible Train on RHEL8. On rare occasions (approximately 1/50) recently created DNS records fail deletion at https://github.com/openstack/designate/blob/60edc59ff765b406e4b936deb4d200a2d9b411ce/designate/notification_handler/base.py#L113 when the corresponding VM is deleted.

When this happens we see the "Record not found in recordset" error in our debug logs. I added extra code to step through the recordset and found that the record is there before and after the failed "if." It appears that record_to_delete does not match the record that exists in the recordset.

Code:
        LOG.debug(
            'Deleting record: %s / recordset: %s / zone: %s',
            record_to_delete['id'], recordset_id, zone_id
        )
        try:
            recordset = self.central_api.get_recordset(
                context, zone_id, recordset_id
            )
            for thisrecord in recordset.records:
                LOG.debug('Record %s found in recordset %s', thisrecord['id'], recordset_id)
            LOG.debug('Dumping recordset %s',recordset)

            # Record not longer in recordset. Lets abort.
            if record_to_delete not in recordset.records:
                LOG.debug(
                    'Record %s not found in recordset %s',
                    record_to_delete['id'], recordset_id
                )
                for thisrecord in recordset.records:
                    LOG.debug('Record %s found in recordset %s', thisrecord['id'], recordset_id)
                return

Output:
2023-04-04 13:24:31.590 35 DEBUG designate.notification_handler.enhanced_base [req-c1ef2ad9-20d8-4956-9846-e65bea436d7e - - - - -] Deleting record: c5d50ad5-cc1e-4192-9e64-e16961602941 / recordset: ad032ea6-8c6f-45f8-8396-5c5532603010 / zone: c46a3fdf-6a2b-4126-88ad-9516856ad9a5 _update_or_delete_recordset /usr/lib/python3.6/site-packages/designate/notification_handler/enhanced_base.py:114

2023-04-04 13:24:31.612 35 DEBUG designate.notification_handler.enhanced_base [req-c1ef2ad9-20d8-4956-9846-e65bea436d7e - - - - -] Record c5d50ad5-cc1e-4192-9e64-e16961602941 found in recordset ad032ea6-8c6f-45f8-8396-5c5532603010 _update_or_delete_recordset /usr/lib/python3.6/site-packages/designate/notification_handler/enhanced_base.py:121

2023-04-04 13:24:31.613 35 DEBUG designate.notification_handler.enhanced_base [req-c1ef2ad9-20d8-4956-9846-e65bea436d7e - - - - -] Dumping recordset <RecordSet id:'ad032ea6-8c6f-45f8-8396-5c5532603010' type:'A' name:'stackwatch-trust-6.infra-stackwatch.de6.ourdomain.com.' zone_id:'c46a3fdf-6a2b-4126-88ad-9516856ad9a5'> _update_or_delete_recordset /usr/lib/python3.6/site-packages/designate/notification_handler/enhanced_base.py:122

2023-04-04 13:24:31.613 35 DEBUG designate.notification_handler.enhanced_base [req-c1ef2ad9-20d8-4956-9846-e65bea436d7e - - - - -] Record c5d50ad5-cc1e-4192-9e64-e16961602941 not found in recordset ad032ea6-8c6f-45f8-8396-5c5532603010 _update_or_delete_recordset /usr/lib/python3.6/site-packages/designate/notification_handler/enhanced_base.py:128

2023-04-04 13:24:31.614 35 DEBUG designate.notification_handler.enhanced_base [req-c1ef2ad9-20d8-4956-9846-e65bea436d7e - - - - -] Record c5d50ad5-cc1e-4192-9e64-e16961602941 found in recordset ad032ea6-8c6f-45f8-8396-5c5532603010 _update_or_delete_recordset /usr/lib/python3.6/site-packages/designate/notification_handler/enhanced_base.py:131

I worked around the problem by checking record_to_delete['id'] against the record that I find in the recordset, and deleting that record instead:

try:
            recordset = self.central_api.find_recordset(
                context, {'id': recordset_id, 'zone_id': zone_id}
            )
            def default_json(t):
                return f'{t}'
            for thisrecord in recordset.records:
                LOG.debug('Record %s found in recordset %s', thisrecord['id'], recordset_id)
                LOG.debug('Dumping thisrecord: %s',json.dumps(thisrecord, default=default_json))
                if thisrecord['id'] == record_to_delete['id']:
                    try:
                        recordset.records.remove(thisrecord)
                    except:
                        LOG.debug('Failed to delete record %s from recordset %s',thisrecord['id'], recordset_id)
                        return

Albert Braden (ozzzo)
description: updated
Changed in designate:
status: New → In Progress
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (master)

Reviewed: https://review.opendev.org/c/openstack/designate/+/879832
Committed: https://opendev.org/openstack/designate/commit/2cb42ac9f6e5273ad64e697919b62e029466078f
Submitter: "Zuul (22348)"
Branch: master

commit 2cb42ac9f6e5273ad64e697919b62e029466078f
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c

Changed in designate:
status: In Progress → Fix Released
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/2023.1)

Fix proposed to branch: stable/2023.1
Review: https://review.opendev.org/c/openstack/designate/+/880377

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/zed)

Fix proposed to branch: stable/zed
Review: https://review.opendev.org/c/openstack/designate/+/880378

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/yoga)

Fix proposed to branch: stable/yoga
Review: https://review.opendev.org/c/openstack/designate/+/880379

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/xena)

Fix proposed to branch: stable/xena
Review: https://review.opendev.org/c/openstack/designate/+/880380

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/wallaby)

Fix proposed to branch: stable/wallaby
Review: https://review.opendev.org/c/openstack/designate/+/880381

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/victoria)

Fix proposed to branch: stable/victoria
Review: https://review.opendev.org/c/openstack/designate/+/880382

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix proposed to designate (stable/ussuri)

Fix proposed to branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/designate/+/880383

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Change abandoned on designate (stable/ussuri)

Change abandoned by "Erik Olof Gunnar Andersson <email address hidden>" on branch: stable/ussuri
Review: https://review.opendev.org/c/openstack/designate/+/880383

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/2023.1)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880377
Committed: https://opendev.org/openstack/designate/commit/0721ced813c855d4edd2053e022a3c35d5e67566
Submitter: "Zuul (22348)"
Branch: stable/2023.1

commit 0721ced813c855d4edd2053e022a3c35d5e67566
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

tags: added: in-stable-zed
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/zed)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880378
Committed: https://opendev.org/openstack/designate/commit/b518dacca9ea997672ce0f8557bf79db6d8d190f
Submitter: "Zuul (22348)"
Branch: stable/zed

commit b518dacca9ea997672ce0f8557bf79db6d8d190f
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/yoga)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880379
Committed: https://opendev.org/openstack/designate/commit/f59448d9f1ea49d36ed1f22ee1ecdbc43ead15ff
Submitter: "Zuul (22348)"
Branch: stable/yoga

commit f59448d9f1ea49d36ed1f22ee1ecdbc43ead15ff
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

tags: added: in-stable-yoga
tags: added: in-stable-victoria
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/victoria)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880382
Committed: https://opendev.org/openstack/designate/commit/a7eb080039a663159f94f91844fdb238e8ec14c6
Submitter: "Zuul (22348)"
Branch: stable/victoria

commit a7eb080039a663159f94f91844fdb238e8ec14c6
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/xena)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880380
Committed: https://opendev.org/openstack/designate/commit/f6a09c11c6c23893f70434c7f6dd0296dab20fe4
Submitter: "Zuul (22348)"
Branch: stable/xena

commit f6a09c11c6c23893f70434c7f6dd0296dab20fe4
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

tags: added: in-stable-xena
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix merged to designate (stable/wallaby)

Reviewed: https://review.opendev.org/c/openstack/designate/+/880381
Committed: https://opendev.org/openstack/designate/commit/abb5263439eb6d95c82232e203a3ad2427dc6e19
Submitter: "Zuul (22348)"
Branch: stable/wallaby

commit abb5263439eb6d95c82232e203a3ad2427dc6e19
Author: Erik Olof Gunnar Andersson <email address hidden>
Date: Tue Apr 4 22:04:56 2023 -0700

    Use ids when removing sink managed records

    If the record status changes during the removal process,
    the current implementation will fail.

    Closes-Bug: 2015762
    Change-Id: Iebe609e5f365d03e99f2a4580671175b4642763c
    (cherry picked from commit 2cb42ac9f6e5273ad64e697919b62e029466078f)

tags: added: in-stable-wallaby
Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 16.0.1

This issue was fixed in the openstack/designate 16.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 14.0.3

This issue was fixed in the openstack/designate 14.0.3 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 17.0.0.0rc1

This issue was fixed in the openstack/designate 17.0.0.0rc1 release candidate.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate 15.0.1

This issue was fixed in the openstack/designate 15.0.1 release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate victoria-eom

This issue was fixed in the openstack/designate victoria-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate wallaby-eom

This issue was fixed in the openstack/designate wallaby-eom release.

Revision history for this message
OpenStack Infra (hudson-openstack) wrote : Fix included in openstack/designate xena-eom

This issue was fixed in the openstack/designate xena-eom release.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.