Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] System.IO.EndOfStreamException: Unable to read beyond the end of the stream. #1189

Closed
V3ntus opened this issue Jan 16, 2025 · 5 comments

Comments

@V3ntus
Copy link

V3ntus commented Jan 16, 2025

Odd spike of these errors today on my DNS server. No configuration changes.

Version 13.0.2

[2025-01-16 16:52:26 UTC] DNS Server failed to resolve the request 'debiam.org. A IN' using forwarders: 1.1.1.1, 1.0.0.1.
System.IO.EndOfStreamException: Unable to read beyond the end of the stream.
   at System.IO.Stream.ReadAtLeastAsyncCore(Memory`1 buffer, Int32 minimumBytes, Boolean throwOnEndOfStream, CancellationToken cancellationToken)
   at System.Runtime.CompilerServices.PoolingAsyncValueTaskMethodBuilder`1.StateMachineBox`1.System.Threading.Tasks.Sources.IValueTaskSource.GetResult(Int16 token)
   at TechnitiumLibrary.IO.StreamExtensions.ReadExactlyAsync(Stream s, Int32 count, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.IO/StreamExtensions.cs:line 66
   at TechnitiumLibrary.Net.Dns.DnsDatagram.ReadUInt16NetworkOrderAsync(Stream s, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsDatagram.cs:line 361
   at TechnitiumLibrary.Net.Dns.DnsDatagram.ReadFromTcpAsync(Stream stream, MemoryStream sharedBuffer, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsDatagram.cs:line 348
   at TechnitiumLibrary.TaskExtensions.TimeoutAsync[T](Func`2 func, Int32 timeout, CancellationToken cancellationToken)
   at TechnitiumLibrary.TaskExtensions.TimeoutAsync[T](Func`2 func, Int32 timeout, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary/TaskExtensions.cs:line 61
   at TechnitiumLibrary.Net.Dns.ClientConnection.TcpClientConnection.ReadDnsDatagramAsync(Stream tcpStream) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/ClientConnection/TcpClientConnection.cs:line 206
   at TechnitiumLibrary.Net.Dns.ClientConnection.TcpClientConnection.QueryAsync(DnsDatagram request, Int32 timeout, Int32 retries, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/ClientConnection/TcpClientConnection.cs:line 327
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4502
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4718
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4419
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalResolveAsync(DnsDatagram request, Func`3 getValidatedResponseAsync, Boolean doNotReorderNameServers, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4829
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalResolveAsync(DnsDatagram request, Func`3 getValidatedResponseAsync, Boolean doNotReorderNameServers, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4780
   at TechnitiumLibrary.Net.Dns.DnsClient.GetDnsKeyForAsync(IReadOnlyList`1 lastDSRecords, DnsClient dnsClient, IDnsCache cache, UInt16 udpPayloadSize, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 3192
   at TechnitiumLibrary.Net.Dns.DnsClient.FindDnsKeyForAsync(String ownerName, DnsClass class, IReadOnlyList`1 currentDnsKeyRecords, DnsClient dnsClient, IDnsCache cache, UInt16 udpPayloadSize, DnsDatagram originalResponse, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 3162
   at TechnitiumLibrary.Net.Dns.DnsClient.DnssecValidateResponseAsync(DnsDatagram response, IReadOnlyList`1 lastDSRecords, DnsClient dnsClient, IDnsCache cache, UInt16 udpPayloadSize, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 2683
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass95_0.<<InternalDnssecResolveAsync>b__0>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4908
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4552
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4718
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass93_0.<<InternalResolveAsync>g__DoResolveAsync|1>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4419
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalResolveAsync(DnsDatagram request, Func`3 getValidatedResponseAsync, Boolean doNotReorderNameServers, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4792
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalResolveAsync(DnsDatagram request, Func`3 getValidatedResponseAsync, Boolean doNotReorderNameServers, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4780
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalDnssecResolveAsync(DnsQuestionRecord question, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4896
   at TechnitiumLibrary.Net.Dns.DnsClient.<>c__DisplayClass97_0.<<InternalCachedResolveQueryAsync>b__0>d.MoveNext() in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4995
--- End of stack trace from previous location ---
   at TechnitiumLibrary.Net.Dns.DnsClient.ResolveQueryAsync(DnsQuestionRecord question, Func`2 resolveAsync) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4254
   at TechnitiumLibrary.Net.Dns.DnsClient.InternalCachedResolveQueryAsync(DnsQuestionRecord question, CancellationToken cancellationToken) in /build/TechnitiumLibrary-13.0.2/TechnitiumLibrary.Net/Dns/DnsClient.cs:line 4977
   at DnsServerCore.Dns.DnsServer.DefaultRecursiveResolveAsync(DnsQuestionRecord question, NetworkAddress eDnsClientSubnet, IDnsCache dnsCache, Boolean dnssecValidation, Boolean skipDnsAppAuthoritativeRequestHandlers, CancellationToken cancellationToken) in /build/technitium-dns-server-13.0.2/DnsServerCore/Dns/DnsServer.cs:line 3343
   at DnsServerCore.Dns.DnsServer.RecursiveResolverBackgroundTaskAsync(DnsQuestionRecord question, NetworkAddress eDnsClientSubnet, Boolean advancedForwardingClientSubnet, IReadOnlyList`1 conditionalForwarders, Boolean dnssecValidation, Boolean cachePrefetchOperation, Boolean cacheRefreshOperation, Boolean skipDnsAppAuthoritativeRequestHandlers, TaskCompletionSource`1 taskCompletionSource) in /build/technitium-dns-server-13.0.2/DnsServerCore/Dns/DnsServer.cs:line 3127
@V3ntus
Copy link
Author

V3ntus commented Jan 16, 2025

Seems to only happen when DNSSEC validation is enabled

Without DNSSEC:
Image

With DNSSEC:
Image

@ShreyasZare
Copy link
Member

ShreyasZare commented Jan 16, 2025 via email

@V3ntus
Copy link
Author

V3ntus commented Jan 17, 2025

Working on NixOS, the version available in our package repository currently is 13.2 with 13.3 in progress. Updating to 13.2 showed no difference unfortunately. I'll see if I can spin up a minimal machine with 13.3 to reproduce.

@ShreyasZare
Copy link
Member

I tested it here and its working well. Seems like an issue specific to your network caused by some middleware/device that does not support DNSSEC. It could also be due to ISP hijacking DNS requests. Try to use encrypted DNS protocols like DoH or DoT with Cloudflare and see how it goes.

Image

@V3ntus
Copy link
Author

V3ntus commented Jan 17, 2025

Thank you for the reply! I agree, it's likely an issue with my network. I will troubleshoot on my end to see if I find anything based on your advice. I'll close this issue for now ruling out an issue with Technitium.

@V3ntus V3ntus closed this as not planned Won't fix, can't repro, duplicate, stale Jan 17, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants