You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by "Arnaud Simon (JIRA)" <qp...@incubator.apache.org> on 2008/02/29 15:24:51 UTC

[jira] Created: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

AMQP session Dispatcher threads still running after the session is closed 
--------------------------------------------------------------------------

                 Key: QPID-823
                 URL: https://issues.apache.org/jira/browse/QPID-823
             Project: Qpid
          Issue Type: Bug
          Components: Java Client
    Affects Versions: M3
            Reporter: Arnaud Simon
             Fix For: M3




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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Arnaud Simon (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573777#action_12573777 ] 

Arnaud Simon commented on QPID-823:
-----------------------------------

yea, I agree with that, we should never use interrupt really but rather notify on the lock (_lock). 

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Rafael H. Schloming (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573773#action_12573773 ] 

Rafael H. Schloming commented on QPID-823:
------------------------------------------

That fix is a good one to apply, however I believe there may still be at least a hypothetical issue with the current approach to stopping the dispatcher thread. In particular the general approach of using interrupts to stop the thread is rather fragile. I have further changes that make this process more robust by using a closeable queue rather than depending on interrupts to stop the thread.

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Arnaud Simon (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12574968#action_12574968 ] 

Arnaud Simon commented on QPID-823:
-----------------------------------

I believe that we can close this JIRA. 

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Arnaud Simon (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573763#action_12573763 ] 

Arnaud Simon commented on QPID-823:
-----------------------------------

The dispatcher thread is closed before consumers are canceled. When  consumers are canceled a cancel ok message is received resulting in a new dispatcher thread  being created. A simple solution is to stop the dispatcher thread after consumers have been canceled (this has already been done in the M2 branch already).     

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Updated: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Aidan Skinner (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aidan Skinner updated QPID-823:
-------------------------------

    Assignee: Arnaud Simon

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>            Assignee: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Rafael H. Schloming (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12573778#action_12573778 ] 

Rafael H. Schloming commented on QPID-823:
------------------------------------------

I've also modified ConnectionCloseTest to check the number of threads created during iteration (it opens/closes about 1000 connections). This should prevent this bug from cropping up again.

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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


[jira] Resolved: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Marnie McCormack (JIRA)" <qp...@incubator.apache.org>.
     [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Marnie McCormack resolved QPID-823.
-----------------------------------

    Resolution: Fixed

Raising new JIRA as oer Rafi's comments

> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>            Assignee: Arnaud Simon
>             Fix For: M4
>
>


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


[jira] Commented: (QPID-823) AMQP session Dispatcher threads still running after the session is closed

Posted by "Rafael H. Schloming (JIRA)" <qp...@incubator.apache.org>.
    [ https://issues.apache.org/jira/browse/QPID-823?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12577004#action_12577004 ] 

Rafael H. Schloming commented on QPID-823:
------------------------------------------

I believe there are several issues in the dispatcher code that need to be rectified, so if we close this JIRA we should open at least one new one to cover these issues:

  - The dispatcher thread uses it's own _closed variable which shadows the session's. It's unclear why this is so, and at least some of the leaked dispatcher threads observed would have exited had the dispatcher code reference the session's closed variable rather than its own.

  - The fact that the dispatcher thread is instantiated on demand seems both unnecessary and accident prone. This is also responsible for some of the leaked threads observed, particularly in combination with the above issue where a dispatcher thread is created on demand after the session is closed.

  - The dispatcher object itself has code on it that would be better as private methods on the session. Because this code is on the dispatcher class, the dispatcher has to be re-instantiated just to call it. This was the cause of the leaked dispatcher threads as Arnaud describes above.

  - The code in confirmConsumerCancelled(...) that checks if the dispatcher is null and the starts it if necessary is not thread safe. This should either be synchronized, or eliminated entirely by not instantiating the dispatcher thread on demand and/or moving rejectPending(...) out to the session so it can be called without access to the dispatcher object.

  - As mentioned above, interrupt() is not a safe way to shutdown the dispatcher thread. As coded it could at least hypothetically interrupt the application while it's in the middle of a message handler, and, by causing the thread to exit after removing a message from the queue, but prior to handling or releasing the message, it may cause the client to drop messages should have either been handled or released.


> AMQP session Dispatcher threads still running after the session is closed 
> --------------------------------------------------------------------------
>
>                 Key: QPID-823
>                 URL: https://issues.apache.org/jira/browse/QPID-823
>             Project: Qpid
>          Issue Type: Bug
>          Components: Java Client
>    Affects Versions: M3
>            Reporter: Arnaud Simon
>             Fix For: M3
>
>


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