We're updating the issue view to help you get more done. 

RMI port range is not configurable for forked container


We use jenkins as CI system. We had migrate all our OSGi test cases to Pax Exam 5 (5 M1 to have support for suite/class rules/after and before class).
Some unit test needs to be run in a forked container (for example load to native libraries more times), but sometimes tests fails with a BindException (address 20000 already in use) during the execution of job jenkins (slaves have 4/5 executors).
Recently we change the pipeline to execute tests of the same maven project in parallel and 90% of JUnit fails with BindException. Looking into the code pax exam code the RMI port used to comunicate with the forked JVM is calculated using the first free port using in the range between 20000 and 21000. The issue is that at the time of check if the port is already binded, it is not, so it is released and configured as system property option. This means, except for rare exceptions, the system always get port 20000 as free one for all forked instance.
So I had try to configure the RMI port as JVM argument -Dpax.exam.invoker.port to the command line but without luck (it is "overridden" in DefaultExamSystem.combine).

  1. The logic must be changed to use a random port in the defined range and than try next available port untill reach the upperbound limit and continue from the initial limit.

  2. Make this range configurable

  3. Use the system property if already defined (by CLI).


Maven 3.3.9, Linux/OS/Windowes





Nikolas Falco




Affects versions