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

JDK 20: java.lang.NoSuchFieldException: handle => Wrong PID helper? #137

Closed
jerboaa opened this issue Feb 7, 2023 · 5 comments
Closed
Assignees
Labels

Comments

@jerboaa
Copy link

jerboaa commented Feb 7, 2023

We see a failure in some quarkus native integration tests which uses flapdoodle for process interaction. The JDK 20 build fails with:

 java.lang.NoSuchFieldException: handle
	at java.base/java.lang.Class.getDeclaredField(Class.java:2707)
	at de.flapdoodle.embed.process.runtime.Processes.windowsProcessId(Processes.java:111)
	at de.flapdoodle.embed.process.runtime.Processes.access$200(Processes.java:45)
	at de.flapdoodle.embed.process.runtime.Processes$PidHelper$3.getPid(Processes.java:242)
	at de.flapdoodle.embed.process.runtime.Processes.processId(Processes.java:80)
	at de.flapdoodle.embed.process.runtime.ProcessControl.<init>(ProcessControl.java:61)
	at de.flapdoodle.embed.process.runtime.ProcessControl.start(ProcessControl.java:177)
	at de.flapdoodle.embed.process.types.RunningProcess.start(RunningProcess.java:71)
	at de.flapdoodle.embed.mongo.transitions.MongoServerStarter.result(MongoServerStarter.java:119)
	at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:62)
	at de.flapdoodle.reverse.TransitionWalker.resolve(TransitionWalker.java:50)
	at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:165)
	at de.flapdoodle.reverse.TransitionWalker.initState(TransitionWalker.java:69)
	at de.flapdoodle.embed.mongo.transitions.Mongod.start(Mongod.java:90)
	at io.quarkus.test.mongodb.MongoTestResource.start(MongoTestResource.java:71)
	at io.quarkus.test.common.TestResourceManager$TestResourceEntryRunnable.run(TestResourceManager.java:481)
	at java.base/java.util.concurrent.CompletableFuture$AsyncRun.run(CompletableFuture.java:1804)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.lang.Thread.run(Thread.java:1591)

It looks to me that it's not detecting the JDK version correctly and using the LEGACY pid helper here:
https://github.com/flapdoodle-oss/de.flapdoodle.embed.process/blob/main/src/main/java/de/flapdoodle/embed/process/runtime/Processes.java#L237 while it should be using the JDK 11 one (java.lang.Process.pid() exists in JDK 20).

@michaelmosmann
Copy link
Member

@jerboaa yes.. i should change this... so legacy is only used if we know for sure..

@michaelmosmann
Copy link
Member

@jerboaa .. there is a new release ahead 4.4.1 which should solve this issue.. will be in maven central in 12-24hrs from now.. (i guess)

@jerboaa
Copy link
Author

jerboaa commented Feb 7, 2023

Thanks for the quick turn-around!

@michaelmosmann
Copy link
Member

@jerboaa was easy:)

@zakkak
Copy link

zakkak commented Feb 8, 2023

FTR fixed by a3eeab4

Thanks @michaelmosmann

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

No branches or pull requests

3 participants