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

Handle network connectivity outage #3

Open
HowardvanRooijen opened this issue Aug 6, 2019 · 0 comments
Open

Handle network connectivity outage #3

HowardvanRooijen opened this issue Aug 6, 2019 · 0 comments

Comments

@HowardvanRooijen
Copy link
Contributor

The Receiver encountered a transient error whereby Azure Storage could not be reached. The following exception was thrown:

Unhandled Exception: Microsoft.Azure.Storage.StorageException: No such host is known —> System.Net.Http.HttpRequestException: No such host is known —> System.Net.Sockets.SocketException: No such host is known
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken)
	 End of inner exception stack trace 	
at System.Net.Http.ConnectHelper.ConnectAsync(String host, Int32 port, CancellationToken cancellationToken) at System.Threading.Tasks.ValueTask 1.get_Result()
at System.Net.Http.HttpConnectionPool.CreateConnectionAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at System.Threading.Tasks.ValueTask 1.get_Result()
at System.Net.Http.HttpConnectionPool.WaitForCreatedConnectionAsync(ValueTask 1 creationTask) at System.Threading.Tasks.ValueTask 1.get_Result()
at System.Net.Http.HttpConnectionPool.SendWithRetryAsync(HttpRequestMessage request, Boolean doRequestAuth, Cancellat ionToken cancellationToken)
at System.Net.Http.RedirectHandler.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) at System.Net.Http.HttpClient.FinishSendAsyncUnbuffered(Task`1 senaTask, HttpRequestMessage request, CancellationTokenSource cts, Boolean disposeCts)
at Microsoft.Azure.Storage.Core.Executor.Executor.ExecuteAsync[T](RESTCommand`1 cmd, IRetryPolicy policy, OperationContext operationContext, CancellationToken token)
	 End of inner exception stack trace 	
at Microsoft.Azure.Storage.Blob.BlobWriteStreamBase.ThrowLastExceptionlfExists() at Microsoft.Azure.Storage.Blob.BlobWriteStream.FlushAsync(Cancel1ationToken token) at Microsoft.Azure.Storage.Blob.BlobWriteStream.CommitAsync() at Microsoft.Azure.Storage.Blob.BlobWriteStream.Dispose Boolean disposing) at System`10.Stream.Close()
at Microsoft.Azure.Storage.Blob.CloudAppendBlob.UploadFromStreamHelper(Stream source, Nullable`1 length, Boolean createNew, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
at Microsoft.Azure.Storage.Blob.CloudAppendBlob.AppendFromStream(Stream source, AccessCondition accessCondition, Blob RequestOptions options, OperationContext operationContext)
at Microsoft.Azure.Storage.Blob.CloudAppendBlob.AppendFromByteArray(Byte[] buffer, Int32 index, Int32 count, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
at Microsoft.Azure.Storage.Blob.CloudAppendBlob.AppendText(String content, Encoding encoding, AccessCondition accessCondition, BlobRequestOptions options, OperationContext operationContext)
at Endjin.Ai s.Receiver.StorageClient.AppendMessages(IList`1 messages) in C:\Ais.Net.Receiver\Solutions\Ais.Net.Receiver\StorageClient.cs :1ine 43
at Endjin.Ais.Receiver.Program.OnMessageReceived(IList`1 messages) in C:\Ais.Net.Receiver\Solutions\Ais.Net.Receiver\Program.cs:line 51
at System.Reactive.AnonymousSafeObserver`1.OnNext(T value) in D:\a\l\s\Rx.NET\Source\src\System.Reactive\AnonymousSafeObserver.cs:line 44
at System.Reactive.Subjects.Subject`1.OnNext(T value) in D:\a\l\s\Rx.NET\Source\src\System.Reactive\Subjects\Subject.cs:line 148
at Endjin.Ais.Receiver.NmeaReceiver.RecieveAsync() in C:\Ais.Net.Receiver\Solutions\Ais.Net.Receiver\NmeaReceiver.cs:line 61
at Endiin.Ais.Receiver.Program.Main(String[] args) in C:\Ais.Net.Receiver\Solutions\Ais.Net.Receiver\Program.es:line 31
at Endjin.Ais.Receiver.Program.<Main>(String[] args)

Consider refactoring the code to use TPL Dataflow and either using a BufferBlock to hold incoming messages while trying to re-establish a connection with Azure Storage, or write messages to a local repository, which are then transmitted, in order, when the connection is re-established.

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

1 participant