activemq-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Christopher L. Shannon (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (AMQ-6561) Broker does not close connection for all connection attempt errors
Date Tue, 17 Jan 2017 12:08:26 GMT

    [ https://issues.apache.org/jira/browse/AMQ-6561?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15825948#comment-15825948
] 

Christopher L. Shannon edited comment on AMQ-6561 at 1/17/17 12:07 PM:
-----------------------------------------------------------------------

The sockets will stay in established state if they stay open.  The issue occurs if a new connection
from a client fails for a reason other than a security reason (such as invalid clientId) and
then the client doesn't close the socket on their end.  So if the client calls close() on
their connection after they get an error or if they shutdown the JVM then the socket would
close and it would be fine.  As far as the behavior, you just end up with a bunch of open
sockets that won't be closed.  This of course is bad as you can run out of file descriptors,
etc.

If you want to see the behavior in action take a look at the unit test I committed: https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob;f=activemq-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportCloseSocketTest.java;h=ad2080beaea2a21c24a37003cbab6c7a63344aa1;hb=df7aa6e

This test shows that after the fix there is only 1 socket open instead of 2 because the second
connection attempt fails.  If you run this test against an older version such as 5.14.3 then
there will be 2 sockets open even though the second connection attempt failed with an InvalidClientIDException
because both the broker and client didn't close the socket.


was (Author: christopher.l.shannon):
The sockets will stay in established state if they stay open.  The issue occurs if a new connection
from a client fails for a reason other than a security reason (such as invalid clientId) and
then the client doesn't close the socket on their end.  So if the client calls close() on
their connection after they get an error or if they shutdown the JVM then the socket would
close and it would be fine. 

If you want to see the behavior in action take a look at the unit test I committed: https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob;f=activemq-unit-tests/src/test/java/org/apache/activemq/transport/tcp/TcpTransportCloseSocketTest.java;h=ad2080beaea2a21c24a37003cbab6c7a63344aa1;hb=df7aa6e

This test shows that after the fix there is only 1 socket open instead of 2 because the second
connection attempt fails.  If you run this test against an older version such as 5.14.3 then
there will be 2 sockets open even though the second connection attempt failed with an InvalidClientIDException
because both the broker and client didn't close the socket.

> Broker does not close connection for all connection attempt errors
> ------------------------------------------------------------------
>
>                 Key: AMQ-6561
>                 URL: https://issues.apache.org/jira/browse/AMQ-6561
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.14.3
>            Reporter: Christopher L. Shannon
>            Assignee: Christopher L. Shannon
>             Fix For: 5.15.0, 5.14.4
>
>
> When a client connects to the broker the connection gets added inside the processAddConnection
method in TransportConnection.  Right now if there is an exception the socket is only shutdown
if the type of exception is SecurityException.  However the connection should really be closed
if any error occurs when trying to add the connection.  
> For example if an InvalidClientIDException occurs then the connection is no longer tracked
by the broker but the socket stays open until the client actually closes it on their end.
This should be fixed so that the error terminates the socket connection since the connection
attempt failed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message