Reputation: 11
I may have come across a weird bug in Java. When I'm running the following code, I get "EXCEPTION_ACCESS_VIOLATION" exception.
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;
}
Upvotes: 1
Views: 581
Reputation: 99
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. EXCEPTION_ACCESS_VIOLATION in Jacob dll using VM in Jenkins pipeline
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. (in our case it was java 8 build 141)
Upvotes: 1
Reputation: 11
ok, i can confirm that there is a bug in java. i just got a mail from them confirming a new bug.
https://bugs.java.com/bugdatabase/view_bug?bug_id=7178093 (the site will update in two days..)
Upvotes: 0
Reputation: 12102
Googling for EXCEPTION_ACCESS_VIOLATION
lands me on the Oracle site that there are some bugs with the that JVM that are still under investigation
Upvotes: 3
Reputation: 4180
I tested your code; works fine.
My guess is, this is caused by hardware or software platform problems.
Upvotes: 0
Reputation: 1502036
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. You haven't said which platform you're on or which version you're using, but try updating to a later version.
Upvotes: 4