Avoiding intermittent Blueprint deadlocks in Camel tests

Solution Unverified - Updated -


  • JBoss Fuse 6.0


There is a reported issue [1] related to the deadlocks manifesting themselves in Aries Blueprint extender. Due to the latter bug Camel Blueprint tests [2] may intermittently fail generating "Gave up waiting for CamelContext" exception.

[1] https://issues.apache.org/jira/browse/ARIES-1051
[2] http://camel.apache.org/blueprint-testing.html


In order to avoid tests failing randomly switch test Blueprint container to the synchronized mode (which is recommended workaround for Aries Blueprint deadlock issue [1]). In order to switch blueprint container to the synchronized mode set system property 'org.apache.aries.blueprint.synchronous' to 'true'.

System.setProperty("org.apache.aries.blueprint.synchronous", Boolean.TRUE.toString());

Keep in mind that the property mentioned above should be set before the test setup (i.e. before the initialization of the test Blueprint container), ideally in doPreSetup method as demonstrated in the snippet below.

public void doPreSetup() throws Exception { 
  System.setProperty("org.apache.aries.blueprint.synchronous", Boolean.TRUE.toString());

Switching to synchronous Blueprint is highly recommended in general for many reasons. For example Karaf moved [2] to synchronous mode as default setting starting from the version 2.3.2. It is very likely that in the future Camel Blueprint tests would be executed in synchronous mode by default as well.

[1] https://issues.apache.org/jira/browse/ARIES-1051
[2] https://issues.apache.org/jira/browse/KARAF-2273

Root Cause

The issue describing the deadlocks occurring in the Aries Blueprint Extender has been reported as Jira ticket ARIES-1051 [1]. It has not been fixed yet, however switching container to the synchronous mode has been recommended as a workaround. Camel Blueprint tests use Aries under the hood, because PojoRS [2] (blueprint test container for Camel) uses Aries.

[1] https://issues.apache.org/jira/browse/ARIES-1051
[2] https://code.google.com/p/pojosr

Diagnostic Steps

After switching container to synchronous mode Camel tests will stop to fail randomly with "Gave up waiting for CamelContext" message.

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.