You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by tariq zafar <ta...@yahoo.co.in> on 2015/06/08 14:30:20 UTC

Regarding activemq sockets not getting closed

I am having an issue with activemq broker. My requirement is that whenever
the same client requests for a connection again then I should close the
existing connection with that client and start a new one. For this purpose I
have written a plugin that calls old connection closure getting the
connection details that were saved in two maps earlier (for
ConnectionContext and ConnectionInfo respectively) when that connection was
created.

I call these apis

*
((TransportConnection)localConnectionContext.getConnection()).processRemoveConnection();
//localConnectionContext is got from connContext save in map.
((TransportConnection)localConnectionContext.getConnection()).stop();
*

Using this code whenever I connect through another client with same client
id in jconsole I can see remote address for the client getting changed and
old remote address getting removed.

However, my connection is getting closed only on activemq level and not on
tcp level. Using netstat -a I can still see old connections that were made
through same client in establishes state. I am using a websocket connection.
What tcp setting should I do in activemq.xml that old sockets get closed on
tcp level?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-activemq-sockets-not-getting-closed-tp4697390.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Regarding activemq sockets not getting closed

Posted by tariq zafar <ta...@yahoo.co.in>.
Hi

Can you please tell me how do I debug activemq code to test my plugin?

Regards
Tariq



--
View this message in context: http://activemq.2283324.n4.nabble.com/Regarding-activemq-sockets-not-getting-closed-tp4697390p4697608.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Regarding activemq sockets not getting closed

Posted by Timothy Bish <ta...@gmail.com>.
Think the original message indicates that WebSockets are being used, if
so I'd recommend trying the latest SNAPSHOT of 5.12 as I fixed a number
of issues around lingering connections from WebSocket clients

On 06/10/2015 08:39 AM, Tim Bain wrote:
> You can debug the broker just like you'd debug any remote Java application:
> http://www.codeproject.com/Articles/795423/Remote-Debug-Java-Applications-From-Eclipse
>
> Make sure you download the source code for the exact version of ActiveMQ
> that you're using so you can attach source and step through properly;
> otherwise line numbers won't match up and it'll be a very frustrating
> experience.
>
> Tim
> On Jun 9, 2015 7:43 AM, "Tim Bain" <tb...@alumni.duke.edu> wrote:
>
>> Can you put a breakpoint on the call to socket.close() in
>> TcpTransport.doStop() (
>> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.activemq/activemq-client/5.11.1/org/apache/activemq/transport/tcp/TcpTransport.java#TcpTransport.doStop%28org.apache.activemq.util.ServiceStopper%29)
>> and see whether it's actually calling close() on the socket and also
>> whether it's succeeding?
>>
>> Tim
>>
>> On Mon, Jun 8, 2015 at 6:30 AM, tariq zafar <ta...@yahoo.co.in>
>> wrote:
>>
>>> I am having an issue with activemq broker. My requirement is that whenever
>>> the same client requests for a connection again then I should close the
>>> existing connection with that client and start a new one. For this
>>> purpose I
>>> have written a plugin that calls old connection closure getting the
>>> connection details that were saved in two maps earlier (for
>>> ConnectionContext and ConnectionInfo respectively) when that connection
>>> was
>>> created.
>>>
>>> I call these apis
>>>
>>> *
>>>
>>> ((TransportConnection)localConnectionContext.getConnection()).processRemoveConnection();
>>> //localConnectionContext is got from connContext save in map.
>>> ((TransportConnection)localConnectionContext.getConnection()).stop();
>>> *
>>>
>>> Using this code whenever I connect through another client with same client
>>> id in jconsole I can see remote address for the client getting changed and
>>> old remote address getting removed.
>>>
>>> However, my connection is getting closed only on activemq level and not on
>>> tcp level. Using netstat -a I can still see old connections that were made
>>> through same client in establishes state. I am using a websocket
>>> connection.
>>> What tcp setting should I do in activemq.xml that old sockets get closed
>>> on
>>> tcp level?
>>>
>>>
>>>
>>> --
>>> View this message in context:
>>> http://activemq.2283324.n4.nabble.com/Regarding-activemq-sockets-not-getting-closed-tp4697390.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>


-- 
Tim Bish
Sr Software Engineer | RedHat Inc.
tim.bish@redhat.com | www.redhat.com 
twitter: @tabish121
blog: http://timbish.blogspot.com/


Re: Regarding activemq sockets not getting closed

Posted by Tim Bain <tb...@alumni.duke.edu>.
You can debug the broker just like you'd debug any remote Java application:
http://www.codeproject.com/Articles/795423/Remote-Debug-Java-Applications-From-Eclipse

Make sure you download the source code for the exact version of ActiveMQ
that you're using so you can attach source and step through properly;
otherwise line numbers won't match up and it'll be a very frustrating
experience.

Tim
On Jun 9, 2015 7:43 AM, "Tim Bain" <tb...@alumni.duke.edu> wrote:

> Can you put a breakpoint on the call to socket.close() in
> TcpTransport.doStop() (
> http://grepcode.com/file/repo1.maven.org/maven2/org.apache.activemq/activemq-client/5.11.1/org/apache/activemq/transport/tcp/TcpTransport.java#TcpTransport.doStop%28org.apache.activemq.util.ServiceStopper%29)
> and see whether it's actually calling close() on the socket and also
> whether it's succeeding?
>
> Tim
>
> On Mon, Jun 8, 2015 at 6:30 AM, tariq zafar <ta...@yahoo.co.in>
> wrote:
>
>> I am having an issue with activemq broker. My requirement is that whenever
>> the same client requests for a connection again then I should close the
>> existing connection with that client and start a new one. For this
>> purpose I
>> have written a plugin that calls old connection closure getting the
>> connection details that were saved in two maps earlier (for
>> ConnectionContext and ConnectionInfo respectively) when that connection
>> was
>> created.
>>
>> I call these apis
>>
>> *
>>
>> ((TransportConnection)localConnectionContext.getConnection()).processRemoveConnection();
>> //localConnectionContext is got from connContext save in map.
>> ((TransportConnection)localConnectionContext.getConnection()).stop();
>> *
>>
>> Using this code whenever I connect through another client with same client
>> id in jconsole I can see remote address for the client getting changed and
>> old remote address getting removed.
>>
>> However, my connection is getting closed only on activemq level and not on
>> tcp level. Using netstat -a I can still see old connections that were made
>> through same client in establishes state. I am using a websocket
>> connection.
>> What tcp setting should I do in activemq.xml that old sockets get closed
>> on
>> tcp level?
>>
>>
>>
>> --
>> View this message in context:
>> http://activemq.2283324.n4.nabble.com/Regarding-activemq-sockets-not-getting-closed-tp4697390.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>
>

Re: Regarding activemq sockets not getting closed

Posted by Tim Bain <tb...@alumni.duke.edu>.
Can you put a breakpoint on the call to socket.close() in
TcpTransport.doStop() (
http://grepcode.com/file/repo1.maven.org/maven2/org.apache.activemq/activemq-client/5.11.1/org/apache/activemq/transport/tcp/TcpTransport.java#TcpTransport.doStop%28org.apache.activemq.util.ServiceStopper%29)
and see whether it's actually calling close() on the socket and also
whether it's succeeding?

Tim

On Mon, Jun 8, 2015 at 6:30 AM, tariq zafar <ta...@yahoo.co.in>
wrote:

> I am having an issue with activemq broker. My requirement is that whenever
> the same client requests for a connection again then I should close the
> existing connection with that client and start a new one. For this purpose
> I
> have written a plugin that calls old connection closure getting the
> connection details that were saved in two maps earlier (for
> ConnectionContext and ConnectionInfo respectively) when that connection was
> created.
>
> I call these apis
>
> *
>
> ((TransportConnection)localConnectionContext.getConnection()).processRemoveConnection();
> //localConnectionContext is got from connContext save in map.
> ((TransportConnection)localConnectionContext.getConnection()).stop();
> *
>
> Using this code whenever I connect through another client with same client
> id in jconsole I can see remote address for the client getting changed and
> old remote address getting removed.
>
> However, my connection is getting closed only on activemq level and not on
> tcp level. Using netstat -a I can still see old connections that were made
> through same client in establishes state. I am using a websocket
> connection.
> What tcp setting should I do in activemq.xml that old sockets get closed on
> tcp level?
>
>
>
> --
> View this message in context:
> http://activemq.2283324.n4.nabble.com/Regarding-activemq-sockets-not-getting-closed-tp4697390.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>