polylith

Nikolas Pafitis 2024-06-22T20:22:53.800599Z

It looks like poly test does not respect :jvm-opts in deps.edn:

poly 0.2.19 (2024-02-16)
:jvm-opts  [
            ; Required for in-memory XTDB
            "--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED"]
Testing streamcraft.persistence-xtdb.core-test
java.lang.RuntimeException: Failed to initialize MemoryUtil. You must start Java with `--add-opens=java.base/java.nio=org.apache.arrow.memory.core,ALL-UNNAMED` (See )
        at org.apache.arrow.memory.util.MemoryUtil.(MemoryUtil.java:149)
        at org.apache.arrow.memory.ArrowBuf.setZero(ArrowBuf.java:1176)
        at org.apache.arrow.vector.BaseVariableWidthVector.reallocValidityAndOffsetBuffers(BaseVariableWidthVector.java:620)
        at org.apache.arrow.vector.BaseVariableWidthVector.handleSafe(BaseVariableWidthVector.java:1339)
        at org.apache.arrow.vector.BaseVariableWidthVector.setSafe(BaseVariableWidthVector.java:1178)
        at xtdb.vector.VariableWidthVectorWriter.writeBytes(FieldVectorWriters.kt:313)
        ...
        at polylith.clj.core.test_runner_orchestrator.interface$run.invokeStatic(interface.clj:4)
        at polylith.clj.core.command.test$run.invokeStatic(test.clj:9)
        at polylith.clj.core.command.core$execute.invokeStatic(core.clj:101)
        at polylith.clj.core.command.interface$execute_command.invokeStatic(interface.clj:4)
        at polylith.clj.core.poly_cli.core$_main.invokeStatic(core.clj:31)
        at polylith.clj.core.poly_cli.core$_main.doInvoke(core.clj:7)
        at clojure.lang.RestFn.applyTo(RestFn.java:137)
        at polylith.clj.core.poly_cli.core.main(Unknown Source)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field long java.nio.Buffer.address accessible: module java.base does not "opens java.nio" to unnamed module @21fc8cf6
        at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:391)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:367)
        at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:315)
        at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:183)
        at java.base/java.lang.reflect.Field.setAccessible(Field.java:177)
        at org.apache.arrow.memory.util.MemoryUtil.(MemoryUtil.java:94)
        ... 83 more

ERROR in (fetch--test) (ArrowBuf.java:1176)
Uncaught exception, not in assertion.
expected: nil
  actual: java.lang.ExceptionInInitializerError: null

...

tengstrand 2024-06-22T21:20:36.474439Z

Can you create an issue? You could also try other https://cljdoc.org/d/polylith/clj-poly/0.2.19/doc/test-runners and see if it works, until this is fixed in the default test runner.

šŸ‘€ 1
Nikolas Pafitis 2024-06-23T11:29:50.213479Z

It worked if i put jvm-opts in the :poly alias and using clojure -M:poly test I'd expect having it in :dev to be picked up as well though. Don't know if that is the intended behavior.

tengstrand 2024-06-23T12:25:46.285219Z

To be honest, I’m not sure either! Luckily, there are other users out there that may have things to say about this!

Nikolas Pafitis 2024-06-23T12:45:53.587019Z

@seancorfield When trying to run with your external test runner it doesn't pick up :jvm-opts even when they are in :poly alias Nevermind I have seen in the README how to pass jvm opts using external test runner https://github.com/seancorfield/polylith-external-test-runner?tab=readme-ov-file#passing-jvm-options

seancorfield 2024-06-23T16:53:34.569149Z

Note that :jvm-opts must be under an alias. The Clojure CLI does not support top-level :jvm-opts. Glad you've figured out the way to pass JVM options into the subprocess that the external test runner starts for each project. Did that solve your execute-tx hanging issue, BTW @pafitisnick?

šŸ™ 1
seancorfield 2024-06-23T16:58:56.677819Z

Ah, I see your jstack output is when running via the external test runner... I'll make a suggestion over in that channel on that thread...

Nikolas Pafitis 2024-06-23T17:20:06.558529Z

@seancorfield the specific output may use external test runner, but it happens with all poly test runners (kaocha and default).