ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » General IBM MQ Support » [SOLVED] stop conn(*) not fully cleaning up the connection

Post new topic  Reply to topic Goto page 1, 2  Next
 [SOLVED] stop conn(*) not fully cleaning up the connection « View previous topic :: View next topic » 
Author Message
RikBaeten
PostPosted: Thu Dec 09, 2010 6:30 am    Post subject: [SOLVED] stop conn(*) not fully cleaning up the connection Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

After I issue the
Code:
stop conn(id)
command, the connection is not visible anymore via
Code:
dis conn(*)
. However via the netstat command I see the corresponding sockets are still open and via the
Code:
dis chstatus(*)
command I see the corresponding channels are still RUNNING (mcastate).

So I suppose the stop conn command doesn't totally cleanup the connection. I suppose a
Code:
stop channel
command is still required.

Here's a little more background on my situtation:

By default WMQ never time-outs connections and I'm not willing to change this setting (TCPKeepalive in qm.ini) at this moment, since it will impact too much applications not reconnecting automatically. Sometimes abrupt network outages or in my case firewalls can cause stale connections on the WMQ server, which cause occupied connection resources on the queue manager. After a while this makes the number of active connections increase until the max channel instances threshold is reached.


Last edited by RikBaeten on Tue Jan 04, 2011 4:56 am; edited 1 time in total
Back to top
View user's profile Send private message
RikBaeten
PostPosted: Thu Dec 09, 2010 8:51 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

In fact I wanted to post this as a question/comment on topic 37647, but somehow it was made a separate topic:
http://mqseries.net/phpBB2/viewtopic.php?t=37647&start=0&postdays=0&postorder=asc&highlight=&sid=7d11e2cefff6614b3cb7c6cc3e4e8e0c

Anybody has any idea on my stop conn issue?
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Thu Dec 09, 2010 8:55 pm    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

if you want to stop a channel, use the "stop channel" command. if you want to break an application - mq connection use the "stop conn" command.

although an mca is like an application to mq, i would not stop a channel using a "stop conn" command, as there are more things to do when a channel has to be stopped then just to break the (local) mq connection.....
_________________
Regards, Butcher
Back to top
View user's profile Send private message
HubertKleinmanns
PostPosted: Thu Dec 09, 2010 10:56 pm    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

I have the same problem with "dead" channel. In my case an application connects to a QMgr through a firewall. The application puts or gets several messages. Then it does not use the channel for a long time (let's say an hour or so) but leaves the connection open. Afterwards the application tries to put or get some more message. In the meantime the firewall has interrupted the IP connection. The application recognizes this interruption, opens a new connection and is happy.

BUT the QMgr itself does still see the old connections. After a while - may take days or weeks - all connections which are allowed on the QMgr (100 by default) are in use. Now the application is not able to open a new channel.

There are several solution for the problem:

1. Tell the application developers, to correct their application. It should close an unneeded QMgr connection, before the firewall time-out occurs.

2. Use the "ClientIdle" parameter in the "Channels" stanza. This would close inactive channels after a number of seconds specified with this parameter.

3. Upgrade to Version 7. In Version 7 has a heart beat mechanism for SVRCONN channels. In version 6 such a heartbeat only exists for message channel. To activate this heartbeat you have to set the new attribute SHARECNV at least to "1" (default is "10").

Tell us, if this helps.
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
RikBaeten
PostPosted: Fri Dec 10, 2010 4:31 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

Thank you very much both for your comments.

@Mr Butcher:

Interesting info. So if I understand it correctly:
- on one side the MCA accepts TCP/IP connection from client applications => this corresponds with the result from dis conn and also with the tcp/ip sockets open on the queue manager server
- on the other side it connects in bindings mode to the queue manager itself (and forwards all calls) => this corresponds with the result from dis chstatus

So: if I close the conn, the MCA keeps the channel to the queue manager open. If I stop the channel, the conn stays open. So, I need to both stop the conn and stop the channel in order to liberate all resources.
Now I have two questions:
- Is it possible to stop only the orphaned channel instances without impacting the running channel instances?
- Would it be possible to adapt the MCA, so that it would automatically clean up the occupied channels if no connections are open to it anymore (and vice versa)? Either how the channels cannot be used anymore, so to me it would seem to be a logical implementation and easier for admins.

@HubertKleinmanns: interesting proposals:

4. I see a fourth solution being the Keepalive setting in the TCP stanza of the qm.ini file. The infocenter states this "causes TCP/IP to check periodically that the other end of the connection is still available. If it is not, the channel is closed." I've tested this by provoking an orphaned channel instance with an abrupt network connection and it works: the channel instance is correctly cleaned up after a timeout set inside my unix server kernel config. => However I don't want to implement this now, since for the moment some of my client applications don't reconnect automatically and this would force us to restart these applications very often (every time after a timeout the channel has been closed).
3. The v7 feature is no option at this moment, since both client and server are not yet upgraded yet.
2. I will check-out and test the ClientIdle parameter in the Channels stanza. It seems similar to the Keepalive setting.
Back to top
View user's profile Send private message
RikBaeten
PostPosted: Fri Dec 10, 2010 5:04 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

I'm a bit hesitant on using the ClientIdle parameter
- it seems to be listed here: http://www-01.ibm.com/support/docview.wss?uid=swg21376219, but it's not officially documented in the infocenter. I reread the page several times, but for the moment I don't understand the difference between the KeepAlive setting and the ClientIdle setting.
- Some people in this topic http://www.mqseries.net/phpBB2/viewtopic.php?t=41500&sid=73460ad38d74020c4f10f58cc5b17f25 are advising against it's use.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Fri Dec 10, 2010 8:24 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

I'd say you are going strong with
Quote:
advise against its use

I'd say that the thread gives you some elements of caution to ponder on.

Like it affects all client connections equally...

On the other hand if your client apps are well behaved and will reconnect on their own, running periodically:
Code:
STOP CHANNEL XYZ STATUS(INACTIVE)

should help clean up most of your wayward connections. Worst case scenario, you may have to add MODE(FORCE).

However this is an extreme workaround and you should strive to a more gentle solution
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
PeterPotkay
PostPosted: Fri Dec 10, 2010 4:24 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

HubertKleinmanns wrote:
I have the same problem with "dead" channel. In my case an application connects to a QMgr through a firewall. The application puts or gets several messages. Then it does not use the channel for a long time (let's say an hour or so) but leaves the connection open. Afterwards the application tries to put or get some more message. In the meantime the firewall has interrupted the IP connection. The application recognizes this interruption, opens a new connection and is happy.

BUT the QMgr itself does still see the old connections. After a while - may take days or weeks - all connections which are allowed on the QMgr (100 by default) are in use. Now the application is not able to open a new channel.

There are several solution for the problem:

1. Tell the application developers, to correct their application. It should close an unneeded QMgr connection, before the firewall time-out occurs.

2. Use the "ClientIdle" parameter in the "Channels" stanza. This would close inactive channels after a number of seconds specified with this parameter.

3. Upgrade to Version 7. In Version 7 has a heart beat mechanism for SVRCONN channels. In version 6 such a heartbeat only exists for message channel. To activate this heartbeat you have to set the new attribute SHARECNV at least to "1" (default is "10").

Tell us, if this helps.


Hubert, good ol' fashioned TCP Keep Alive will clean up these orphaned channels if the firewall truly severed the connection.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
PeterPotkay
PostPosted: Fri Dec 10, 2010 4:27 pm    Post subject: Reply with quote

Poobah

Joined: 15 May 2001
Posts: 7722

RikBaeten wrote:

2. I will check-out and test the ClientIdle parameter in the Channels stanza. It seems similar to the Keepalive setting.


TCP Keep Alive only cleans up orphaned connections where there is nothing left on the client side on that socket. True orphans.

ClientIdle kills both orphaned and dormant but otherwise perfectly valid connections as well.
_________________
Peter Potkay
Keep Calm and MQ On
Back to top
View user's profile Send private message
Mr Butcher
PostPosted: Sun Dec 12, 2010 11:26 pm    Post subject: Reply with quote

Padawan

Joined: 23 May 2005
Posts: 1716

if i want to get rid of an old svrconn connection, i use

stop channel(..) conname(...) mode(force)

then its gone from the list of "active" channels.

i'd not use the stop conn for CHIN connections that reflect channel connections.
_________________
Regards, Butcher
Back to top
View user's profile Send private message
RikBaeten
PostPosted: Wed Dec 15, 2010 3:13 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

Mr Butcher wrote:
if i want to get rid of an old svrconn connection, i use

stop channel(..) conname(...) mode(force)

then its gone from the list of "active" channels.


The problem is that there are both orphaned connections and valid connections from that specific conname. So I think issuing that command also will break valid connections. In the ideal case the application will rollback the transaction and try to reestablish the connection, but we're not always sure if the concerned application has that degree of robustness implemented. So it's not ideal.

I am looking for a safer manual cleanup that only closes orphaned channel instances.

Mr Butcher wrote:

i'd not use the stop conn for CHIN connections that reflect channel connections.

I'm not sure what you mean with CHIN connections, but I suppose it's not relevant for me. Maybe related to the channel initiator, but in the infocenter I only find Z/OS specific references.
Back to top
View user's profile Send private message
RikBaeten
PostPosted: Wed Dec 15, 2010 3:19 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

PeterPotkay wrote:

TCP Keep Alive only cleans up orphaned connections where there is nothing left on the client side on that socket. True orphans.

ClientIdle kills both orphaned and dormant but otherwise perfectly valid connections as well.


Interesting!

I don't like the name TCPKeepAlive in this context though, since it suggests keepalive packets are sent. I'd prefer a name like AutocleanOrphanedConns, TimeoutOrphanedConns or something like that. But that's a more philosophic pondering.
Back to top
View user's profile Send private message
HubertKleinmanns
PostPosted: Wed Dec 15, 2010 3:50 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

RikBaeten wrote:
...
Interesting!

I don't like the name TCPKeepAlive in this context though, since it suggests keepalive packets are sent. I'd prefer a name like AutocleanOrphanedConns, TimeoutOrphanedConns or something like that. But that's a more philosophic pondering.


The KeepAlive parameter means: Advise the operating system, to send IP packages through an IP connection - and so "keep it alive".

If the sending of this package fails, the operating system recognizes this and cleans up the IP socket.

So cleaning up an orphaned IP connection is more or less only a "side effect" of keeping the connection active.

And therefore the name does make sense (at least a little bit )
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
RikBaeten
PostPosted: Wed Dec 15, 2010 4:31 am    Post subject: Reply with quote

Novice

Joined: 26 Feb 2007
Posts: 19

HubertKleinmanns wrote:
The KeepAlive parameter means: Advise the operating system, to send IP packages through an IP connection - and so "keep it alive".

If the sending of this package fails, the operating system recognizes this and cleans up the IP socket.

So cleaning up an orphaned IP connection is more or less only a "side effect" of keeping the connection active.

And therefore the name does make sense (at least a little bit )


Once again, interesting!

But I'm quite sure there must be an additional thing done by the KeepAlive parameter, namely stopping the orphaned channel instances, since:
    a manual stop conn cleans up connections and sockets, but not channel instances
    the keepalive setting cleans up connections, sockets AND channel instances
Back to top
View user's profile Send private message
HubertKleinmanns
PostPosted: Wed Dec 15, 2010 5:25 am    Post subject: Reply with quote

Shaman

Joined: 24 Feb 2004
Posts: 732
Location: Germany

RikBaeten wrote:
...
But I'm quite sure there must be an additional thing done by the KeepAlive parameter, namely stopping the orphaned channel instances, since:
    a manual stop conn cleans up connections and sockets, but not channel instances
    the keepalive setting cleans up connections, sockets AND channel instances


No, MQ does nothing, the operating system sends keep alive packages and cleans up dead IP connections. This has nothing to do with the channel itself.

Th behaviour of STOP CONN is as follows:

1. You have a running channel agent (MCA) wich on one side is connected to the QMgr, on the other side to the network.

2. STOP CONN stops the connection to the QMgr, but not to the network.

3. The result is a running MCA without connection to the QMgr.
_________________
Regards
Hubert
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » General IBM MQ Support » [SOLVED] stop conn(*) not fully cleaning up the connection
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.