You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@activemq.apache.org by "Kevin Yaussy (JIRA)" <ji...@apache.org> on 2008/04/17 21:11:43 UTC

[jira] Created: (AMQ-1671) InactivityMonitor issue with regards to exceptions on a connection

InactivityMonitor issue with regards to exceptions on a connection
------------------------------------------------------------------

                 Key: AMQ-1671
                 URL: https://issues.apache.org/activemq/browse/AMQ-1671
             Project: ActiveMQ
          Issue Type: Bug
          Components: Broker, Connector, Transport
    Affects Versions: 5.1.0, 5.2.0
            Reporter: Kevin Yaussy
         Attachments: InactivityMonitor.java

I'm using the 4/16 5.2 SNAPSHOT code.

I'm reporting a new issue here, but this may be related or same as: AMQ-1482, and AMQ-1582.

The issue is that if there is an exception on a connection, such as the process goes away (could be an AMQBroker going away or a client process), the InactivityMonitor is not properly reporting this.  If maxInactivityDuration is set to 0, and the client process goes away, the AMQBroker never cleans up anything for this client, and the client can never reconnect (it will get InvalidClientID exceptions).  If maxInactivityDuration is non-zero, the connection will eventually get cleaned up when the inactivity timer pops.

The issue turns out to be this line of code in InactivityMonitor::onException

        if (!failed.compareAndSet(false,true)) {

This means that when the connection goes away, this call returns true, but the if statement is negating that so the next two lines of code in onException are never executed at this time.  Only later (if maxInactivityDuration is non-zero) will this check result in true, such that the next two lines in onException are called.

I think that this is just an issue in misinterpreting what AtomicBoolean will return for the compareAndSet method?  Assuming this to be the case, I changed this line to take out the "!".  Now everything works exactly as it should.

I've attached the changed source.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Assigned: (AMQ-1671) InactivityMonitor issue with regards to exceptions on a connection

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies reassigned AMQ-1671:
-------------------------------

    Assignee: Rob Davies

> InactivityMonitor issue with regards to exceptions on a connection
> ------------------------------------------------------------------
>
>                 Key: AMQ-1671
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1671
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Connector, Transport
>    Affects Versions: 5.1.0, 5.2.0
>            Reporter: Kevin Yaussy
>            Assignee: Rob Davies
>         Attachments: InactivityMonitor.java
>
>
> I'm using the 4/16 5.2 SNAPSHOT code.
> I'm reporting a new issue here, but this may be related or same as: AMQ-1482, and AMQ-1582.
> The issue is that if there is an exception on a connection, such as the process goes away (could be an AMQBroker going away or a client process), the InactivityMonitor is not properly reporting this.  If maxInactivityDuration is set to 0, and the client process goes away, the AMQBroker never cleans up anything for this client, and the client can never reconnect (it will get InvalidClientID exceptions).  If maxInactivityDuration is non-zero, the connection will eventually get cleaned up when the inactivity timer pops.
> The issue turns out to be this line of code in InactivityMonitor::onException
>         if (!failed.compareAndSet(false,true)) {
> This means that when the connection goes away, this call returns true, but the if statement is negating that so the next two lines of code in onException are never executed at this time.  Only later (if maxInactivityDuration is non-zero) will this check result in true, such that the next two lines in onException are called.
> I think that this is just an issue in misinterpreting what AtomicBoolean will return for the compareAndSet method?  Assuming this to be the case, I changed this line to take out the "!".  Now everything works exactly as it should.
> I've attached the changed source.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (AMQ-1671) InactivityMonitor issue with regards to exceptions on a connection

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/activemq/browse/AMQ-1671?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=42418#action_42418 ] 

Rob Davies commented on AMQ-1671:
---------------------------------

this really looks like a typo - thanks for finding it Kevin!

> InactivityMonitor issue with regards to exceptions on a connection
> ------------------------------------------------------------------
>
>                 Key: AMQ-1671
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1671
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Connector, Transport
>    Affects Versions: 5.1.0, 5.2.0
>            Reporter: Kevin Yaussy
>            Assignee: Rob Davies
>         Attachments: InactivityMonitor.java
>
>
> I'm using the 4/16 5.2 SNAPSHOT code.
> I'm reporting a new issue here, but this may be related or same as: AMQ-1482, and AMQ-1582.
> The issue is that if there is an exception on a connection, such as the process goes away (could be an AMQBroker going away or a client process), the InactivityMonitor is not properly reporting this.  If maxInactivityDuration is set to 0, and the client process goes away, the AMQBroker never cleans up anything for this client, and the client can never reconnect (it will get InvalidClientID exceptions).  If maxInactivityDuration is non-zero, the connection will eventually get cleaned up when the inactivity timer pops.
> The issue turns out to be this line of code in InactivityMonitor::onException
>         if (!failed.compareAndSet(false,true)) {
> This means that when the connection goes away, this call returns true, but the if statement is negating that so the next two lines of code in onException are never executed at this time.  Only later (if maxInactivityDuration is non-zero) will this check result in true, such that the next two lines in onException are called.
> I think that this is just an issue in misinterpreting what AtomicBoolean will return for the compareAndSet method?  Assuming this to be the case, I changed this line to take out the "!".  Now everything works exactly as it should.
> I've attached the changed source.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (AMQ-1671) InactivityMonitor issue with regards to exceptions on a connection

Posted by "Rob Davies (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/activemq/browse/AMQ-1671?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Rob Davies resolved AMQ-1671.
-----------------------------

    Fix Version/s: 5.1.0
       Resolution: Fixed

> InactivityMonitor issue with regards to exceptions on a connection
> ------------------------------------------------------------------
>
>                 Key: AMQ-1671
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1671
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker, Connector, Transport
>    Affects Versions: 5.1.0, 5.2.0
>            Reporter: Kevin Yaussy
>            Assignee: Rob Davies
>             Fix For: 5.1.0
>
>         Attachments: InactivityMonitor.java
>
>
> I'm using the 4/16 5.2 SNAPSHOT code.
> I'm reporting a new issue here, but this may be related or same as: AMQ-1482, and AMQ-1582.
> The issue is that if there is an exception on a connection, such as the process goes away (could be an AMQBroker going away or a client process), the InactivityMonitor is not properly reporting this.  If maxInactivityDuration is set to 0, and the client process goes away, the AMQBroker never cleans up anything for this client, and the client can never reconnect (it will get InvalidClientID exceptions).  If maxInactivityDuration is non-zero, the connection will eventually get cleaned up when the inactivity timer pops.
> The issue turns out to be this line of code in InactivityMonitor::onException
>         if (!failed.compareAndSet(false,true)) {
> This means that when the connection goes away, this call returns true, but the if statement is negating that so the next two lines of code in onException are never executed at this time.  Only later (if maxInactivityDuration is non-zero) will this check result in true, such that the next two lines in onException are called.
> I think that this is just an issue in misinterpreting what AtomicBoolean will return for the compareAndSet method?  Assuming this to be the case, I changed this line to take out the "!".  Now everything works exactly as it should.
> I've attached the changed source.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.