Skip to content

Commit

Permalink
Merge pull request #8286 from s1ck/intel-mac-workaround
Browse files Browse the repository at this point in the history
Skip ServiceAvailablity Agent attach on intel+mac+azul
  • Loading branch information
s1ck authored Oct 25, 2023
2 parents 26ddcd4 + 51e9e2f commit afe6822
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions memory-usage/src/main/java/org/neo4j/gds/mem/MemoryUsage.java
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,8 @@ private static final class VmInfoHolder {
*/
@SuppressForbidden(reason = "we want to use system.out here")
private static boolean isVmInfoAvailable() {
intelMacWorkaround();

var sysOut = System.out;
try {
var swallowSysOut = new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM, true, StandardCharsets.UTF_8);
Expand All @@ -386,6 +388,24 @@ private static boolean isVmInfoAvailable() {
}
}

/**
* JOL currently gets stuck on Azul Zulu 17.44.53-ca-jdk17.0.8.1 on Intel Macs.
* <p>
* We can work around this by skipping the Hotspot SA attach.
* See <a href="https://bugs.openjdk.org/browse/CODETOOLS-7903447">OpenJDK issue</a>
* </p>
*/
@Deprecated(forRemoval = true)
private static void intelMacWorkaround() {
var isAzul = System.getProperty("java.vendor").contains("Azul Systems");
var isIntel = System.getProperty("os.arch").contains("x86_64");
var isMac = System.getProperty("os.name").contains("Mac");

if (isAzul && isIntel && isMac) {
System.setProperty("jol.skipHotspotSAAttach", "true");
}
}

private static final class NullOutputStream extends OutputStream {

static final OutputStream NULL_OUTPUT_STREAM = new NullOutputStream();
Expand Down

0 comments on commit afe6822

Please sign in to comment.