Configure the datasource idle-timeout-minutes property in EAP 7/6

Solution Verified - Updated -

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x
    • 6.x

Issue

  • How is the datasource property idle-timeout-minutes configured?
  • I was not able to add/configure the idle-timeout-minutes property.
  • By some load spike, ActiveCount increased. Then, after a while, ActiveCount doesn't decrease while InUseCount decreased. That means idle connections are not released from the connection pool. I want to release such connections from database resource perspective.

Resolution

Set the idle-timeout-minutes property within the timeout element in the datasource configuration, either editing directly the configuration file or via CLI command, see below.

Editing directly the configuration file to set idle-timeout-minutes

Set the idle-timeout-minutes attribute within the timeout element in the configuration file standalone-*.xml or domain.xml (on the used profile):

                   ...
                   <security>
                        ...
                   </security>
                   <validation>
                        ...
                   </validation>
                   <timeout>
                        <!-- specify a value appropriate for system constraints/desired behavior -->
                        <idle-timeout-minutes>5</idle-timeout-minutes>
                   </timeout>
                   ...

Using the CLI command to set idle-timeout-minutes

Setting the property idle-timeout-minutes, can be also done via CLI command write-attribute, as below:

[standalone@localhost:9990 /] /subsystem=datasources/data-source=ExampleDS/:write-attribute(name=idle-timeout-minutes,value=15)
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

[standalone@localhost:9990 /] reload <--------- must reload

To verify the attribute, use the following command:

[standalone@localhost:9990 /] /subsystem=datasources/data-source=ExampleDS:read-attribute(name=idle-timeout-minutes)
{
    "outcome" => "success",
    "result" => 15L <---------- 15 minutes
}

References

Root Cause

The idle-timeout-minutes property hasn't been configured within the timeout element in the datasource configuration.

Diagnostic Steps

  • Observe the following ERROR message in the server log :
ERROR [org.jboss.as.server] (Controller Boot Thread) JBAS015956: Caught exception during boot: org.jboss.as.controller.persistence.ConfigurationPersistenceException: JBAS014676: Failed to parse configuration
    at org.jboss.as.controller.persistence.XmlConfigurationPersister.load(XmlConfigurationPersister.java:141) [jboss-as-controller-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
    at org.jboss.as.server.ServerService.boot(ServerService.java:324) [jboss-as-server-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
    at org.jboss.as.controller.AbstractControllerService$1.run(AbstractControllerService.java:253) [jboss-as-controller-7.3.2.Final-redhat-2.jar:7.3.2.Final-redhat-2]
    at java.lang.Thread.run(Thread.java:724) [rt.jar:1.7.0_25]
Caused by: javax.xml.stream.XMLStreamException: org.jboss.as.connector.util.ParserException: IJ010061: Unexpected element: idle-timeout-minutes
    at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:582)
    at org.jboss.as.connector.subsystems.datasources.DataSourcesExtension$DataSourceSubsystemParser.readElement(DataSourcesExtension.java:182)
    at org.jboss.staxmapper.XMLMapperImpl.processNested(XMLMapperImpl.java:110) [staxmapper-1.1.0.Final-redhat-2.jar:1.1.0.Final-redhat-2]
    at org.jboss.staxmapper.XMLExtendedStreamReaderImpl.handleAny(XMLExtendedStreamReaderImpl.java:69) [staxmapper-1.1.0.Final

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.

Comments