RabbitMQ IModel.Dispose 挂起
RabbitMQ IModel.Dispose hangs
出于某种原因,这开始发生了。昨天没有。我的客户端在 channel.Dispose
channel.BasicPublish
returns 之后挂起。我的连接 没有 坏,即它处于打开状态并且应用程序没有按照 https://groups.google.com/forum/?fromgroups=#!topic/rabbitmq-discuss/5nzeEqI5qxw 中的建议关闭。两种方式的行为相同:
using (var channel = _connection.CreateModel()) {
//use channel here
}
和
var channel = _connection.CreateModel()
//use channel here
channel.Dispose();
他们在这个问题上有错误 25255 - link。
现在尝试在此调用周围使用超时。
private void DisconnectWithTimeout(IConnection connection, int timeoutMillis)
{
var task = Task.Run(() => connection.Dispose());
if (!task.Wait(timeoutMillis))
{
//timeout
throw new TimeoutException("Timeout on connection.Dispose()");
}
}
出于某种原因,这开始发生了。昨天没有。我的客户端在 channel.Dispose
channel.BasicPublish
returns 之后挂起。我的连接 没有 坏,即它处于打开状态并且应用程序没有按照 https://groups.google.com/forum/?fromgroups=#!topic/rabbitmq-discuss/5nzeEqI5qxw 中的建议关闭。两种方式的行为相同:
using (var channel = _connection.CreateModel()) {
//use channel here
}
和
var channel = _connection.CreateModel()
//use channel here
channel.Dispose();
他们在这个问题上有错误 25255 - link。
现在尝试在此调用周围使用超时。
private void DisconnectWithTimeout(IConnection connection, int timeoutMillis)
{
var task = Task.Run(() => connection.Dispose());
if (!task.Wait(timeoutMillis))
{
//timeout
throw new TimeoutException("Timeout on connection.Dispose()");
}
}