getsentry / sentry-unity

Development of Sentry SDK for Unity
https://docs.sentry.io/platforms/unity/
MIT License
206 stars 51 forks source link

Sentry Monitor Unity Project with Error: System.Net.WebException: Error: NameResolutionFailure #890

Closed ismeyueyue closed 2 years ago

ismeyueyue commented 2 years ago

Environment

How do you use Sentry? Using sentry to monitor the Unity proformance

Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?) Lastest 22.6.0

Which version of the SDK? Sentry unity sdk version 0.21.1

How did you install the package? (Git-URL, Assetstore) Git-URL

Which version of Unity? Unity version 2021.2.4f1c1

Is this happening in Unity (editor) or on a player like Android, iOS, Windows? Windows

Steps to Reproduce

What you do

I want to use self-hosted sentry to monitor my unity project. I have installed self-hosted sentry successfully, and all docker containers are up healthy. I installed sentry sdk with UPM and configured the dsn with sentry window.

When I start the Unity project, I got the follow the Errors in Debug console.

However I have I have tested the same code using the sentry.io, the result is as expect. This issue is just happend on my self-hosted.

Expected Result

This is correct result sceenshot on sentry.io web. image

Actual Result

image

Sentry: (Error) Failed to send cached envelope: C:/Users/xxx/xxx/\Sentry\xxxx\__processing\1657785088_-8640__-1232464444.envelope, retrying after a delay. System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
  at System.Net.WebConnection.Connect (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x00044] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000cc] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebOperation.Run () [0x0009a] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebCompletionSource`1[T].WaitForCompletion () [0x00094] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00378] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
   --- End of inner exception stack trace ---
  at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00509] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
  at Sentry.Internal.Http.RetryAfterHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x0007f] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/RetryAfterHandler.cs:65 
  at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
  at Sentry.Internal.Http.HttpTransport.SendEnvelopeAsync (Sentry.Protocol.Envelopes.Envelope envelope, System.Threading.CancellationToken cancellationToken) [0x00080] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/HttpTransport.cs:46 
  at Sentry.Internal.Http.CachingTransport.InnerProcessCacheAsync (System.String file, System.Threading.CancellationToken cancellation) [0x001bf] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:271 
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) (at /sentry-unity/src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs:80)
UnityEngine.Debug:LogError (object)
Sentry.Unity.UnityLogger:Log (Sentry.SentryLevel,string,System.Exception,object[]) (at /sentry-unity/src/Sentry.Unity/UnityLogger.cs:47)
Sentry.Extensibility.DiagnosticLoggerExtensions:LogIfEnabled<string> (Sentry.Extensibility.IDiagnosticLogger,Sentry.SentryLevel,System.Exception,string,string) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:377)
Sentry.Extensibility.DiagnosticLoggerExtensions:LogError<string> (Sentry.SentryOptions,string,System.Exception,string) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:246)
Sentry.Internal.Http.CachingTransport/<InnerProcessCacheAsync>d__22:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:282)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Sentry.Internal.Http.HttpTransport/<SendEnvelopeAsync>d__3:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/HttpTransport.cs:48)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Net.Http.HttpResponseMessage>:SetException (System.Exception)
Sentry.Internal.Http.RetryAfterHandler/<SendAsync>d__8:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/RetryAfterHandler.cs:73)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
Sentry: (Error) Exception in background worker of CachingTransport. System.Net.Http.HttpRequestException: An error occurred while sending the request ---> System.Net.WebException: Error: NameResolutionFailure
  at System.Net.WebConnection.Connect (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x00044] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebConnection.InitConnection (System.Net.WebOperation operation, System.Threading.CancellationToken cancellationToken) [0x000cc] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebOperation.Run () [0x0009a] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.WebCompletionSource`1[T].WaitForCompletion () [0x00094] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.HttpWebRequest.RunWithTimeoutWorker[T] (System.Threading.Tasks.Task`1[TResult] workerTask, System.Int32 timeout, System.Action abort, System.Func`1[TResult] aborted, System.Threading.CancellationTokenSource cts) [0x000f8] in <c7c32602e34d422f9c1a5e3ed52782b2>:0 
  at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00378] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
   --- End of inner exception stack trace ---
  at System.Net.Http.MonoWebRequestHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x00509] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
  at Sentry.Internal.Http.RetryAfterHandler.SendAsync (System.Net.Http.HttpRequestMessage request, System.Threading.CancellationToken cancellationToken) [0x0007f] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/RetryAfterHandler.cs:65 
  at System.Net.Http.HttpClient.SendAsyncWorker (System.Net.Http.HttpRequestMessage request, System.Net.Http.HttpCompletionOption completionOption, System.Threading.CancellationToken cancellationToken) [0x000e8] in <f0a1e2b28d5249f4a1d6ad1969e1daaf>:0 
  at Sentry.Internal.Http.HttpTransport.SendEnvelopeAsync (Sentry.Protocol.Envelopes.Envelope envelope, System.Threading.CancellationToken cancellationToken) [0x00080] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/HttpTransport.cs:46 
  at Sentry.Internal.Http.CachingTransport.InnerProcessCacheAsync (System.String file, System.Threading.CancellationToken cancellation) [0x00285] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:284 
  at Sentry.Internal.Http.CachingTransport.ProcessCacheAsync (System.Threading.CancellationToken cancellation) [0x000a5] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:241 
  at Sentry.Internal.Http.CachingTransport.CachedTransportBackgroundTaskAsync () [0x000d4] in /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:122 
UnityEngine.DebugLogHandler:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[])
Sentry.Unity.Integrations.UnityLogHandlerIntegration:LogFormat (UnityEngine.LogType,UnityEngine.Object,string,object[]) (at /sentry-unity/src/Sentry.Unity/Integrations/UnityLogHandlerIntegration.cs:80)
UnityEngine.Debug:LogError (object)
Sentry.Unity.UnityLogger:Log (Sentry.SentryLevel,string,System.Exception,object[]) (at /sentry-unity/src/Sentry.Unity/UnityLogger.cs:47)
Sentry.Extensibility.DiagnosticLoggerExtensions:LogIfEnabled (Sentry.Extensibility.IDiagnosticLogger,Sentry.SentryLevel,System.Exception,string) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:346)
Sentry.Extensibility.DiagnosticLoggerExtensions:LogError (Sentry.SentryOptions,string,System.Exception) (at /sentry-unity/src/sentry-dotnet/src/Sentry/Extensibility/DiagnosticLoggerExtensions.cs:226)
Sentry.Internal.Http.CachingTransport/<CachedTransportBackgroundTaskAsync>d__17:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:131)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Sentry.Internal.Http.CachingTransport/<ProcessCacheAsync>d__21:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:245)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Sentry.Internal.Http.CachingTransport/<InnerProcessCacheAsync>d__22:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/CachingTransport.cs:301)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder:SetException (System.Exception)
Sentry.Internal.Http.HttpTransport/<SendEnvelopeAsync>d__3:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/HttpTransport.cs:48)
System.Runtime.CompilerServices.AsyncTaskMethodBuilder`1<System.Net.Http.HttpResponseMessage>:SetException (System.Exception)
Sentry.Internal.Http.RetryAfterHandler/<SendAsync>d__8:MoveNext () (at /sentry-unity/src/sentry-dotnet/src/Sentry/Internal/Http/RetryAfterHandler.cs:73)
System.Threading._ThreadPoolWaitCallback:PerformWaitCallback ()
bruno-garcia commented 2 years ago

NameResolutionFailure is the app/device able to resolve the DNS name in the DSN (Sentry Data source name?)

DSN for SaaS is something like https://abc@o123.ingest.sentry.io/321.

This error would come if you couldn't resolve o123.ingest.sentry.io from the device. Maybe the DSN server doesn't resolve external addresses or something?

ismeyueyue commented 2 years ago

Well, the DSN I uesed is the correct like http://5ddxxxxxed@host_url:port/project_id format, which I get by navigating to [Project] > Settings > Client Keys (DSN).

I have no idea about how to solve this error with DSN server from the host url.

Could you provide me with any suggestions? Thanks a lot.

bruno-garcia commented 2 years ago

This is hard for us to help. It seems to be a networking problem between the machien running the game (and Sentry's SDK) and the Sentry server. If you simply nslookup host_url where host_url is the domain in your DSN, does it resolve? Can you reach out to that server, e.g: telnet host_url port ? Maybe a firwall issue

bitsandfoxes commented 2 years ago

Sorry, this seems like your client can't reach your server and this seems like a network-related issue. Hopefully, the hints above are able to unblock you. Feel free to reopen this otherwise.