Re: [jgroups-dev] FLUSH.blockMessageDuringFlush() broken?
Vladimir Blagojevic <[email protected]> Mon, 26 Sep 2011 16:46:53 +0200
| Newsgroups | gmane.comp.java.javagroups.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi Nicolas,
On 11-09-23 5:19 PM, balrog of moria wrote:
> Before posting to the JIRA about a potential bug, I have a question
> regarding the blockMessageDuringFlush() method in FLUSH. I'm working
> with latest 2.12.1.Final version of JGroups. I'm copying the code here:
>
> private void blockMessageDuringFlush() {
> boolean shouldSuspendByItself = false;
> blockMutex.lock();
> try {
> while (isBlockingFlushDown) {
> if (log.isDebugEnabled())
> log.debug(localAddress + ": blocking for " +
> (timeout <= 0 ? "ever" : timeout + "ms"));
> shouldSuspendByItself = !notBlockedDown.await(timeout,
> TimeUnit.MILLISECONDS);
> }
> if (shouldSuspendByItself) {
> isBlockingFlushDown = false;
> log.warn(localAddress + ": unblocking after " +
> timeout + "ms");
> flush_promise.setResult(Boolean.TRUE);
> notBlockedDown.signalAll();
> }
> } catch (InterruptedException e) {
> Thread.currentThread().interrupt();
> } finally {
> blockMutex.unlock();
> }
> }
>
> So my first question is regarding the shouldSuspendByItself flag.
> Shouldn't if the if clause be located inside the while clause since it
> seems that even if the timeout expires on the await(timeout) and the
> flag is true, since isBlockingFlushDown is still true, the if clause
> will NEVER be invoked as it will continue to wait on the timeout.
You are right. I would swear it was inside the loop before; maybe it was
moved out for some reason that I can not remember now.
>
> My second question is regarding timeouts which are 0 or negative.
> Invoking await(0L) will simply return immediately, and seeing as I've
> pointed out a bug in flushing self, it just loops forever until
> someone miraculously stops or aborts the flush normally.
Right again.
>
> I might have missed something, which is why I'm posting to this list
> ;) Thanks again
No you have not missed. These are bugs, thanks for your time looking
into this; please file a JIRA report if you have an account! If not, let
me know and I will do it.
Regards,
Vladimir
>
> Nicolas
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2dcopy2
>
>
> _______________________________________________
> Javagroups-development mailing list
>
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Javagroups-development mailing list