ops4j / org.ops4j.pax.exam2

Pax Exam is a testing framework for OSGi
https://ops4j1.jira.com/wiki/spaces/PAXEXAM4/
Apache License 2.0
84 stars 100 forks source link

RMI port range is not configurable for forked container [PAXEXAM-926] #1007

Open ops4j-issues opened 5 years ago

ops4j-issues commented 5 years ago

Nikolas Falco created PAXEXAM-926

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).

Affects: 5.0.0 Votes: 0, Watches: 1

ops4j-issues commented 5 years ago

Nikolas Falco commented

I turn this issue to Bug since it blocks builds on the same jenkins node machine.