Warnings reported with -Xcheck:jni when using Memory class
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 25/100
- Issue 类型
- 缺陷
- 描述清晰度
- 需要澄清
- 活跃度
- 停滞
- 技术栈
- java
调研方向
使用提供的 Java 代码片段、OpenJDK 11.0.8、JNA 5.6.0 和 -Xcheck:jni 重现该报告。首先跟踪 Native.java 和 Memory.java 中的 Native.loadNativeDispatchLibraryFromClasspath 与 Memory.malloc;完成的标准是确定是否可以消除报告的 JNI 警告,并通过回归测试覆盖该结果。
由索引模型根据 Issue 内容生成。
描述
To reproduce, run the following snippet with -Xcheck:jni VM argument (I'm running with OpenJDK 11.0.8):
import com.sun.jna.Memory;
public class Test {
public static void main(String[] args) {
Memory m = new Memory(1024L);
System.out.println(m);
}
}
Observe output:
Warning: SIGINT handler expected:libjvm.so+0xc14f00 found:0x0000000000000001
Running in non-interactive shell, SIGINT handler is replaced by shell
Signal Handlers:
SIGSEGV: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGBUS: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGFPE: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGPIPE: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGXFSZ: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGILL: [libjvm.so+0xc14d00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGUSR2: [libjvm.so+0xc14b80], sa_mask[0]=00100000000000000000000000000000, sa_flags=SA_RESTART|SA_SIGINFO
SIGHUP: [libjvm.so+0xc14f00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGINT: SIG_IGN, sa_mask[0]=00000000000000000000000000000000, sa_flags=none
SIGTERM: [libjvm.so+0xc14f00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
SIGQUIT: [libjvm.so+0xc14f00], sa_mask[0]=11111111011111111101111111111110, sa_flags=SA_RESTART|SA_SIGINFO
WARNING: JNI local refs: 33, exceeds capacity: 32
at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2442)
at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2498)
- locked <0x00000000ff401e20> (a java.util.HashSet)
at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2694)
at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2627)
at java.lang.Runtime.load0([email protected]/Runtime.java:768)
at java.lang.System.load([email protected]/System.java:1837)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
at com.sun.jna.Native.<clinit>(Native.java:195)
at com.sun.jna.Memory.malloc(Memory.java:722)
at com.sun.jna.Memory.<init>(Memory.java:114)
at test.Test.main(Test.java:9)
WARNING in native method: JNI call made without checking exceptions when required to from CallStaticObjectMethod
at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2442)
at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2498)
- locked <0x00000000ff401e20> (a java.util.HashSet)
at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2694)
at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2627)
at java.lang.Runtime.load0([email protected]/Runtime.java:768)
at java.lang.System.load([email protected]/System.java:1837)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:1018)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:988)
at com.sun.jna.Native.<clinit>(Native.java:195)
at com.sun.jna.Memory.malloc(Memory.java:722)
at com.sun.jna.Memory.<init>(Memory.java:114)
at test.Test.main(Test.java:9)
allocated@0x7ffff0510730 (1024 bytes)
Seen with jna-5.6.0.jar (latest I could find from maven: https://mvnrepository.com/artifact/net.java.dev.jna/jna).
Background:
We observe those warnings in our Eclipse based product (when checking for JNI problems with -Xcheck:jni), coming from SVN plug-ins:
WARNING in native method: JNI call made without checking exceptions when required to from CallStaticObjectMethod
at java.lang.ClassLoader$NativeLibrary.load0([email protected]/Native Method)
at java.lang.ClassLoader$NativeLibrary.load([email protected]/ClassLoader.java:2442)
at java.lang.ClassLoader$NativeLibrary.loadLibrary([email protected]/ClassLoader.java:2498)
- locked <0x00000005007d6730> (a java.util.HashSet)
at java.lang.ClassLoader.loadLibrary0([email protected]/ClassLoader.java:2694)
at java.lang.ClassLoader.loadLibrary([email protected]/ClassLoader.java:2627)
at java.lang.Runtime.load0([email protected]/Runtime.java:768)
at java.lang.System.load([email protected]/System.java:1837)
at com.sun.jna.Native.loadNativeDispatchLibraryFromClasspath(Native.java:761)
at com.sun.jna.Native.loadNativeDispatchLibrary(Native.java:736)
at com.sun.jna.Native.<clinit>(Native.java:131)
at com.sun.jna.Pointer.<clinit>(Pointer.java:41)
at org.tmatesoft.svn.core.internal.util.jna.SVNLinuxUtil.<clinit>(SVNLinuxUtil.java:33)
- 主要语言
- Java
- 星标
- 8.9k
- 派生
- 1.7k
- 平均合并
- 1 天 13 小时
- 30 天内合并 PR
- 1
环境准备
这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
java-native-access/jna 的其他 Issue
-
`Native.typeOptions` never releases library interfaces, leaking classloaders可能已有人在做 @curforever 于 7 天前认领。 未关闭
难度 4/5 1-2 天 新手友好度 48/100
java-native-access/jna#1742 ·
-
难度 4/5 3-5 天 新手友好度 66/100
java-native-access/jna#1738 ·
-
难度 4/5 3-5 天 新手友好度 45/100
java-native-access/jna#1736 ·
-
难度 3/5 1-2 天 新手友好度 65/100
java-native-access/jna#1717 ·
-
Windows32Exception - The parameter is incorrect可能已有人在做 @marktech0813 于 343 天前认领。 未关闭
难度 4/5 3-5 天 新手友好度 35/100
java-native-access/jna#1700 · 11 条评论 ·
查看 java-native-access/jna 的全部 Issue
相似的 Issue
-
area/kotlin
难度 2/5 1-3 小时 新手友好度 84/100
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 1 天内回复
-
Large page[number] overflows the computed offset and returns the wrong page可能已有人在做 @auraseb 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 70/100