cdsap / Talaiot

Simple and extensible plugin to track task times in your Gradle Project.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

M1 Throwing exception when calculate Memory metrics

tinder-inakivillar opened this issue · comments

Testing M1 we found:

	at oshi.hardware.platform.mac.MacGlobalMemory.<init>(MacGlobalMemory.java:51)
	at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getMemory(MacHardwareAbstractionLayer.java:70)
	at com.cdsap.talaiot.metrics.RamAvailableMetric$1.invoke(SimpleMetrics.kt:56)
	at com.cdsap.talaiot.metrics.RamAvailableMetric$1.invoke(SimpleMetrics.kt:55)

We need to check if updating the dependencies of oshi fixes the problem

I ran into this issue when i tried building an android project on the new M1 mbp. Was using OpenJDK 11 and 13 pre built for arm64 on MacOS. Stacktrace:

Caused by: java.lang.NoClassDefFoundError: Could not initialize class com.sun.jna.Native
	at com.sun.jna.Structure.setAlignType(Structure.java:280)
	at com.sun.jna.Structure.<init>(Structure.java:197)
	at com.sun.jna.Structure.<init>(Structure.java:193)
	at com.sun.jna.Structure.<init>(Structure.java:180)
	at com.sun.jna.Structure.<init>(Structure.java:172)
	at com.sun.jna.platform.mac.SystemB$XswUsage.<init>(SystemB.java:365)
	at oshi.hardware.platform.mac.MacGlobalMemory.<init>(MacGlobalMemory.java:51)
	at oshi.hardware.platform.mac.MacHardwareAbstractionLayer.getMemory(MacHardwareAbstractionLayer.java:70)
	at com.cdsap.talaiot.metrics.RamAvailableMetric$1.invoke(SimpleMetrics.kt:56)
	at com.cdsap.talaiot.metrics.RamAvailableMetric$1.invoke(SimpleMetrics.kt:55)
	at com.cdsap.talaiot.metrics.base.Metric.get(Metric.kt:15)
	at com.cdsap.talaiot.provider.MetricsProvider.get(MetricsProvider.kt:45)
	at com.cdsap.talaiot.provider.MetricsProvider.get(MetricsProvider.kt:16)
	at com.cdsap.talaiot.publisher.TalaiotPublisherImpl.publish(TalaiotPublisherImpl.kt:43)
	at com.cdsap.talaiot.TalaiotListener.buildFinished(TalaiotListener.kt:72)
	at jdk.internal.reflect.GeneratedMethodAccessor856.invoke(Unknown Source)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)

thanks @aaronweihe, just updated a new snapshot with the update of oshi library. Can you please test it? I don't have a M1.
The repo to use the snapshot is:

maven ( url = uri("http://oss.jfrog.org/artifactory/oss-snapshot-local") )

thanks

the update of the dependency doesn't fix the problem. Reference oshi/oshi#1462

Updated to 5.5.0.
Waiting to test again in a M1 Mac
#267