Closed kenoir closed 7 months ago
Hmm, there are still some issues here. Trying to run
after sbt project items
results in an error like:
sbt:items> run
[info] running weco.api.items.Main
13:38:13.716 [sbt-bg-threads-1] INFO weco.api.items.Main$ - Starting service
13:38:14.027 [main-actor-system-akka.actor.default-dispatcher-4] INFO akka.event.slf4j.Slf4jLogger - Slf4jLogger started
13:38:14.206 [sbt-bg-threads-1] ERROR weco.api.items.Main$ - Fatal error, terminating service:
java.lang.IllegalStateException: Error during attachment using: co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent$AttachmentProvider$Compound@598a78c7
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:613)
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.attach(ByteBuddyAgent.java:273)
at co.elastic.apm.attach.ElasticApmAttacher.attach(ElasticApmAttacher.java:170)
at co.elastic.apm.attach.ElasticApmAttacher.attach(ElasticApmAttacher.java:113)
at weco.Tracing$.init(Tracing.scala:49)
at weco.api.items.Main$.$anonfun$new$1(Main.scala:32)
at weco.typesafe.WellcomeTypesafeApp.runWithConfig(WellcomeTypesafeApp.scala:21)
at weco.typesafe.WellcomeTypesafeApp.runWithConfig$(WellcomeTypesafeApp.scala:16)
at weco.api.items.Main$.runWithConfig(Main.scala:24)
at weco.api.items.Main$.delayedEndpoint$weco$api$items$Main$1(Main.scala:26)
at weco.api.items.Main$delayedInit$body.apply(Main.scala:24) [0/1943]
at scala.Function0.apply$mcV$sp(Function0.scala:39)
at scala.Function0.apply$mcV$sp$(Function0.scala:39)
at scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:17)
at scala.App.$anonfun$main$1$adapted(App.scala:80)
at scala.collection.immutable.List.foreach(List.scala:431)
at scala.App.main(App.scala:80)
at scala.App.main$(App.scala:78)
at weco.api.items.Main$.main(Main.scala:24)
at weco.api.items.Main.main(Main.scala)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at sbt.Run.invokeMain(Run.scala:144)
at sbt.Run.execute$1(Run.scala:94)
at sbt.Run.$anonfun$runWithLoader$5(Run.scala:121)
at sbt.Run$.executeSuccess(Run.scala:187)
at sbt.Run.runWithLoader(Run.scala:121)
at sbt.Defaults$.$anonfun$bgRunTask$6(Defaults.scala:1988)
at sbt.Defaults$.$anonfun$termWrapper$2(Defaults.scala:1927)
at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:23)
at scala.util.Try$.apply(Try.scala:213)
at sbt.internal.BackgroundThreadPool$BackgroundRunnable.run(DefaultBackgroundJobService.scala:367)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at java.base/java.lang.Thread.run(Thread.java:829)
Caused by: java.lang.reflect.InvocationTargetException: null
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at co.elastic.apm.attach.bytebuddy.agent.Attacher.install(Attacher.java:106)
at co.elastic.apm.attach.bytebuddy.agent.ByteBuddyAgent.install(ByteBuddyAgent.java:608)
... 36 common frames omitted
Caused by: java.lang.UnsatisfiedLinkError: Can't load library: /Users/kennyr/Library/Caches/JNA/temp/jna7060826423949229767.tmp
It looks like we are still pulling in a dependency on an older version of the JNA library that is causing the issue. Inspecting the dependency tree:
Generated using the sbt command dependencyBrowseTreeHTML
, after adding these changes: https://github.com/wellcomecollection/catalogue-api/pull/738
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
We can see this is coming from the elastic APM library, that is pulled in via wellcomecollection/scala-libs.
Probably worth looking at bumping this dependency in a future PR.
What does this change?
The 1.4.1 version of SBT has an issue with the version of the JNA library is uses which prevents it from loading on M1 macs.
See: https://github.com/sbt/io/issues/320
How to test?
The most recent version (1.9.8) of sbt seems to work with this project, so upgrading.
How can we measure success?
People working on this project with M1 macs can build and test it.
Have we considered potential risks?
Jumping from 1.4.x to 1.9.x is a large version leap ... there may be some breaking changes lurking in the release notes. However if the project builds and tests without error we can be somewhat reassured that we have not met any.