synthetichealth / synthea

Synthetic Patient Population Simulator
https://synthetichealth.github.io/synthea
Apache License 2.0
2.2k stars 657 forks source link

build check test hangs on M1 mac mini #841

Open mcoolidge opened 3 years ago

mcoolidge commented 3 years ago

When doing "./gradlew build check test" from a fresh git clone, the tests run for a while then hang with:

2021-01-10T07:53:02.103-0500 [DEBUG] [TestEventLogger] org.mitre.synthea.helpers.AttributesTest > testGraphs STARTED 2021-01-10T07:53:13.549-0500 [LIFECYCLE] [org.gradle.cache.internal.DefaultFileLockManager] 2021-01-10T07:53:13.549-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 2021-01-10T07:53:13.549-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry. 2021-01-10T07:53:13.551-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry. 2021-01-10T07:53:13.552-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry. 2021-01-10T07:53:13.552-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Lock acquired on daemon addresses registry. 2021-01-10T07:53:13.552-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Releasing lock on daemon addresses registry. 2021-01-10T07:53:23.549-0500 [DEBUG] [org.gradle.cache.internal.DefaultFileLockManager] Waiting to acquire shared lock on daemon addresses registry.

This might be unrelated to the M1 (using zulu-8 jdk)

openjdk version "1.8.0_275" OpenJDK Runtime Environment (Zulu 8.50.0.1017-CA-macos-aarch64) (build 1.8.0_275-b01) OpenJDK 64-Bit Server VM (Zulu 8.50.0.1017-CA-macos-aarch64) (build 25.275-b01, mixed mode)

bwalsh commented 2 years ago

Running into similar. How did you resolve?

sthotanav commented 2 years ago

Any resolution on this issue? The build seems to get struck at 80% after 259 Tests

eedrummer commented 2 years ago

While Synthea will run on Java 1.8, it will certainly run on more modern versions of java.

I don't have an easy way to install Java 1.8 through sdkman, which is what I use to manage my JDKs. I don't have 1.8 handy because I just moved to a new M1-based MacBook Pro. Using openjdk 17.0.3, I'm able to fully run the test suite on Apple Silicon.

jawalonoski commented 2 years ago

I'm running on x64 hardware, using OpenJDK 1.8 Temerin which is only available for x64, so I can't recreate this issue at this time.

However, Google searches suggest that the messages shown are periodic gradle daemon health checks typically unrelated to the code actually being executed. One way to attempt to debug the issue, or at least see what the VM is actually doing or stuck on, would be to employ a tool like VisualVM. https://visualvm.github.io

giankelahealth commented 2 years ago

Hi Synthea team,

I am struggling to install Synthea locally on my machine. I was wondering if you could help me. I am on an M1 MacBook Pro running macOS Monterey 12.6. I have tried the installation using the following Java versions:

oracle64-11.0.16.1 openjdk64-17.0.4.1

When I run ./gradlew build check test my command prompt seems to take a long time to run test org.mitre.synthea.helpers.AttributesTest:

:test > 268 tests completed, 4 skipped :test > Executing test org.mitre.synthea.helpers.AttributesTest

I waited for almost 60 minutes with no success.

Could you please provide me with some guidance on how I can successfully install Synthea locally?

jawalonoski commented 2 years ago

Can you try the following?

  1. Stop Gradle Daemon
    ./gradlew --stop
    • Note: If you are running multiple development environment at the same time, this won't stop Gradle Daemons that are running with different versions of Gradle. You might want to stop them all.
  2. Run without Daemon
    ./gradlew --no-daemon clean check

    Alternatively, try to increase the memory available to your JVM if you haven't already.

jawalonoski commented 2 years ago

Someone looked at this for us...

The issue on the M1 hardware is apparently with org.mitre.synthea.helpers.AttributesTest specifically:

https://github.com/synthetichealth/synthea/blob/5d90e086985aecf69e8a1140d9793ad8f104fe73/src/main/java/org/mitre/synthea/helpers/Attributes.java#L452

We don't have a fix yet.

One work around is to disable the AttributesTest. You can do this by importing import org.junit.Ignore; and adding @Ignore annotations to those test methods, or just deleting the src/test/java/org/mitre/synthea/helpers/AttributesTest.java file.

giankelahealth commented 2 years ago

I deleted AttributesTest.java from src/test/java/org/mitre/synthea/helpers/AttributesTest.java and ran the build using oracle64-11.0.16.1 on my M1 MacBook Pro. I can confirm, that BUILD SUCCESSFUL.

Thank you @jawalonoski!

eedrummer commented 2 years ago

For those following this issue.

On the master branch, we are using an older version of the graphviz-java library. graphviz is a tool that Synthea uses to visualize modules.

The graphviz-java library uses different engines when running the code for graphviz. The one that seems to work reliably is calling out to a native installation of graphviz. So, a work around for this is to install graphviz and all tests will pass on the master branch if you are running Java 11 or greater regardless of what CPU architecture you are running on. You can install graphviz using Homebrew pretty easily. I have verified that this gets tests to pass on Java 11 and Java 17 on Apple Silicon.

I am also working on a fix for this issue, so that the tests will pass regardless of whether graphviz is installed locally or not. You can follow that in PR #1157.