Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regression - failure when starting two Karaf containers [PAXEXAM-940] #1020

Open
ops4j-issues opened this issue Nov 25, 2020 · 9 comments
Open
Assignees
Labels
Milestone

Comments

@ops4j-issues
Copy link

Amichai Rothman created PAXEXAM-940

When upgrading to Pax Exam 4.13.4 with Karaf 4.3.0, an itest that starts two Karaf containers (to test some communication between them) now fails, with the exception below. The same test has been working for years before this. My guess is that commit aa8473a caused the regression, where it changed how the free RMI port is detected and didn't account for this scenario.

java.lang.RuntimeException: Problem starting container
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:195)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.setUp(EagerSingleStagedReactor.java:86)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.beforeClass(EagerSingleStagedReactor.java:136)
at org.ops4j.pax.exam.spi.reactors.ReactorManager.beforeClass(ReactorManager.java:457)
at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:97)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at com.example.itest.setup.TwoContainerPaxExam.run(TwoContainerPaxExam.java:48)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.rmi.server.ExportException: internal error: ObjID already in use
at sun.rmi.transport.ObjectTable.putTarget(ObjectTable.java:186)
at sun.rmi.transport.Transport.exportObject(Transport.java:106)
at sun.rmi.transport.tcp.TCPTransport.exportObject(TCPTransport.java:265)
at sun.rmi.transport.tcp.TCPEndpoint.exportObject(TCPEndpoint.java:411)
at sun.rmi.transport.LiveRef.exportObject(LiveRef.java:147)
at sun.rmi.server.UnicastServerRef.exportObject(UnicastServerRef.java:236)
at sun.rmi.registry.RegistryImpl.setup(RegistryImpl.java:213)
at sun.rmi.registry.RegistryImpl.<init>(RegistryImpl.java:198)
at java.rmi.registry.LocateRegistry.createRegistry(LocateRegistry.java:203)
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.openRegistryOnFreePort(KarafTestContainer.java:228)
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.start(KarafTestContainer.java:134)
... 14 more

And this is an additional side effect exception due to stop being called after the start call wasn't successful (perhaps the stop method should be made more robust, to successfully run regardless of how far the start method got):

java.lang.RuntimeException: java.lang.NullPointerException
at com.example.itest.setup.TwoContainerPaxExam.run(TwoContainerPaxExam.java:50)
at org.apache.maven.surefire.junit4.JUnit4Provider.execute(JUnit4Provider.java:365)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeWithRerun(JUnit4Provider.java:273)
at org.apache.maven.surefire.junit4.JUnit4Provider.executeTestSet(JUnit4Provider.java:238)
at org.apache.maven.surefire.junit4.JUnit4Provider.invoke(JUnit4Provider.java:159)
at org.apache.maven.surefire.booter.ForkedBooter.invokeProviderInSameClassLoader(ForkedBooter.java:384)
at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:345)
at org.apache.maven.surefire.booter.ForkedBooter.execute(ForkedBooter.java:126)
at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:418)
Caused by: java.lang.NullPointerException
at org.apache.commons.io.FileUtils.forceDelete(FileUtils.java:1423)
at org.ops4j.pax.exam.karaf.container.internal.KarafTestContainer.stop(KarafTestContainer.java:700)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.tearDown(EagerSingleStagedReactor.java:118)
at org.ops4j.pax.exam.spi.reactors.EagerSingleStagedReactor.afterClass(EagerSingleStagedReactor.java:132)
at org.ops4j.pax.exam.spi.reactors.ReactorManager.afterClass(ReactorManager.java:441)
at org.ops4j.pax.exam.junit.impl.ProbeRunner.run(ProbeRunner.java:107)
at org.ops4j.pax.exam.junit.PaxExam.run(PaxExam.java:93)
at com.example.itest.setup.TwoContainerPaxExam.run(TwoContainerPaxExam.java:48)
... 8 more


Affects: 4.13.4
Votes: 0, Watches: 2

@ops4j-issues
Copy link
Author

Jean-Baptiste Onofre commented

I can add an option to avoid to find free port. And so the user can have the choice.

@amichair
Copy link

amichair commented Jan 5, 2022

Was the option added? How does one use it?

@b-q
Copy link

b-q commented Jan 12, 2022

Was the option added? How does one use it?

Hello @amichair i checked the code, the KarafTestContainer class has been modified. before 4.13.4 it will choose a free port from a range. After 4.13.4, it try always with the minimal port, that's the issue.

For my side, i did a rollback to 4.13.3.

So @jbonofre @ops4j-issues any update about this ?

Thanks

@amichair
Copy link

Yeah we're also stuck on 4.13.3 until this is reverted/fixed.

@amichair
Copy link

Still unusable in 4.13.5.

@amichair
Copy link

Will this be fixed?

oliverlietz added a commit that referenced this issue Aug 13, 2023
…M-940]

use free port finding method from Sling's TestSupport
@oliverlietz
Copy link
Member

@amichair Can you please check with latest snapshot (though no support for range)?

@oliverlietz oliverlietz self-assigned this Aug 18, 2023
@oliverlietz oliverlietz modified the milestones: 4.x, 4.14.0 Aug 18, 2023
@amichair
Copy link

The snapshot repository link on the project page in github is broken, where can I find it?

@amichair
Copy link

btw also the CI link is broken, and the latest version is way behind (on the homepage). Anyhoo, I cloned and built it locally, master branch fails to build, but I tried the 4.x branch and build was successful. Tried 4.13.6-SNAPSHOT with my two container itest and it works well, the issue seems to be resolved!

Still hitting #1093, but that's a different story :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: In Progress
Development

No branches or pull requests

4 participants