Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PAX JMS closes used connections when pool idle checking is configured #65

Open
ephemeris-lappis opened this issue Jul 13, 2023 · 6 comments
Assignees
Labels

Comments

@ephemeris-lappis
Copy link

ephemeris-lappis commented Jul 13, 2023

It seems that enabling idle connections checking leads PAX JMS to close connections that are used (in our case by Camel consumer endpoints).

With the following setting (see the attached file for a full configuration) used connections are closed every 30 minutes :
pool.connectionIdleTimeout=30
pool.connectionCheckInterval=15000

Removing these to properties restores a normal behavior.
What's strange is that testing other values for connectionIdleTimeout doesn't produce the expected issues : 3, 5 or 10 do not close connections every 3, 5 or 10 minutes, but seem to be ignored.

The problem is observed running Karaf 4.4.3 and PAX JMS features 1.1.2 (pax-jms-core, pax-jms-config, pax-jms-activemq, pax-jms-pool-pooledjms).

org.ops4j.connectionfactory-alice.cfg.zip

@grgrzybek grgrzybek self-assigned this Jul 21, 2023
@grgrzybek
Copy link
Member

sorry @ephemeris-lappis, I was busy this week, but I planned tasks related to Pax JMS, Pax Transx and Pax JDBC for next week.

@ephemeris-lappis
Copy link
Author

ephemeris-lappis commented Jul 21, 2023 via email

@grgrzybek grgrzybek added this to the 1.1.3 milestone Jul 26, 2023
@grgrzybek
Copy link
Member

@ephemeris-lappis according to org.messaginghub.pooled.jms.JmsPoolConnectionFactory#getConnectionIdleTimeout() javadoc, the value is in milliseconds, so your setting should rather be:

pool.connectionIdleTimeout=30000

@grgrzybek
Copy link
Member

grgrzybek commented Jul 26, 2023

Perhaps you should remind us where all the pax jms options are documented (pooledjms in particular) ?

The project (and several other ops4j projects) are community effort and these are maintained using free time of independent contributors. So unfortunately there's no one good place where documentation can be found...

In Pax JMS, the properties (from org.ops4j.connectionfactory factory PID) are of two different categories:

  • properties with names prefixed with pool.
  • remaining prefixes

Properties not prefixed with pool. are used to call setters (via reflection) or other methods on various objects depending on the actual driver used.

  • for pax-jms-oracleaq, it's the Properties argument of oracle.jms.AQjmsFactory.getConnectionFactory() method
  • for pax-jms-activemq, it's org.apache.activemq.ActiveMQConnectionFactory#buildFromMap() method
  • for pax-jms-ibmmq, it's setters on com.ibm.mq.jms.MQConnectionFactory or com.ibm.mq.jms.MQXAConnectionFactory
  • for pax-jms-artemis, it's the Properties argument of org.apache.qpid.jms.util.PropertyUtil#setProperties() (for protocol = amqp) or it's setters on org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory

Propertes prefixed with pool. are used to call setters (via reflection) or other methods on various objects depending on the actual pool used.

  • for pax-jms-pool-pooledjms, it's setters on org.messaginghub.pooled.jms.JmsPoolConnectionFactory
  • for pax-jms-pool-narayana, it's also setters on org.messaginghub.pooled.jms.JmsPoolConnectionFactory, but pax-jms-pool-narayana additionally registers org.jboss.tm.XAResourceRecovery service
  • for pax-jms-pool-transx, it's the org.ops4j.pax.transx.jms.ManagedConnectionFactoryBuilder#properties() call

I hope this clears the confusion a bit.

In your case, pool.connectionIdleTimeout property translates to org.messaginghub.pooled.jms.JmsPoolConnectionFactory#setConnectionIdleTimeout() call. There should be no problems setting this property, so please check after using proper value (milliseconds).

@grgrzybek grgrzybek removed this from the 1.1.3 milestone Jul 26, 2023
@ephemeris-lappis
Copy link
Author

ephemeris-lappis commented Jul 26, 2023 via email

@grgrzybek
Copy link
Member

I quickly read in Javadocs that connectionIdleTimeout and connectionCheckInterval are about checking the idleness in different way (one is active and the other is not).

Please have a look at the Javadocs and maybe test pure Java usage of org.messaginghub.pooled.jms.JmsPoolConnectionFactory. If you can create a reproducer, it'd help a lot ;)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants