Loading

Error "An attempt by a client to checkout a Connection has timed out." when a HTTP request follows Database Connector

Fecha de publicación: Jul 21, 2025
Solución

SYMPTOM

Database Connector's response time gets higher and eventually leads error "An attempt by a client to checkout a Connection has timed out." is thrown from the log.
This issue is seen when there is a HTTP Requester followed Database Connector and using Database data to send request.

Example of the error message:

ERROR 2022-03-09 16:48:35,061 [[MuleRuntime].uber.04: [dbtest].dbtestFlow.BLOCKING @16ba322f] [processor: dbtestFlow/processors/0; event: 894e30d0-9f6c-11ec-bc45-acde48001122] org.mule.runtime.core.internal.exception.OnErrorPropagateHandler: 
********************************************************************************
Message               : An attempt by a client to checkout a Connection has timed out.
Element               : dbtestFlow/processors/0 @ dbtest:dbtest.xml:23 (Select)
Element DSL           : <db:select doc:name="Select" doc:id="73ba8f8e-fecb-4e45-89bf-445033bb003f" config-ref="Database_Config">
<db:sql><![CDATA[
SELECT * FROM dummy;
]]></db:sql>
</db:select>
Error type            : DB:CONNECTIVITY
FlowStack             : at dbtestFlow(dbtestFlow/processors/0 @ dbtest:dbtest.xml:23 (Select))
Payload               : null
Payload Type          : null
--------------------------------------------------------------------------------
Root Exception stack trace:
com.mchange.v2.resourcepool.TimeoutException: A client timed out while waiting to acquire a resource from com.mchange.v2.resourcepool.BasicResourcePool@32f4877 -- timeout at awaitAvailable()
	at com.mchange.v2.resourcepool.BasicResourcePool.awaitAvailable(BasicResourcePool.java:1505)
	at com.mchange.v2.resourcepool.BasicResourcePool.prelimCheckoutResource(BasicResourcePool.java:644)
	at com.mchange.v2.resourcepool.BasicResourcePool.checkoutResource(BasicResourcePool.java:554)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutAndMarkConnectionInUse(C3P0PooledConnectionPool.java:758)
	at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool.checkoutPooledConnection(C3P0PooledConnectionPool.java:685)
	at com.mchange.v2.c3p0.impl.AbstractPoolBackedDataSource.getConnection(AbstractPoolBackedDataSource.java:140)
	at org.mule.db.commons.shaded.internal.domain.connection.JdbcConnectionFactory.createConnection(JdbcConnectionFactory.java:52)
	at org.mule.db.commons.shaded.internal.domain.connection.DbConnectionProvider.connect(DbConnectionProvider.java:137)
	at org.mule.db.commons.shaded.internal.domain.connection.DbConnectionProvider.connect(DbConnectionProvider.java:72)
	at org.mule.runtime.module.extension.internal.runtime.config.ClassLoaderConnectionProviderWrapper.connect(ClassLoaderConnectionProviderWrapper.java:60)
	at org.mule.runtime.core.internal.connection.ConnectionUtils.connect(ConnectionUtils.java:52)
	at org.mule.runtime.core.internal.connection.AbstractConnectionProviderWrapper.connect(AbstractConnectionProviderWrapper.java:63)
	at org.mule.runtime.core.internal.connection.ErrorTypeHandlerConnectionProviderWrapper.connect(ErrorTypeHandlerConnectionProviderWrapper.java:64)
	at org.mule.runtime.core.internal.connection.ConfigNameResolverConnectionProviderWrapper.connect(ConfigNameResolverConnectionProviderWrapper.java:50)
	at org.mule.runtime.core.internal.connection.ConnectionUtils.connect(ConnectionUtils.java:52)
	at org.mule.runtime.core.internal.connection.AbstractConnectionProviderWrapper.connect(AbstractConnectionProviderWrapper.java:63)
	at org.mule.runtime.core.internal.connection.DefaultConnectionProviderWrapper.connect(DefaultConnectionProviderWrapper.java:52)
	at org.mule.runtime.core.internal.connection.NullConnectionManagementStrategy.getConnectionHandler(NullConnectionManagementStrategy.java:40)
	at org.mule.runtime.core.internal.connection.DefaultConnectionManager.getConnection(DefaultConnectionManager.java:247)
	at org.mule.runtime.core.internal.connection.DelegateConnectionManagerAdapter$EagerConnectionManagerAdapter.getConnection(DelegateConnectionManagerAdapter.java:160)
	at org.mule.runtime.core.internal.connection.DelegateConnectionManagerAdapter.getConnection(DelegateConnectionManagerAdapter.java:82)
	at org.mule.runtime.module.extension.internal.runtime.connectivity.ExtensionConnectionSupplier.getTransactionlessConnectionHandler(ExtensionConnectionSupplier.java:112)
	at org.mule.runtime.module.extension.internal.runtime.connectivity.ExtensionConnectionSupplier.getTransactedConnectionHandler(ExtensionConnectionSupplier.java:72)
	at org.mule.runtime.module.extension.internal.runtime.connectivity.ExtensionConnectionSupplier.getConnection(ExtensionConnectionSupplier.java:62)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer$StickyConnectionSupplierFactory$1.getChecked(PagingProviderProducer.java:268)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer$StickyConnectionSupplierFactory$1.getChecked(PagingProviderProducer.java:264)
	at org.mule.runtime.core.api.util.func.CheckedSupplier.get(CheckedSupplier.java:25)
	at org.mule.runtime.api.util.LazyValue.get(LazyValue.java:75)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer$StickyConnectionSupplierFactory.getConnectionSupplier(PagingProviderProducer.java:275)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.getConnectionSupplier(PagingProviderProducer.java:224)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.withConnection(PagingProviderProducer.java:154)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.withConnection(PagingProviderProducer.java:150)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.performWithConnection(PagingProviderProducer.java:141)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.produce(PagingProviderProducer.java:100)
	at org.mule.runtime.module.extension.internal.runtime.streaming.PagingProviderProducer.produce(PagingProviderProducer.java:54)
	at org.mule.runtime.core.api.streaming.iterator.ListConsumer.loadNextPage(ListConsumer.java:81)
	at org.mule.runtime.module.extension.internal.runtime.operation.OperationMessageProcessorBuilder.lambda$transformPagingDelegate$0(OperationMessageProcessorBuilder.java:93)
	at org.mule.runtime.core.api.util.func.CheckedBiFunction.apply(CheckedBiFunction.java:19)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator$TransformingExecutionCallbackDecorator.complete(DefaultExecutionMediator.java:337)
	at org.mule.runtime.module.extension.internal.runtime.execution.CompletableMethodOperationExecutor.doExecute(CompletableMethodOperationExecutor.java:29)
	at org.mule.runtime.module.extension.internal.runtime.execution.AbstractCompletableMethodOperationExecutor.execute(AbstractCompletableMethodOperationExecutor.java:63)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.executeCommand(DefaultExecutionMediator.java:232)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.executeWithInterceptors(DefaultExecutionMediator.java:216)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.lambda$execute$1(DefaultExecutionMediator.java:135)
	at org.mule.runtime.core.internal.execution.ExecuteCallbackInterceptor.execute(ExecuteCallbackInterceptor.java:15)
	at org.mule.runtime.core.internal.execution.BeginAndResolveTransactionInterceptor.execute(BeginAndResolveTransactionInterceptor.java:76)
	at org.mule.runtime.core.internal.execution.SuspendXaTransactionInterceptor.execute(SuspendXaTransactionInterceptor.java:46)
	at org.mule.runtime.core.internal.execution.ValidateTransactionalStateInterceptor.execute(ValidateTransactionalStateInterceptor.java:43)
	at org.mule.runtime.core.internal.execution.IsolateCurrentTransactionInterceptor.execute(IsolateCurrentTransactionInterceptor.java:37)
	at org.mule.runtime.core.api.execution.TransactionalExecutionTemplate.execute(TransactionalExecutionTemplate.java:139)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.withExecutionTemplate(DefaultExecutionMediator.java:313)
	at org.mule.runtime.module.extension.internal.runtime.operation.DefaultExecutionMediator.execute(DefaultExecutionMediator.java:134)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.executeOperation(ComponentMessageProcessor.java:588)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.prepareAndExecuteOperation(ComponentMessageProcessor.java:811)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.lambda$onEventSynchronous$16(ComponentMessageProcessor.java:490)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.onEventSynchronous(ComponentMessageProcessor.java:497)
	at org.mule.runtime.module.extension.internal.runtime.operation.ComponentMessageProcessor.lambda$null$6(ComponentMessageProcessor.java:405)
	at reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.onNext(FluxPeekFuseable.java:482)
	at reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.onNext(FluxMapFuseable.java:287)
	at reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.onNext(FluxPeekFuseable.java:496)
	at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:477)
	at org.mule.runtime.core.privileged.processor.chain.AbstractMessageProcessorChain$2.onNext(AbstractMessageProcessorChain.java:472)
	at reactor.core.publisher.FluxHide$SuppressFuseableSubscriber.onNext(FluxHide.java:127)
	at reactor.core.publisher.FluxPeekFuseable$PeekFuseableSubscriber.onNext(FluxPeekFuseable.java:204)
	at reactor.core.publisher.FluxOnAssembly$OnAssemblySubscriber.onNext(FluxOnAssembly.java:351)
	at reactor.core.publisher.FluxSubscribeOnValue$ScheduledScalar.run(FluxSubscribeOnValue.java:178)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:50)
	at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:27)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at org.mule.service.scheduler.internal.AbstractRunnableFutureDecorator.doRun(AbstractRunnableFutureDecorator.java:113)
	at org.mule.service.scheduler.internal.RunnableFutureDecorator.run(RunnableFutureDecorator.java:54)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

********************************************************************************

EXAMPLE DESIGN

It is not uncommon to have such design to integrate data from Database to third party.
SampleFlow

CAUSE

The connection borrowed from the database connection pool will not be returned back until the result from database is fully consumed.
This means the connection will not be returned into connection pool until the "For Each" scope reaches last record of data. If each HTTP Request takes 1 second and Database returns 1000 records, the connection will be held 1000 seconds before returning to the pool.

WORKAROUND

You can consume result from database before it is sent to the third party by 
  • Disable Connection Pool in the Database Connector so connection will be created for each Mule Event
  • Send the result into internal VM queue as the following to async the process and release the connection to be connection pool
Workaround
 
Número del artículo de conocimiento

001120381

 
Cargando
Salesforce Help | Article