Skip to content

Commit 0517532

Browse files
authored
Skip logging errors on gRPC client disconnect. (#11182)
1 parent a20b307 commit 0517532

File tree

2 files changed

+23
-13
lines changed

2 files changed

+23
-13
lines changed

release_notes.md

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
### Release notes
2-
3-
<!-- Please add your release notes in the following format:
4-
- My change description (#PR)
5-
-->
6-
- Adding activity sources for Durable and WebJobs (Kafka and RabbitMQ) (#11137)
7-
- Add JitTrace Files for v4.1041
8-
- Fix startup deadlock on transient exceptions (#11142)
9-
- Add warning log for end of support bundle version, any bundle version < 4 (#11075), (#11160)
10-
- Handles loading extensions.json with empty extensions(#11174)
11-
- Update HttpWorkerOptions to implement IOptionsFormatter (#11175)
12-
- Improved metadata binding validation (#11101)
1+
### Release notes
2+
3+
<!-- Please add your release notes in the following format:
4+
- My change description (#PR)
5+
-->
6+
- Adding activity sources for Durable and WebJobs (Kafka and RabbitMQ) (#11137)
7+
- Add JitTrace Files for v4.1041
8+
- Fix startup deadlock on transient exceptions (#11142)
9+
- Add warning log for end of support bundle version, any bundle version < 4 (#11075), (#11160)
10+
- Handles loading extensions.json with empty extensions(#11174)
11+
- Update HttpWorkerOptions to implement IOptionsFormatter (#11175)
12+
- Improved metadata binding validation (#11101)
13+
- Skip logging errors on gRPC client disconnect (#10572)

src/WebJobs.Script.Grpc/Server/FunctionRpcService.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,17 @@
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

44
using System;
5+
using System.IO;
56
using System.Reactive.Linq;
67
using System.Threading;
78
using System.Threading.Channels;
89
using System.Threading.Tasks;
910
using Grpc.Core;
11+
using Microsoft.AspNetCore.Connections;
1012
using Microsoft.Azure.WebJobs.Script.Eventing;
1113
using Microsoft.Azure.WebJobs.Script.Grpc.Eventing;
1214
using Microsoft.Azure.WebJobs.Script.Grpc.Messages;
1315
using Microsoft.Extensions.Logging;
14-
1516
using MsgType = Microsoft.Azure.WebJobs.Script.Grpc.Messages.StreamingMessage.ContentOneofCase;
1617

1718
namespace Microsoft.Azure.WebJobs.Script.Grpc
@@ -75,6 +76,14 @@ static Task<Task<bool>> MoveNextAsync(IAsyncStreamReader<StreamingMessage> reque
7576
}
7677
}
7778
}
79+
catch (IOException ex) when (ex.InnerException is ConnectionAbortedException && context.CancellationToken.IsCancellationRequested)
80+
{
81+
// Expected when the client disconnects.
82+
// Client side stream termination (e.g., process exit or network interruption)
83+
// can cause MoveNext() to throw an IOException with a ConnectionAbortedException as the inner exception.
84+
// If ServerCallContext's cancellation token is also canceled at this point, the exception can be safely ignored.
85+
return;
86+
}
7887
catch (Exception rpcException)
7988
{
8089
// We catch the exception, just to report it, then re-throw it

0 commit comments

Comments
 (0)