apache / apache/arrow-java

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

未關閉 適合新手
#349 0 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視
主要語言
Java
星號
94
分支
152
平均合併
3 天 16 小時
30 天內合併 PR
11

描述

Hi Team,

Just compiling [java dataset ](https://github.com/apache/arrow/tree/master/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:

 
```java

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

 

Test code:

 
```java

/**
* 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:

 
```java

[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](https://github.com/OpenHFT/Chronicle-Core/blob/ea/src/main/java/net/openhft/chronicle/core/Jvm.java#L144).

 

Consider: Current test on macOS finished ok on the [ci workflows](https://github.com/ursacomputing/crossbow/runs/4987946390).

**Reporter**: [David Dali Susanibar Arce](https://issues.apache.org/jira/browse/ARROW-15834) / @davisusanibar

**Note**: *This issue was originally created as [ARROW-15834](https://issues.apache.org/jira/browse/ARROW-15834). Please see the [migration documentation](https://github.com/apache/arrow/issues/14542) for further details.*

貢獻指南

開啟貢獻指南

研究方向

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.

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
testing
Issue 類型
缺陷
難度
2/5
預估耗時
1-3 小時
活躍度
停滯
描述清晰度
描述清楚
新手友好度
62/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。