Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit137abc9

Browse files
authored
Merge pull request#1583 from rabbitmq/rabbitmq-dotnet-client-826
Handle AppDomain unload
2 parents6135e35 +bfccb14 commit137abc9

File tree

3 files changed

+36
-5
lines changed

3 files changed

+36
-5
lines changed

‎projects/RabbitMQ.Client/client/impl/AutorecoveringConnection.Recovery.cs‎

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,23 @@ static bool ShouldTriggerConnectionRecovery(ShutdownEventArgs args)
7171
}
7272
}
7373

74-
// happens when EOF is reached, e.g. due to RabbitMQ node
75-
// connectivity loss or abrupt shutdown
7674
if(args.Initiator==ShutdownInitiator.Library)
7775
{
78-
returntrue;
76+
/*
77+
* https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/826
78+
* Happens when an AppDomain is unloaded
79+
*/
80+
if(args.ExceptionisThreadAbortException&&
81+
args.ReplyCode==Constants.InternalError)
82+
{
83+
returnfalse;
84+
}
85+
else
86+
{
87+
// happens when EOF is reached, e.g. due to RabbitMQ node
88+
// connectivity loss or abrupt shutdown
89+
returntrue;
90+
}
7991
}
8092

8193
returnfalse;

‎projects/RabbitMQ.Client/client/impl/Connection.Receive.cs‎

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,19 @@ private async Task MainLoop()
5353
awaitReceiveLoopAsync(mainLoopToken)
5454
.ConfigureAwait(false);
5555
}
56+
#ifNETSTANDARD
57+
catch(ThreadAbortExceptiontaex)
58+
{
59+
/*
60+
* https://github.com/rabbitmq/rabbitmq-dotnet-client/issues/826
61+
*/
62+
varea=newShutdownEventArgs(ShutdownInitiator.Library,
63+
Constants.InternalError,
64+
"Thread aborted (AppDomain unloaded?)",
65+
exception:taex);
66+
HandleMainLoopException(ea);
67+
}
68+
#endif
5669
catch(EndOfStreamExceptioneose)
5770
{
5871
// Possible heartbeat exception

‎projects/Test/Integration/ToxiproxyManager.cs‎

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,14 @@ protected virtual void Dispose(bool disposing)
116116
{
117117
if(disposing)
118118
{
119-
_proxyClient.DeleteAsync(_proxy).GetAwaiter().GetResult();
120-
_proxyConnection.Dispose();
119+
try
120+
{
121+
_proxyClient.DeleteAsync(_proxy).GetAwaiter().GetResult();
122+
_proxyConnection.Dispose();
123+
}
124+
catch
125+
{
126+
}
121127
}
122128

123129
_disposedValue=true;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp