<p>What happens if you remove the heartbeat setting?</p>
<div class="gmail_quote">On Dec 29, 2011 5:43 PM, &quot;Dave Stevens&quot; &lt;<a href="mailto:daverstevens@gmail.com">daverstevens@gmail.com</a>&gt; wrote:<br type="attribution"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
I get the same exception with this:<br>
<br>
� � � � [Test(Description = &quot;ObjectDispositionException&quot;)]<br>
� � � � public void TestFail()<br>
� � � � {<br>
� � � � � � var cf = new ConnectionFactory<br>
� � � � � � � � � � � � �{<br>
� � � � � � � � � � � � � � �HostName = &quot;10.10.8.96&quot;,<br>
� � � � � � � � � � � � � � �Port = 5672,<br>
� � � � � � � � � � � � � � �RequestedHeartbeat = 2<br>
� � � � � � � � � � � � �};<br>
� � � � � � using (var connection = cf.CreateConnection())<br>
� � � � � � using (var model = connection.CreateModel())<br>
� � � � � � {<br>
� � � � � � � � Thread.Sleep(TimeSpan.FromSeconds(1));<br>
� � � � � � }<br>
� � � � }<br>
<br>
On Thu, Dec 29, 2011 at 2:59 AM, Simone Busoli &lt;<a href="mailto:simone.busoli@gmail.com">simone.busoli@gmail.com</a>&gt; wrote:<br>
&gt;<br>
&gt; Hi Dave, although counterintuitive the documentation of the .NET client states that explicitly. The connection closure/disposal is not idempotent, i.e. you shall not call it twice.<br>
&gt;<br>
&gt; On Dec 29, 2011 1:41 AM, &quot;Dave Stevens&quot; &lt;<a href="mailto:daverstevens@gmail.com">daverstevens@gmail.com</a>&gt; wrote:<br>
&gt;&gt;<br>
&gt;&gt; I am getting the following exception when disposing a connection. I<br>
&gt;&gt; had previously noticed this when going from RabbitMQ Client 2.5.1 to<br>
&gt;&gt; 2.7.0 which caused me to back out the update. I ended up going to<br>
&gt;&gt; 2.7.1 because I thought I found a shutdown issue in my own code. The<br>
&gt;&gt; exception did not present itself again until I started testing some<br>
&gt;&gt; reconnect logic. I first noticed it again after simply pulling the<br>
&gt;&gt; plug on my network.<br>
&gt;&gt;<br>
&gt;&gt; System.ObjectDisposedException: Cannot access a disposed object.<br>
&gt;&gt; Object name: &#39;System.Net.Sockets.Socket&#39;.<br>
&gt;&gt; at System.Net.Sockets.Socket.SetSocketOption(SocketOptionLevel<br>
&gt;&gt; optionLevel, SocketOptionName optionName, Object optionValue)<br>
&gt;&gt; at RabbitMQ.Client.Impl.SocketFrameHandler_0_9.Close()<br>
&gt;&gt; at RabbitMQ.Client.Impl.ConnectionBase.FinishClose()<br>
&gt;&gt; at RabbitMQ.Client.Impl.ConnectionBase.HeartbeatWriteLoop()<br>
&gt;&gt; at System.Threading.ThreadHelper.ThreadStart_Context(Object state)<br>
&gt;&gt; at System.Threading.ExecutionContext.runTryCode(Object userData)<br>
&gt;&gt; at<br>
&gt;&gt; System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode<br>
&gt;&gt; code, CleanupCode backoutCode, Object userData)<br>
&gt;&gt; at System.Threading.ExecutionContext.RunInternal(ExecutionContext<br>
&gt;&gt; executionContext, ContextCallback callback, Object state)<br>
&gt;&gt; at System.Threading.ExecutionContext.Run(ExecutionContext<br>
&gt;&gt; executionContext, ContextCallback callback, Object state, Boolean<br>
&gt;&gt; ignoreSyncCtx)<br>
&gt;&gt; at System.Threading.ExecutionContext.Run(ExecutionContext<br>
&gt;&gt; executionContext, ContextCallback callback, Object state)<br>
&gt;&gt; at System.Threading.ThreadHelper.ThreadStart()<br>
&gt;&gt;<br>
&gt;&gt; This code is reproducible consistently with the following:<br>
&gt;&gt;<br>
&gt;&gt; using System;<br>
&gt;&gt; using System.Threading;<br>
&gt;&gt; using NUnit.Framework;<br>
&gt;&gt; using RabbitMQ.Client;<br>
&gt;&gt; using RabbitMQ.Client.Framing.v0_9;<br>
&gt;&gt;<br>
&gt;&gt; namespace BT.ThirdPartyProxy.Functional.Test.FunctionalTests<br>
&gt;&gt; {<br>
&gt;&gt; � �[TestFixture]<br>
&gt;&gt; � �public class TestingObjectDispositionException<br>
&gt;&gt; � �{<br>
&gt;&gt; � � � �[Test(Description = &quot;ObjectDispositionException&quot;)]<br>
&gt;&gt; � � � �public void TestFail()<br>
&gt;&gt; � � � �{<br>
&gt;&gt; � � � � � �var cf = new ConnectionFactory<br>
&gt;&gt; � � � � � � � � � � � � {<br>
&gt;&gt; � � � � � � � � � � � � � � HostName = INSERT_IP_HERE,<br>
&gt;&gt; � � � � � � � � � � � � � � Port = 5672,<br>
&gt;&gt; � � � � � � � � � � � � � � RequestedHeartbeat = 2<br>
&gt;&gt; � � � � � � � � � � � � };<br>
&gt;&gt; � � � � � �using (var connection = cf.CreateConnection())<br>
&gt;&gt; � � � � � �using (var model = connection.CreateModel())<br>
&gt;&gt; � � � � � �{<br>
&gt;&gt; � � � � � � � �Thread.Sleep(TimeSpan.FromSeconds(1));<br>
&gt;&gt; � � � � � � � �model.Close(Constants.ReplySuccess, &quot;Goodbye&quot;);<br>
&gt;&gt; � � � � � � � �connection.Close(Constants.ReplySuccess, &quot;Goodbye&quot;);<br>
&gt;&gt; � � � � � � � �Thread.Sleep(TimeSpan.FromSeconds(1));<br>
&gt;&gt; � � � � � �}<br>
&gt;&gt; � � � �}<br>
&gt;&gt; � �}<br>
&gt;&gt; }<br>
&gt;&gt;<br>
&gt;&gt;<br>
&gt;&gt; I am using RabbitMQ.Client.dll 2.7.1.0 in .NET 4.0 app on Windows<br>
&gt;&gt; server 2003 going against RabbitMQ 2.7.0 running on Ubuntu.<br>
&gt;&gt;<br>
&gt;&gt; Status of node rabbit@xxx ...<br>
&gt;&gt; [{pid,1344},<br>
&gt;&gt; �{running_applications,<br>
&gt;&gt; � � [{rabbitmq_management,&quot;RabbitMQ Management Console&quot;,&quot;2.7.0&quot;},<br>
&gt;&gt; � � �{rabbitmq_management_agent,&quot;RabbitMQ Management Agent&quot;,&quot;2.7.0&quot;},<br>
&gt;&gt; � � �{amqp_client,&quot;RabbitMQ AMQP Client&quot;,&quot;2.7.0&quot;},<br>
&gt;&gt; � � �{rabbit,&quot;RabbitMQ&quot;,&quot;2.7.0&quot;},<br>
&gt;&gt; � � �{os_mon,&quot;CPO �CXC 138 46&quot;,&quot;2.2.5&quot;},<br>
&gt;&gt; � � �{sasl,&quot;SASL �CXC 138 11&quot;,&quot;2.1.9.3&quot;},<br>
&gt;&gt; � � �{rabbitmq_mochiweb,&quot;RabbitMQ Mochiweb Embedding&quot;,&quot;2.7.0&quot;},<br>
&gt;&gt; � � �{webmachine,&quot;webmachine&quot;,&quot;1.7.0-rmq2.7.0-hg&quot;},<br>
&gt;&gt; � � �{mochiweb,&quot;MochiMedia Web Server&quot;,&quot;1.3-rmq2.7.0-git&quot;},<br>
&gt;&gt; � � �{inets,&quot;INETS �CXC 138 49&quot;,&quot;5.5.2&quot;},<br>
&gt;&gt; � � �{mnesia,&quot;MNESIA �CXC 138 12&quot;,&quot;4.4.17&quot;},<br>
&gt;&gt; � � �{stdlib,&quot;ERTS �CXC 138 10&quot;,&quot;1.17.3&quot;},<br>
&gt;&gt; � � �{kernel,&quot;ERTS �CXC 138 10&quot;,&quot;2.14.3&quot;}]},<br>
&gt;&gt; �{os,{unix,linux}},<br>
&gt;&gt; �{erlang_version,<br>
&gt;&gt; � � &quot;Erlang R14B02 (erts-5.8.3) [source] [64-bit] [smp:8:8] [rq:8]<br>
&gt;&gt; [async-threads:30] [kernel-poll:true]\n&quot;},<br>
&gt;&gt; �{memory,<br>
&gt;&gt; � � [{total,31177024},<br>
&gt;&gt; � � �{processes,11828776},<br>
&gt;&gt; � � �{processes_used,11772888},<br>
&gt;&gt; � � �{system,19348248},<br>
&gt;&gt; � � �{atom,1355273},<br>
&gt;&gt; � � �{atom_used,1339382},<br>
&gt;&gt; � � �{binary,84928},<br>
&gt;&gt; � � �{code,14547474},<br>
&gt;&gt; � � �{ets,1099944}]},<br>
&gt;&gt; �{vm_memory_high_watermark,0.39999999995232727},<br>
&gt;&gt; �{vm_memory_limit,<a href="tel:5034326425" value="+15034326425">5034326425</a>}]<br>
&gt;&gt; ...done.<br>
&gt;&gt; _______________________________________________<br>
&gt;&gt; rabbitmq-discuss mailing list<br>
&gt;&gt; <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com">rabbitmq-discuss@lists.rabbitmq.com</a><br>
&gt;&gt; <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div>