{"record":{"id":"7c41d04965560f8c","repo":"TechnitiumSoftware/DnsServer","slug":"failed-to-update-dnskey-ttl-please-try-again","errorCode":null,"errorMessage":"Failed to update DNSKEY TTL. Please try again.","messagePattern":"Failed to update DNSKEY TTL\\. Please try again\\.","errorType":"exception","errorClass":"DnsServerException","httpStatus":null,"severity":"warning","filePath":"DnsServerCore/Dns/Zones/PrimaryZone.cs","lineNumber":2481,"sourceCode":"                }\n            }\n\n            if (!_entries.TryGetValue(DnsResourceRecordType.DNSKEY, out IReadOnlyList<DnsResourceRecord> dnsKeyRecords))\n                throw new InvalidOperationException();\n\n            DnsResourceRecord[] newDnsKeyRecords = new DnsResourceRecord[dnsKeyRecords.Count];\n\n            for (int i = 0; i < dnsKeyRecords.Count; i++)\n            {\n                DnsResourceRecord dnsKeyRecord = dnsKeyRecords[i];\n                newDnsKeyRecords[i] = new DnsResourceRecord(dnsKeyRecord.Name, DnsResourceRecordType.DNSKEY, DnsClass.IN, dnsKeyTtl, dnsKeyRecord.RDATA);\n            }\n\n            List<DnsResourceRecord> addedRecords = new List<DnsResourceRecord>();\n            List<DnsResourceRecord> deletedRecords = new List<DnsResourceRecord>();\n\n            if (!TrySetRecords(DnsResourceRecordType.DNSKEY, newDnsKeyRecords, out IReadOnlyList<DnsResourceRecord> deletedDnsKeyRecords))\n                throw new DnsServerException(\"Failed to update DNSKEY TTL. Please try again.\");\n\n            addedRecords.AddRange(newDnsKeyRecords);\n            deletedRecords.AddRange(deletedDnsKeyRecords);\n\n            IReadOnlyList<DnsResourceRecord> newRRSigRecords = SignRRSet(newDnsKeyRecords);\n            if (newRRSigRecords.Count > 0)\n            {\n                AddOrUpdateRRSigRecords(newRRSigRecords, out IReadOnlyList<DnsResourceRecord> deletedRRSigRecords);\n\n                addedRecords.AddRange(newRRSigRecords);\n                deletedRecords.AddRange(deletedRRSigRecords);\n            }\n\n            CommitAndIncrementSerial(deletedRecords, addedRecords);\n            TriggerNotify();\n        }\n\n        #endregion","sourceCodeStart":2463,"sourceCodeEnd":2499,"githubUrl":"https://github.com/TechnitiumSoftware/DnsServer/blob/d0484b6c1e7439cdc53d67d81e9c876cda2ad756/DnsServerCore/Dns/Zones/PrimaryZone.cs#L2463-L2499","documentation":"Thrown by UpdateDnsKeyTtl() when TrySetRecords for the rebuilt DNSKEY RRset returns false. By this point the request passed the signed-zone and stable-key checks, so the failure is in the record-store layer replacing the DNSKEY records. The message explicitly asks to retry, indicating the failure is expected to be transient rather than a permanent config problem.","triggerScenarios":"TrySetRecords(DnsResourceRecordType.DNSKEY, newDnsKeyRecords, ...) returns false while replacing the existing DNSKEY RRset during a TTL update. Typically a concurrent modification, a transient I/O or store error, or an inability to commit the new RRset atomically.","commonSituations":"Another thread or peer is concurrently modifying the same zone's records; the backing store is temporarily locked or out of space; a race between zone save/flush and the TTL update.","solutions":["Retry UpdateDnsKeyTtl after a short backoff; the message indicates a transient failure.","Ensure no concurrent record writers (other API calls, replication, zone transfer notify) are mutating the zone during the update.","If retries consistently fail, inspect the server log (the store layer failure is logged separately) for the underlying I/O or lock error."],"exampleFix":"// before\nzone.UpdateDnsKeyTtl(desiredTtl);\n\n// after\nfor (int attempt = 0; attempt < 3; attempt++)\n{\n    try { zone.UpdateDnsKeyTtl(desiredTtl); break; }\n    catch (DnsServerException) when (attempt < 2) { Thread.Sleep(Backoff(attempt)); }\n}","handlingStrategy":"retry","validationCode":"null","typeGuard":"null","tryCatchPattern":"for (int attempt = 0; attempt < 3; attempt++)\n{\n    try { zone.UpdateDnsKeyTtl(ttl); return; }\n    catch (DnsServerException ex) when (ex.Message.StartsWith(\"Failed to update DNSKEY TTL\") && attempt < 2)\n    { Thread.Sleep(TimeSpan.FromSeconds(1 << attempt)); }\n}","preventionTips":["Avoid concurrent zone mutations while updating DNSKEY TTL.","Implement bounded exponential-backoff retries for messages ending in 'Please try again.'","Surface the server log entry from the TrySetRecords failure to diagnose persistent store errors."],"tags":["dns","dnssec","dnskey","ttl","transient","retry","concurrency"],"backgroundTag":null,"analyzedSha":"d0484b6c1e7439cdc53d67d81e9c876cda2ad756","analyzedAt":"2026-08-13T22:57:35.508Z","schemaVersion":2},"datasetVersion":"2026-08-14T00:17:13.853Z"}