简体   繁体   English

Java 中的 EXCEPTION_ACCESS_VIOLATION

[英]EXCEPTION_ACCESS_VIOLATION in Java

I may have come across a weird bug in Java.我可能在 Java 中遇到了一个奇怪的错误。 When I'm running the following code, I get "EXCEPTION_ACCESS_VIOLATION" exception.当我运行以下代码时,出现“EXCEPTION_ACCESS_VIOLATION”异常。

I know the code doesn't make sense (in terms of logic) because it's a subset of the code I originally wrote.我知道代码没有意义(就逻辑而言),因为它是我最初编写的代码的子集。 If I remove several lines the bug disappear.如果我删除几行,错误就会消失。

Can anyone figure out what's the cause of this bug?谁能弄清楚这个错误的原因是什么?

public static void main(String[] args) {
    for (int i=0; i < 4000; i++) {
        System.out.println("item " + i);
        test1();
    }

    //runBatch();   
    System.out.println("Done! bye bye..");
}

public static int test1() {
    int     count;
    int     allMiddleCount;
    int[]   b = new int[0];

    allMiddleCount  = 0;
    for (int i = 1; i < 64; i++)
    {
        // evaluating the size of the subset
        count = 0;
        for (int j = 0; j < 6; j++)
            count++;

        allMiddleCount++;
    }

    for (int i=0; i < allMiddleCount; i++) {

    }

    return 0;
}

Can anyone figure out whats the cause of this bug?谁能弄清楚这个错误的原因是什么?

If the process is dying rather than it being a normal Java exception, it's basically a JVM bug.如果进程正在死亡而不是普通的 Java 异常,那么它基本上是一个 JVM 错误。 You haven't said which platform you're on or which version you're using, but try updating to a later version.您还没有说明您使用的是哪个平台或您使用的是哪个版本,但请尝试更新到更高版本。

谷歌搜索EXCEPTION_ACCESS_VIOLATION我在 Oracle 站点上发现该 JVM 存在一些仍在调查中的错误

I had this exception while using java to run some specific dlls in my project and it was solved after some months investigating all of our environment, If anyone still needs it here is the link.我在使用 java 在我的项目中运行一些特定的 dll 时遇到了这个异常,并且在调查我们所有的环境几个月后解决了这个问题,如果有人仍然需要它,这里是链接。 EXCEPTION_ACCESS_VIOLATION in Jacob dll using VM in Jenkins pipeline 在 Jenkins 管道中使用 VM 的 Jacob dll 中的 EXCEPTION_ACCESS_VIOLATION

There we have the description of all the things we have tried and maybe it will be of use.在那里我们有我们尝试过的所有事情的描述,也许它会有用。 The problem was solved by going back to not only the java version, but the specific build version.通过不仅返回到 java 版本,而且返回到特定的构建版本,问题得到解决。 (in our case it was java 8 build 141) (在我们的例子中是 java 8 build 141)

I tested your code;我测试了你的代码; works fine.工作正常。

My guess is, this is caused by hardware or software platform problems.我的猜测是,这是由硬件或软件平台问题引起的。

ok, i can confirm that there is a bug in java.好的,我可以确认java中存在错误。 i just got a mail from them confirming a new bug.我刚收到他们的邮件,确认了一个新错误。

http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7178093 (the site will update in two days..) http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7178093 (网站将在两天后更新..)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM