Skip to content
This repository was archived by the owner on Nov 4, 2024. It is now read-only.
This repository was archived by the owner on Nov 4, 2024. It is now read-only.

"make tests" failed with NullPointerException #20

@JerryYangSH

Description

@JerryYangSH
/usr/lib/jvm/jdk1.8.0_231/bin/javac  -Xlint:unchecked -XDenableSunApiLintControl -proc:none -d target/test_classes -cp src:target/classes:lib:src:lib/ST-4.0.8.jar: src/test/java/tests/PersistentLinkedQueueTest.java src/test/java/tests/PersistentLinkedListTest.java src/test/java/tests/TestCases.java src/test/java/tests/PersistentSIHashMapTest.java src/test/java/tests/PersistentFPTree2Test.java src/test/java/tests/PersistentArrayTest.java src/test/java/tests/PersistentTestRunner.java src/test/java/tests/ObjectDirectoryTest.java src/test/java/tests/PersistentFPTree1Test.java src/test/java/tests/PersistentHashMapTest.java src/test/java/tests/PersistentTupleTest.java src/test/java/tests/PersistentAtomicReferenceTest.java src/test/java/tests/PersistentSkipListMapTest.java src/test/java/tests/MultithreadTest.java src/test/java/tests/PersistentByteBufferTest.java src/test/java/tests/PersistentArrayListTest.java
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djava.library.path=/usr/local/lib
/usr/lib/jvm/jdk1.8.0_231/bin/java  -ea -cp target/classes:lib:src:lib/ST-4.0.8.jar::target/test_classes:src -Djava.library.path=target/cppbuild tests.PersistentTestRunner
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF-8 -Djava.library.path=/usr/local/lib
Opening heap... Exception in thread "main" java.lang.ExceptionInInitializerError
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at lib.util.persistent.ClassInfo.initReconstructor(ClassInfo.java:139)
        at lib.util.persistent.ClassInfo.<init>(ClassInfo.java:74)
        at lib.util.persistent.ClassInfo.init(ClassInfo.java:125)
        at lib.xpersistent.XHeap.open(XHeap.java:83)
        at tests.PersistentTestRunner.main(PersistentTestRunner.java:32)
Caused by: java.lang.NullPointerException
        at lib.util.persistent.ObjectCache.lambda$objectForAddress$2(ObjectCache.java:184)
        at lib.util.persistent.Util.synchronizedBlock(Util.java:119)
        at lib.util.persistent.ObjectCache.objectForAddress(ObjectCache.java:172)
        at lib.util.persistent.ObjectCache.getReference(ObjectCache.java:137)
        at lib.util.persistent.ObjectCache.get(ObjectCache.java:120)
        at lib.util.persistent.ObjectCache.get(ObjectCache.java:114)
        at lib.util.persistent.AbstractPersistentMutableArray.getObject(AbstractPersistentMutableArray.java:85)
        at lib.util.persistent.AnyPersistent.getObject(AnyPersistent.java:221)
        at lib.util.persistent.AbstractPersistentArray.getObjectElement(AbstractPersistentArray.java:70)
        at lib.util.persistent.PersistentArray.get(PersistentArray.java:86)
        at lib.util.persistent.PersistentHashMap.getNode(PersistentHashMap.java:427)
        at lib.util.persistent.PersistentHashMap.get(PersistentHashMap.java:303)
        at lib.util.persistent.ObjectDirectory.get(ObjectDirectory.java:36)
        at lib.util.persistent.PersistentArrayList.<clinit>(PersistentArrayList.java:57)
        ... 7 more
make: *** [Makefile:83: tests] Error 1

relevent code is in ObjectCache.java:

@SuppressWarnings("unchecked")
    static <T extends AnyPersistent> Ref<T> objectForAddress(long address, boolean forAdmin) {
        final Address addr =  new Address(address);
        return Util.synchronizedBlock(cacheLock, ()->{ 
        Ref<T> ans = null;
        if ((ans = (Ref<T>)cache.get(addr)) != null && ans.get() != null) {
                 // trace(true, address, "OFA HIT: in OC");
            // assert(ans.get() != null);
            return ans; 
        }
        else {
            T obj = null;
            MemoryRegion region = new UncheckedPersistentMemoryRegion(address);
            long classInfoAddress = region.getLong(0);
            ClassInfo ci = ClassInfo.getClassInfo(classInfoAddress);  // ci is Null !!!
            ObjectType<T> type = Types.typeForName(ci.className());
            obj = AnyPersistent.reconstruct(new ObjectPointer<T>((ObjectType)type, region));
            ans = new Ref(obj, forAdmin);
            if (!Transaction.addReconstructedObject(address, ans)) cache.put(addr, ans);
        }
        return ans; 
        });
    }```

On ubuntu 19.
jerry@u19:~/opensources/pcj$ sudo fdisk -l /dev/pmem0
Disk /dev/pmem0: 4 GiB, 4294967296 bytes, 8388608 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes

jerry@u19:~/opensources/pcj$ mount | grep pmem0
/dev/pmem0 on /mnt/mem type ext4 (rw,relatime,dax)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions