yahoo / Oak

A Scalable Concurrent Key-Value Map for Big Data Analytics
Apache License 2.0
268 stars 48 forks source link

oak crash on macos M1 chip #174

Open leonchen83 opened 3 years ago

leonchen83 commented 3 years ago

env

os : macosx aarch64
jdk: OpenJDK 64-Bit Server VM Zulu11.48+21-CA (11.0.11+9-LTS, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)

oak version

        <dependency>
            <groupId>com.yahoo.oak</groupId>
            <artifactId>oak</artifactId>
            <version>0.2.3.1</version>
        </dependency>

reproduce code

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

import java.nio.ByteBuffer;

import org.junit.Assert;
import org.junit.Test;

import com.yahoo.oak.OakMap;
import com.yahoo.oak.OakMapBuilder;
import com.yahoo.oak.common.integer.OakIntComparator;
import com.yahoo.oak.common.integer.OakIntSerializer;
import com.yahoo.oak.common.string.OakStringSerializer;

public class XOakMapTest {

    /**
     * 
     */
    @Test
    public void test1() {
        //
        final OakMap<Integer, String> m;
        m = oakmap1(256); Assert.assertTrue(m.size() == 0);
        m.put(1, "123456789"); Assert.assertTrue(m.size() == 1);
        String v1 = m.remove(1); assertEquals (v1, "123456789");

        //
        m.put(2, "654321"); Assert.assertTrue(m.size() == 1);
        m.put(2, "654321"); Assert.assertTrue(m.size() == 1);
        String v2 = m.get(2); Assert.assertEquals(v2, "654321");
        m.close();
    }

    /**
     * 
     */
    private static OakMap<Integer, String> oakmap1(int n) {
        final int block = 1024 * 1024;
        final OakMapBuilder<Integer, String> builder;
        final OakIntComparator c = new OakIntComparator();
        final OakIntSerializer ks = new OakIntSerializer();
        final OakStringSerializer vs = new OakStringSerializer();
        builder = new OakMapBuilder<>(c, ks, vs, Integer.MIN_VALUE);
        builder.setPreferredBlockSize(block); return builder.build();
    }
}

hs_err_pid74815.log

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGBUS (0xa) at pc=0x00000001056ffb8c, pid=74815, tid=9731
#
# JRE version: OpenJDK Runtime Environment Zulu11.48+21-CA (11.0.11+9) (build 11.0.11+9-LTS)
# Java VM: OpenJDK 64-Bit Server VM Zulu11.48+21-CA (11.0.11+9-LTS, mixed mode, tiered, compressed oops, g1 gc, bsd-aarch64)
# Problematic frame:
# V  [libjvm.dylib+0x6ffb8c]  Unsafe_CompareAndSetLong(JNIEnv_*, _jobject*, _jobject*, long, long, long)+0x110
#
# No core dump will be written. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
#   http://www.azulsystems.com/support/
#

more details see attachment hs_err_pid74815.log

it works fine in windows 10, linux, macos x86_64