reactor / BlockHound

Java agent to detect blocking calls from non-blocking threads.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Native library name on Windows incorrect

jrehwaldt opened this issue · comments

I believe the packaged native library name for Windows is incorrect. The call System.mapLibraryName("BlockHound") resolves to BlockHound.dll on Windows, while the library is packaged as libBlockHound.dll.

Exception in thread "main" java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at com.intellij.rt.execution.CommandLineWrapper.main(CommandLineWrapper.java:67)
Caused by: java.util.ServiceConfigurationError: org.junit.platform.launcher.TestExecutionListener: Provider reactor.blockhound.junit.platform.BlockHoundTestExecutionListener could not be instantiated
	at java.util.ServiceLoader.fail(ServiceLoader.java:232)
	at java.util.ServiceLoader.access$100(ServiceLoader.java:185)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:384)
	at java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:404)
	at java.util.ServiceLoader$1.next(ServiceLoader.java:480)
	at java.lang.Iterable.forEach(Iterable.java:74)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:94)
	at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:67)
	at com.intellij.junit5.JUnit5IdeaTestRunner.createListeners(JUnit5IdeaTestRunner.java:42)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:45)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
	... 5 more
Caused by: java.lang.ExceptionInInitializerError
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
	at java.lang.Class.newInstance(Class.java:442)
	at java.util.ServiceLoader$LazyIterator.nextService(ServiceLoader.java:380)
	... 14 more
Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: Failed to load the following lib from a classpath: BlockHound.dll
	at reactor.BlockHound$Builder.install(BlockHound.java:264)
	at reactor.BlockHound.install(BlockHound.java:64)
	at reactor.blockhound.junit.platform.BlockHoundTestExecutionListener.<clinit>(BlockHoundTestExecutionListener.java:12)
	... 20 more
Caused by: java.lang.IllegalStateException: Failed to load the following lib from a classpath: BlockHound.dll
	at reactor.BlockHound.extractNativeLibFile(BlockHound.java:298)
	at reactor.BlockHound.access$100(BlockHound.java:42)
	at reactor.BlockHound$Builder.install(BlockHound.java:227)
	... 22 more

I tested against latest Build-Snapshot from 22-Feb-2019 14:43 on Java 8. Thank you.

Hi @jrehwaldt,

Thanks for trying it on Windows! Unfortunately, I haven't had a chance to test it on Windows, and your report is very valuable!

It should be as simple as changing this line:

from "${rootProject.project(":native-agent").buildDir}/external-build/BlockHound/windows/libBlockHound.dll"

Would you like to take a chance to contribute? :)

Sure, I'll give it a try.

Released in 1.0.0.M2 🎉