Skip to content
This repository has been archived by the owner on Jun 11, 2021. It is now read-only.

Getting future timeout exception which creating a consumer/producer #71

Open
anindyaju99 opened this issue Dec 22, 2015 · 2 comments
Open

Comments

@anindyaju99
Copy link

Hi,

We have one ConnectionOwner. On top of that we are creating 7-8 queues. For each queue we have one producer and one consumer (on the same ConnectionOwner).

This is how we create the connection owner.

val connectionFactory = new ConnectionFactory()
connectionFactory.setAutomaticRecoveryEnabled(true)
connectionFactory.setTopologyRecoveryEnabled(true)
connectionFactory.setVirtualHost(config.vhost)
connectionFactory.setNetworkRecoveryInterval(5)
connectionFactory.setPassword(config.pass)
connectionFactory.setUsername(config.user)
connectionFactory.setSharedExecutor(Executors.newFixedThreadPool(Runtime.getRuntime.availableProcessors() * 4))
val addresses = config.hosts.map( h => {
val tokens = h.split(":")
new Address(tokens(0), tokens(1).toInt)
}).toArray
connection = system.actorOf(ConnectionOwner.props(connectionFactory, 1 second, addresses = Option(addresses)))

The trace looks like this -

java.util.concurrent.TimeoutException: Futures timed out after [5000 milliseconds]
at scala.concurrent.impl.Promise$DefaultPromise.ready(Promise.scala:219) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at scala.concurrent.impl.Promise$DefaultPromise.result(Promise.scala:223) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at scala.concurrent.Await$$anonfun$result$1.apply(package.scala:190) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThread$$anon$3.block(ThreadPoolBuilder.scala:169) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at scala.concurrent.forkjoin.ForkJoinPool.managedBlock(ForkJoinPool.java:3640) [dispatcher-service.jar:1.14-SNAPSHOT]
at akka.dispatch.MonitorableThreadFactory$AkkaForkJoinWorkerThread.blockOn(ThreadPoolBuilder.scala:167) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at scala.concurrent.Await$.result(package.scala:190) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at com.github.sstone.amqp.ConnectionOwner$.createChildActor(ConnectionOwner.scala:32) ~[dispatcher-service.jar:1.14-SNAPSHOT]
at com.olacabs.dispatcher.rmq.RabbitMQConnectionHelper$.createProducer(RabbitMQConnectionHelper.scala:115) ~[dispatcher-service.jar:1.14-SNAPSHOT]

@anindyaju99
Copy link
Author

Hi, Can you throw some light on this issue?

@sstone
Copy link
Owner

sstone commented Dec 26, 2015

Hi and Happy Christmas,
It seems that your createProducer function is asking the connection actor to create a child channel actor, and it times out.
The code that you use to create the connection actor looks fine too me, is there a way you could extract some code from your helper classes and build a small, self-contained sample ?
Thanks!

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

No branches or pull requests

2 participants