[Java] Problem to get current reservation of JVM direct memory on macOS Big Sur

Open Beginner friendly
#349 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
62/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
java
Domain
testing

Research direction

Start with TestReservationListener.java around testDirectReservationListener and run the Maven command shown in the report on the affected macOS/JVM setup. Inspect the java.nio.Bits field used for the direct-memory reservation and verify the test also passes in the referenced CI workflow.

Written by the indexing model from the issue text.

Description

Hi Team,

Just compiling java dataset module it compile without problems but the test related to  get current reservation of JVM direct memory is failing on my local machine macOS Big Sur 11.5.2.

Command line:

 


mvn -Darrow.cpp.build.dir=../java-dist/lib clean install 

 

 

Test code:

 


/**
 * Get current reservation of jVM direct memory. Visible for testing.
 */
@VisibleForTesting
public long getCurrentDirectMemReservation() {
  try {
    final Class<?> classBits = Class.forName("java.nio.Bits");
     final Field f = classBits.getDeclaredField("reservedMemory");
    f.setAccessible(true);
    return ((AtomicLong) f.get(null)).get();
  } catch (Exception e) {
    throw new RuntimeException(e);
  }
} 

 

 

Error message:

 


[ERROR] testDirectReservationListener  Time elapsed: 0.028 s  <<< ERROR!
java.lang.RuntimeException: java.lang.NoSuchFieldException: reservedMemory
        at org.apache.arrow.dataset.jni.TestReservationListener.testDirectReservationListener(TestReservationListener.java:50)
 

 

 

If I changed from classBits.getDeclaredField("reservedMemory") to 

classBits.getDeclaredField("RESERVED_MEMORY") all the test finished without problems. Seeing this way to obtain reserved memory on Jvm.java.

 

Consider: Current test on macOS finished ok on the ci workflows.

Reporter: David Dali Susanibar Arce / @davisusanibar

Note: This issue was originally created as ARROW-15834. Please see the migration documentation for further details.

Dominant language
Java
Stars
95
Forks
154
Avg merge
2d 16h
Merged PRs (30d)
9

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/arrow-java

All issues in apache/arrow-java

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.