[jboss-jira] [JBoss JIRA] (JBMESSAGING-1928) MessagingClusterHealthMBean.makeSureDelay() can loop forever

Justin Bertram (JIRA) jira-events at lists.jboss.org
Fri Jul 6 14:39:12 EDT 2012


     [ https://issues.jboss.org/browse/JBMESSAGING-1928?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Justin Bertram updated JBMESSAGING-1928:
----------------------------------------

    Description: 
Here is MessagingClusterHealthMBean.makeSureDelay():

{code}
   private void makeSureDelay()
   {
      long delay = shutdownDelay;
      
      while (delay > 0)
      {
         long stopTime = System.currentTimeMillis();
         try
         {
            Thread.sleep(delay);
         }
         catch (InterruptedException e)
         {
         }
         delay = shutdownDelay - (System.currentTimeMillis() - stopTime);
      }
      
   }
{code}

I believe the problem here is this line:

{code}
delay = shutdownDelay - (System.currentTimeMillis() - stopTime);
{code}

On systems where the clock doesn't have good accuracy (e.g. on a virtual machine) then every time through the loop {{delay}} will be reset relative to {{shutdownDelay}}.

    
> MessagingClusterHealthMBean.makeSureDelay() can loop forever
> ------------------------------------------------------------
>
>                 Key: JBMESSAGING-1928
>                 URL: https://issues.jboss.org/browse/JBMESSAGING-1928
>             Project: JBoss Messaging
>          Issue Type: Bug
>          Components: JMS Clustering
>    Affects Versions: 1.4.8.SP7
>            Reporter: Justin Bertram
>            Assignee: Justin Bertram
>             Fix For: 1.4.8.SP8
>
>
> Here is MessagingClusterHealthMBean.makeSureDelay():
> {code}
>    private void makeSureDelay()
>    {
>       long delay = shutdownDelay;
>       
>       while (delay > 0)
>       {
>          long stopTime = System.currentTimeMillis();
>          try
>          {
>             Thread.sleep(delay);
>          }
>          catch (InterruptedException e)
>          {
>          }
>          delay = shutdownDelay - (System.currentTimeMillis() - stopTime);
>       }
>       
>    }
> {code}
> I believe the problem here is this line:
> {code}
> delay = shutdownDelay - (System.currentTimeMillis() - stopTime);
> {code}
> On systems where the clock doesn't have good accuracy (e.g. on a virtual machine) then every time through the loop {{delay}} will be reset relative to {{shutdownDelay}}.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.jboss.org/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the jboss-jira mailing list