ops4j / org.ops4j.pax.jms

Pax JMS provides a lightweight bridge between Java Message Service (JMS) and OSGi using Declarative Services and the whiteboard pattern
Apache License 2.0
6 stars 8 forks source link

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

Open ephemeris-lappis opened 1 year ago

ephemeris-lappis commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

Hello Grzegorz.

No problem ;) !!! As we can set a workaround, this is not a blocking issue.

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

Thanks again.

Regards.

Le ven. 21 juil. 2023 à 14:52, Grzegorz Grzybek @.***> a écrit :

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

— Reply to this email directly, view it on GitHub https://github.com/ops4j/org.ops4j.pax.jms/issues/65#issuecomment-1645537732, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV2ZIY7H3JDLQBG6LCN5CDXRJ3PVANCNFSM6AAAAAA2JC3VQA . You are receiving this because you were mentioned.Message ID: <ops4j/org. @.***>

grgrzybek commented 1 year ago

@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 commented 1 year ago

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 not prefixed with pool. are used to call setters (via reflection) or other methods on various objects depending on the actual driver used.

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

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).

ephemeris-lappis commented 1 year ago

Hello.

I think I've seen examples with rather short values such as 30, thinking the value's unit was minutes. I'm going to try changing the values, but it doesn't explain why values like 5 or 10 do not break connections...

Anyway, It's supposed to be an "idle" timeout, and it makes no sense that "used" connections may be checked and closed, since they aren't "idle", no ?

Thanks.

Regards.

Le mer. 26 juil. 2023 à 13:02, Grzegorz Grzybek @.***> a écrit :

@ephemeris-lappis https://github.com/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

— Reply to this email directly, view it on GitHub https://github.com/ops4j/org.ops4j.pax.jms/issues/65#issuecomment-1651560070, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABV2ZI7Y4GPCCV736QTQKS3XSD2NXANCNFSM6AAAAAA2JC3VQA . You are receiving this because you were mentioned.Message ID: <ops4j/org. @.***>

grgrzybek commented 1 year ago

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 ;)