# Solace JMS Channel closing on it's own when running on a Kubernetes cluster (Spring Boot Autoconfig)

**URL:** <https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828>\
**Category:** Connectors & Integrations\
**Tags:** spring, kubernetes\
**Created:** [July 6, 2021, 6:26am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828 "2021-07-06T06:26:19Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![pooja](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@pooja](https://community.solace.com/u/pooja)\
**Post date:** [July 6, 2021, 6:26am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/1 "2021-07-06T06:26:19Z")

</div>

**Log snippet:**  
{“com.solacesystems.jcsmp.protocol.impl.TcpClientChannel”,“label”:  
“ **Client-109** : **Connected to host** ‘orig=host:55555, scheme=tcp://, host=host, port=55555’ (smfclient 109)”}

{“com.solacesystems.jcsmp.protocol.impl.TcpClientChannel”,“label”:“ **Client-109** : **Channel Closed**  
(smfclient 109)”}

It basically loops like this all day long and I can’t figure out why. When I run this locally on my development machine the connection remains open and and not closing on its own\*\*\*\*.

There is no other log to give me a clue why the channel is closing on its own like this.

Any one have any ideas what the problem might be?

PS: I am already using CachingConnectionfactory

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [July 6, 2021, 8:32pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/2 "2021-07-06T20:32:42Z")

</div>

Hi @pooja,

You tried my first guess - not using the CachingConnectionFactory is usually the culprit here. When you run your app do the logs say that the CachingConnectionFactory is being instantiated?

A few questions:

1. Are you using core spring framework or Spring boot?
2. Is this app a consumer, sender, or both?
3. is it disconnecting after each send/receive?
4. can you share more of your Spring configuration?

---

<div class="post-metadata">

**Author:** ![pooja](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@pooja](https://community.solace.com/u/pooja)\
**Post date:** [July 7, 2021, 5:23am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/3 "2021-07-07T05:23:40Z")

</div>

Hey marc, thanks for the quick response 😄 . Answering your questions inline. Let me know anything else required from my side.

> [@marc](#):
>
> Hi @pooja,  
> You tried my first guess - not using the CachingConnectionFactory is usually the culprit here. When you run your app do the logs say that the CachingConnectionFactory is being instantiated?

[Pooja] No it doesnt say so

> A few questions:
> 
> 1. Are you using core spring framework or Spring boot?  
> [Pooja]Spring boot.

> 1. Is this app a consumer, sender, or both?  
> [Pooja]It is both, but even with sender alone it loops through creating closing connection

> 1. is it disconnecting after each send/receive?  
> [Pooja]Not actually. Connection creation and closing are happening in every fixed interval of time. Seems like some timer is set for connection .

> 1. can you share more of your Spring configuration?  
> [Pooja] Connection is created using spring autoconfig(spring managed connection) through JmsTemplate.

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [July 8, 2021, 6:09pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/4 "2021-07-08T18:09:30Z")

</div>

Interesting. I just re-read your question and noticed this which makes me think it is a configuration on the broker or network settings in K8s

> It basically loops like this all day long and I can’t figure out why. When I run this locally on my development machine the connection remains open and and not closing on its own\*\*\*\*.

@Aaron @TomF - any ideas here?

Just a guess from me, but can you check the client-profile and the JMS JNDI Connection Factory settings for keepalives and see if there is anything disabled or drastically different than what you have locally?

As defaults I see this in my local docker but your admin may change some of these things based on what they expect to see or network restrictions in your k8s cluster.

On the **client-profile**

 ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/0453d7198589af3e68686ca63036179f0d571441.png)

 ![image.png](https://canada1.discourse-cdn.com/solace/original/2X/e/e1fcde2e4df244581d25aa57a7a583a3c3459e61.png)

On the **JMS Connection Factory**

 ![image.png](https://canada1.discourse-cdn.com/solace/original/1X/68d5cddfbc3869cfbce892511579ec01dfeec81e.png)

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [July 8, 2021, 6:20pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/5 "2021-07-08T18:20:08Z")

</div>

@pooja Another thing to consider would be the network path that your app is taking to connect to the broker. Is the broker also within K8s? is it external to K8s? is there a load balancer in the mix?

---

<div class="post-metadata">

**Author:** ![pooja](https://avatars.discourse-cdn.com/v4/letter/p/a5b964/32.png) [@pooja](https://community.solace.com/u/pooja)\
**Post date:** [July 12, 2021, 10:24am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/6 "2021-07-12T10:24:50Z")

</div>

@marc These settings are same as yours, in local as well as in the server broker. Broker is (outside) external to the k8s cluster.

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [July 13, 2021, 9:08pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/7 "2021-07-13T21:08:44Z")

</div>

@pooja…interesting. Is there a load balancer between K8s and your broker? I wonder if there is some sort of load balancer flapping going on.

@TomF @KenBarr any other ideas?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/solace/original/1X/1248f38eea018157e66cc024e8284f3331a54f94.png) [@system](https://community.solace.com/u/system)\
**Post date:** [July 13, 2021, 11:03pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/8 "2021-07-13T23:03:16Z")

</div>

might be worth looking at the connect/disconnect events on the event broker. “show log events” and match these to your JMS logs. The broker logs have a disconnect reason.

---

<div class="post-metadata">

**Author:** ![bhavik20](https://avatars.discourse-cdn.com/v4/letter/b/f08c70/32.png) [@bhavik20](https://community.solace.com/u/bhavik20)\
**Post date:** [October 18, 2021, 5:08am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/9 "2021-10-18T05:08:40Z")

</div>

Hi Team,

I’m also facing same issue. solace connections are keep dropping every 10s and reconnect again it own while running spring boot application via docker image. i don’t see any issue running spring boot jar independently.

---

<div class="post-metadata">

**Author:** ![bkossme](https://avatars.discourse-cdn.com/v4/letter/b/779978/32.png) [@bkossme](https://community.solace.com/u/bkossme)\
**Post date:** [March 1, 2022, 12:50pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/10 "2022-03-01T12:50:47Z")

</div>

Hi all,  
I could be wrong, but actually I recognised that it caused of health check, which probably configured for your pod in template yaml file.  
To disable it you can specify in application.yaml file of your spring boot application, something like:  
management:  
health:  
jms:  
enabled: false

You can find implementation in JmsHealtIndicator class, all of these defaults checks are actually automatically configured and all their implementations you may find in spring-boot-actuator component.

Hope it will help you

Best regards,  
Andrei

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [March 1, 2022, 7:11pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/11 "2022-03-01T19:11:39Z")

</div>

Thanks for sharing @bkossme ?. - I hadn’t thought about that!

---

<div class="post-metadata">

**Author:** ![Solace\_chunnu](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/solace_chunnu/32/652_2.png) [@Solace\_chunnu](https://community.solace.com/u/Solace_chunnu)\
**Post date:** [August 15, 2022, 9:58am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/12 "2022-08-15T09:58:11Z")

</div>

I am facing similar issue, on Openshift I have deployed Solace consumer but it keeps disconnecting. This is causing big messages read failure.

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [August 15, 2022, 4:46pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/13 "2022-08-15T16:46:00Z")

</div>

Hi @Solace_chunnu ,  
Is it also happening to you b/c of the health check? Is the container getting restarted?  
OR when you say this are you saying that it doesn’t work with “large messages”?  
This is causing big messages read failure

---

<div class="post-metadata">

**Author:** ![jangrahul](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jangrahul](https://community.solace.com/u/jangrahul)\
**Post date:** [September 29, 2023, 4:16am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/14 "2023-09-29T04:16:09Z")

</div>

Hi @bkossme / @marc I was facing high connection churns while consuming messages from solace via spring’s DMLC.

Disabling the health check fixed the issue for me.

Can you elaborate on how enabling jms health check endpoint can cause connections to drop.

Thanks

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [September 29, 2023, 1:21pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/15 "2023-09-29T13:21:58Z")

</div>

Hi @jangrahul ,

Which health check are you referring to? Actuator?

Also, are you using a `CachingConnectionFactory` with the DMLC?

---

<div class="post-metadata">

**Author:** ![jangrahul](https://avatars.discourse-cdn.com/v4/letter/j/3bc359/32.png) [@jangrahul](https://community.solace.com/u/jangrahul)\
**Post date:** [September 30, 2023, 7:38am UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/16 "2023-09-30T07:38:40Z")

</div>

Hi @marc.dipasquale , no I am not using CahingConnectionFactory.

I was referring to the solution that @bkossme had suggested  
viz.

management:

health:

jms:

enabled: false

The above, if not diabled, creates a health check endpoint

---

<div class="post-metadata">

**Author:** ![marc](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/marc/32/2191_2.png) [@marc](https://community.solace.com/u/marc)\
**Post date:** [October 2, 2023, 5:40pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/17 "2023-10-02T17:40:18Z")

</div>

Hi @jangrahul ,

Ah okay, I found out why. It looks like the default JMS health check is just starting a new connection and closing it each time you check. I would recommend not using that and coding your own health check that checks the status of the JMS resources you are actually using instead.

See the code here:

> <https://github.com/spring-projects/spring-boot/blob/main/spring-boot-project/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/jms/JmsHealthIndicator.java>

---

<div class="post-metadata">

**Author:** ![Tamimi](https://yyz1.discourse-cdn.com/solace/user_avatar/community.solace.com/tamimi/32/2190_2.png) [@Tamimi](https://community.solace.com/u/Tamimi)\
**Post date:** [October 2, 2023, 6:18pm UTC](https://community.solace.com/t/solace-jms-channel-closing-on-its-own-when-running-on-a-kubernetes-cluster-spring-boot-autoconfig/828/18 "2023-10-02T18:18:13Z")

</div>

Cool idea! If you create a custom healthcheck please feel free to share it with the community here
