Compare commits

...

2 Commits

Author SHA1 Message Date
Thomas Boop 529e404063 Update releaseVersion
Runner CD / check (push) Has been cancelled
Runner CD / build (./dev, windows-2019, win-x64) (push) Has been cancelled
Runner CD / build (./dev.sh, macOS-latest, osx-x64) (push) Has been cancelled
Runner CD / build (./dev.sh, ubuntu-latest, linux-arm) (push) Has been cancelled
Runner CD / build (./dev.sh, ubuntu-latest, linux-arm64) (push) Has been cancelled
Runner CD / build (./dev.sh, ubuntu-latest, linux-x64) (push) Has been cancelled
Runner CD / release (push) Has been cancelled
2022-03-30 10:25:59 -04:00
Yashwanth Anantharaju c058208ce4 FeedStream 289 patch: handle websocket close failures (#1790)
* handle close failures

* bump runner version

* Update releaseNote.md

* Update releaseNote.md

* handle in other place as well

* Update releaseNote.md

Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>

* refactor

Co-authored-by: Thomas Boop <52323235+thboop@users.noreply.github.com>
2022-03-30 09:56:25 -04:00
4 changed files with 21 additions and 9 deletions
+1 -5
View File
@@ -1,11 +1,7 @@
## Features
## Bugs
- Fixed a crash on runner startup (#1770)
## Misc
- Clarified the type of step running when running job started or completed hooks (#1769)
- Fixed an issue where websockets failed to successfully close when posting log lines (#1790)
## Windows x64
+1 -1
View File
@@ -1 +1 @@
2.289.1
2.289.2
+18 -2
View File
@@ -143,8 +143,10 @@ namespace GitHub.Runner.Common
public ValueTask DisposeAsync()
{
_websocketClient?.CloseOutputAsync(WebSocketCloseStatus.NormalClosure, "Shutdown", CancellationToken.None);
CloseWebSocket(WebSocketCloseStatus.NormalClosure, CancellationToken.None);
GC.SuppressFinalize(this);
return ValueTask.CompletedTask;
}
@@ -248,7 +250,8 @@ namespace GitHub.Runner.Common
if (failedAttemptsToPostBatchedLinesByWebsocket * 100 / totalBatchedLinesAttemptedByWebsocket > _minWebsocketFailurePercentageAllowed)
{
Trace.Info($"Exhausted websocket allowed retries, we will not attempt websocket connection for this job to post lines again.");
_websocketClient?.CloseOutputAsync(WebSocketCloseStatus.InternalServerError, "Shutdown due to failures", cancellationToken);
CloseWebSocket(WebSocketCloseStatus.InternalServerError, cancellationToken);
// By setting it to null, we will ensure that we never try websocket path again for this job
_websocketClient = null;
}
@@ -276,6 +279,19 @@ namespace GitHub.Runner.Common
}
}
private void CloseWebSocket(WebSocketCloseStatus closeStatus, CancellationToken cancellationToken)
{
try
{
_websocketClient?.CloseOutputAsync(closeStatus, "Closing websocket", cancellationToken);
}
catch (Exception websocketEx)
{
// In some cases this might be okay since the websocket might be open yet, so just close and don't trace exceptions
Trace.Info($"Failed to close websocket gracefully {websocketEx.GetType().Name}");
}
}
public Task<TaskAttachment> CreateAttachmentAsync(Guid scopeIdentifier, string hubName, Guid planId, Guid timelineId, Guid timelineRecordId, string type, string name, Stream uploadStream, CancellationToken cancellationToken)
{
CheckConnection();
+1 -1
View File
@@ -1 +1 @@
2.289.1
2.289.2