Thank you for the clarification! The details of how the Java client implements the MQRCVBLKTO probably doesn't really matter, but for those who would care, it seems to be achieved outside the underlying TCP calls (i.e. select, recv, etc.) from what I saw when looking at an strace. This MQRCVBLKTO seems to be an important field that should be documented for clients, I would think. It corrects the issue I have been sporadically seeing where a Linux Java client will get indefinitely stuck in a read on a socket.
Original Message:
Sent: Wed September 13, 2023 03:00 AM
From: Morag Hughson
Subject: MQRCVBLKTO Question
Hi Tim,
While the picture may show two queue managers, the attribute (either in "real" attribute form or environment variable form) does apply to both MCA channels and MQI channels - anywhere where an MQ socket may be doing a TCP/IP receive.
Note that it says (in the notes page), "This is used as the basis for TCP/IP network failure recognition. For CLNTCONN channels, this time-out is also used while waiting for a response to an MQI call."
The thought that heartbeats will help is only true when you combine them with Receive Block Time Out as this document describes. That's why the queue manager has it turned on by default on distributed.
I don't know whether there is a "client watcher thread", more likely just a TCP/IP call that can be given a timeout like a select() instead of a recv(), but this is a Java client so I don't actually know. Assume some kind of system trace would tell you if you are really curious.
Cheers,
Morag
------------------------------
Morag Hughson
MQ Technical Education Specialist
MQGem Software Limited
Website: https://www.mqgem.com
Original Message:
Sent: Tue September 12, 2023 09:59 AM
From: Tim Zielke
Subject: MQRCVBLKTO Question
Hi Morag and Matthias,
Thank you for the links! The one that was an MQTC presentation seems to be describing what MQRCVBLKTO does for a QMGR -> QMGR channel. The MQSeries thread is dealing with a Java client, which is my use case. Interestingly enough, I was the one involved in the thread and seemed to point the user to the fix. If only I could help myself! :-) It looks like I pointed the poster to some manual doc, and then they found the MQRCVBLKTO setting which fixed their issue. But when I go to that manual link, I don't see anything that talks about MQRCVBLKTO. Maybe it was there in the manual when that post was made?
To state the problem more succinctly, I am trying to find a way to get a Java client connection to break out of an indefinite wait on a TCP socket read. This issue sounds very similar to what the poster was describing. Neither HBINT or TCP keepalive helps me in this scenario. However, MQRCVBLKTO seems to do the trick. My assumption is there is a client watcher thread that is keeping tabs on the underlying client thread that is stuck in the TCP socket read, and if that time exceeds the MQRCVBLKTO value, the watcher thread throws an exception back to the application. This is exactly what I am looking for.
Thanks,
Tim
------------------------------
Tim Zielke
Original Message:
Sent: Tue September 12, 2023 04:11 AM
From: Matthias Jungbauer
Subject: MQRCVBLKTO Question
A few years ago some other people also wrote about MQRCVBLKTO. Maybe it helps.
http://www.mqseries.net/phpBB2/viewtopic.php?t=74834&highlight=
------------------------------
Matthias Jungbauer
Original Message:
Sent: Fri September 08, 2023 03:15 PM
From: Tim Zielke
Subject: MQRCVBLKTO Question
I have a Java application that uses the IBM MQ Classes for Java to connect to the queue manager and has this system property set on the java command line.
-Dcom.ibm.mq.cfg.MQRCVBLKTO=15
I can't find any doc on this setting in the MQ manual, and I have also found little doc for it on the internet. Does someone know exactly what this setting does?
For example, I have two IBM MQ Classes for Java clients that connect to a queue manager for various purposes. One is running with this setting, the other is not. There are times where a queue manager server that these clients connect to can become unresponsive (e.g. running consistently at 100% CPU). When this happens, the client that runs with the setting properly detects that the connection is bad and attempts to reconnect. However, the client that does not run with this setting can get into a scenario where it is stuck indefinitely on a TCP socket read. One thing I am curious is if anyone knows if this setting will cause the client to have some type of boss/watcher thread to kill a socket if it is stuck on a read for 15 seconds.
I did validate with an strace that this setting is not causing the SO_RCVTIMEO option to be set on the client socket, which I was suspecting was the case. So wondering if there might be some boss/watcher thread involved here.
------------------------------
Tim Zielke
------------------------------