﻿<?xml version="1.0" encoding="utf-8"?><rss version="2.0"><channel><title>Ayende @ Rahien</title><link>http://ayende.com</link><description>Ayende @ Rahien</description><copyright>Copyright (C) Ayende Rahien  2004 - 2021 (c) 2026</copyright><ttl>60</ttl><item><title>Peter Morris commented on Find the bug</title><description>Ayende, I don't doubt it at all, but there are many reasons why you shouldn't be testing for that scenario in the way that you are.  If the code is structured properly (which I assume it is, I haven't looked) then there are much better ways of testing for it. 
</description><link>http://ayende.com/3975/find-the-bug#comment18</link><guid>http://ayende.com/3975/find-the-bug#comment18</guid><pubDate>Fri, 24 Apr 2009 20:23:32 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Peter,
  
This Peter,
  
That test is there to uncover a bug where we would send several copies of the message to the receiver
</description><link>http://ayende.com/3975/find-the-bug#comment17</link><guid>http://ayende.com/3975/find-the-bug#comment17</guid><pubDate>Fri, 24 Apr 2009 17:17:29 GMT</pubDate></item><item><title>Peter Morris commented on Find the bug</title><description>That's the source (which I would need), but what exactly is the nature of the test?
  
  
Should get two items when two items are sent
  
there should be no more than two items
  
  
</description><link>http://ayende.com/3975/find-the-bug#comment16</link><guid>http://ayende.com/3975/find-the-bug#comment16</guid><pubDate>Fri, 24 Apr 2009 12:33:33 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Gerke,
  
DING DING DING DING
  
You GOT it.
  
And it took you a LOT less than what it took me.
  
For fun &amp; games, this also can happen on another thread, isn't this FUN?
</description><link>http://ayende.com/3975/find-the-bug#comment15</link><guid>http://ayende.com/3975/find-the-bug#comment15</guid><pubDate>Fri, 24 Apr 2009 12:21:56 GMT</pubDate></item><item><title>Gerke commented on Find the bug</title><description>What does the transaction scope do with receiver on disposal of the scope (leave of using block) after ObjectDisposedException of receiver?
</description><link>http://ayende.com/3975/find-the-bug#comment14</link><guid>http://ayende.com/3975/find-the-bug#comment14</guid><pubDate>Fri, 24 Apr 2009 12:17:52 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>[rhino-tools.svn.sourceforge.net/.../queues](https://rhino-tools.svn.sourceforge.net/svnroot/rhino-tools/trunk/queues)</description><link>http://ayende.com/3975/find-the-bug#comment13</link><guid>http://ayende.com/3975/find-the-bug#comment13</guid><pubDate>Fri, 24 Apr 2009 12:16:54 GMT</pubDate></item><item><title>Peter Morris commented on Find the bug</title><description>Ayende, explain the requirement to me and I would be happy to.
  
  
</description><link>http://ayende.com/3975/find-the-bug#comment12</link><guid>http://ayende.com/3975/find-the-bug#comment12</guid><pubDate>Fri, 24 Apr 2009 12:14:27 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Tommaso,
  
No, it can't, because that is what the test is testing
  
Well, not really, the test isn't testing that
  
It cannot be 5 because messages are received in send order, so it would always be 4
</description><link>http://ayende.com/3975/find-the-bug#comment11</link><guid>http://ayende.com/3975/find-the-bug#comment11</guid><pubDate>Fri, 24 Apr 2009 12:10:21 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Sergey,
  
When you dispose, you also break all receives, that is not actually a problem.
  
You are close when you are thinking about transactions, but you are going in the wrong way.
  
  
If queue receive fail, it is either a timeout or dispose, all others would cause it to exit fully
</description><link>http://ayende.com/3975/find-the-bug#comment10</link><guid>http://ayende.com/3975/find-the-bug#comment10</guid><pubDate>Fri, 24 Apr 2009 12:08:52 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Peter,
  
Find me another wait to wait until a message does _not_ arrive, I'll fix this
</description><link>http://ayende.com/3975/find-the-bug#comment9</link><guid>http://ayende.com/3975/find-the-bug#comment9</guid><pubDate>Fri, 24 Apr 2009 12:06:48 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Jason &amp; Peter,
  
It will only cause it to go into a loop of throwing ObjectDisposedException, nothing that would actually cause harm, until it fall out of the loop when we set keepRunning to false.
  
You aren't thinking about it deeply enough, look what else may be involved.
</description><link>http://ayende.com/3975/find-the-bug#comment8</link><guid>http://ayende.com/3975/find-the-bug#comment8</guid><pubDate>Fri, 24 Apr 2009 12:04:49 GMT</pubDate></item><item><title>Jason commented on Find the bug</title><description>receiver.Dispose will cause receiver.Receive to throw ObjectDisposedException (presumably), but then since keepRunning is still true, Receiver will call receiver.Receive again, which is the bug?
</description><link>http://ayende.com/3975/find-the-bug#comment7</link><guid>http://ayende.com/3975/find-the-bug#comment7</guid><pubDate>Fri, 24 Apr 2009 11:10:15 GMT</pubDate></item><item><title>Sergey commented on Find the bug</title><description>Probably, after while(true) loop breaks after msgs.Count == 2 receiver will be waiting for third message for 10 secs but you are disposing it in 2 secs – who is going to throw TimeoutException then? 
  
  
It looks the queue is transactional. How are you going to reach msgs.Count == 2 to break while(true) loop if queue receives fail and roll-backs with moving messages to poison-message queue? 
  
</description><link>http://ayende.com/3975/find-the-bug#comment6</link><guid>http://ayende.com/3975/find-the-bug#comment6</guid><pubDate>Fri, 24 Apr 2009 09:52:09 GMT</pubDate></item><item><title>Peter Morris commented on Find the bug</title><description>Oh, and the bug is this...
  
  
receiver.Dispose();
  
keepRunning = false;
  
  
Which is effectively (sometimes) this
  
  
receiver.Dispose();
  
msg = receiver.Receive("uno", null, new TimeSpan(0, 0, 10));
  
keepRunning = false;
  
  
  
  
</description><link>http://ayende.com/3975/find-the-bug#comment5</link><guid>http://ayende.com/3975/find-the-bug#comment5</guid><pubDate>Fri, 24 Apr 2009 09:36:03 GMT</pubDate></item><item><title>Tommaso Caldarola commented on Find the bug</title><description>msgs[0] could be "Message 5"
</description><link>http://ayende.com/3975/find-the-bug#comment4</link><guid>http://ayende.com/3975/find-the-bug#comment4</guid><pubDate>Fri, 24 Apr 2009 09:34:27 GMT</pubDate></item><item><title>Peter Morris commented on Find the bug</title><description>Right, so *all* of this code is in the tests then?
  
  
As for the Thread.Sleep, that's just awful :-)
</description><link>http://ayende.com/3975/find-the-bug#comment3</link><guid>http://ayende.com/3975/find-the-bug#comment3</guid><pubDate>Fri, 24 Apr 2009 09:30:32 GMT</pubDate></item><item><title>Ayende Rahien commented on Find the bug</title><description>Peter,
  
because Receiver is the component under test, it doesn't know whatever it should keep running or not.
  
As for Thread.Sleep, yes, it is in the test. This is a time sensitive test.
</description><link>http://ayende.com/3975/find-the-bug#comment2</link><guid>http://ayende.com/3975/find-the-bug#comment2</guid><pubDate>Fri, 24 Apr 2009 09:10:44 GMT</pubDate></item><item><title>Peter Morris commented on Find the bug</title><description>My thoughts are
  
  
Why does the test have a "keepRunning" member?  Surely receiver.Dispose should set keepRunning = false and then wait for the while loop to end?  Personally I'd also change KeepRunning to IsDisposed or something.
  
  
But what I'd like to say most of all is this.  You don't REALLY have code like Thread.Sleep(2000) in your tests do you?
</description><link>http://ayende.com/3975/find-the-bug#comment1</link><guid>http://ayende.com/3975/find-the-bug#comment1</guid><pubDate>Fri, 24 Apr 2009 09:07:04 GMT</pubDate></item></channel></rss>