Brigan Reiz
Brigan Reiz

Reputation: 35

C# MongoDB Atlas results in a DnsClient Error: The response seems to be truncated without TC flag set

I use this to initialize my MongoDB client:

MongoClientSettings settings = MongoClientSettings.FromConnectionString("mongodb+srv://REDACTED");
MongoClient client = new(settings);

I'm receiving the following debug message when running my C# application that uses a MongoDB Atlas database:

DnsClient Error: 91 : [DnsClient.LookupClient] Query 14661 via UDP => test.wbln178.mongodb.net IN TXT error parsing the response. The response seems to be truncated without TC flag set! Re-trying via TCP anyways.
DnsClient.DnsResponseParseException: Response parser error, 512 bytes available, tried to read 4 bytes at index 509.
Cannot read more Int32.
[REDACTED].
   at DnsClient.DnsDatagramReader.ReadUInt32NetworkOrder()
   at DnsClient.DnsRecordFactory.ReadRecordInfo()
   at DnsClient.DnsMessageHandler.GetResponseMessage(ArraySegment`1 responseData)
   at DnsClient.DnsUdpMessageHandler.Query(IPEndPoint server, DnsRequestMessage request, TimeSpan timeout)
   at DnsClient.LookupClient.ResolveQuery(IReadOnlyList`1 servers, DnsQuerySettings settings, DnsMessageHandler handler, DnsRequestMessage request, LookupClientAudit audit)

This started appearing out of nowhere without me changing any of the connection code. It eventually succeeds, but currently this delays the startup of the application by about 10 seconds.

Upvotes: 0

Views: 203

Answers (0)

Related Questions