16

I've been working on a Java project for year. My code had been working fine for months. A few days ago I upgraded the Java SDK to the newest version 1.6.0_26 on my Mac (Snow Leopard 10.6.8). After the upgrade, something very weird happens. When I run some of the classes, I get this error:

Invalid memory access of location 0x202 rip=0x202

But, if I run them with -Xint (interpreted) they work, slow but work fine. I get that problem in classes where I use bitwise operators (bitboards for the game Othello). I can't put any code here because I don't get an error, exception or something similar. I just get that annoying message.

Is it normal that the code doesn't run without -Xint but it works with it? What should I do?

Thanks in advance

David Robles
  • 9,477
  • 8
  • 37
  • 47
  • 1
    Very strange. Is this shown as an exception? A compilation error? Something else? Is there any more text in the error message? Does it indicate a line number? Does the program keep running, or does it blow up? Does it happen every time you run your code without -Xint? Are you using Swing for your GUI? Is there any potential for a concurrency issue? – Hovercraft Full Of Eels Jul 03 '11 at 03:16
  • 2
    Is not shown as an exception, just a message. It compiles fine. That's the only message, sometimes it shows a different memory address, but just the same message. The program stops running. I'm not using Swing, but I'm using threads. It could be a concurrency issue, but why it doesn't work when running as interpreted? That's the annoying part. – David Robles Jul 03 '11 at 03:22
  • 3
    Looks like a bug in the VM. Try to isolate the problem by cutting down your program (remove things you think are not essential - if it will not occur again, undo and try with another part. If it still occurs, repeat). Then submit a bug to whoever produced your JRE. – Paŭlo Ebermann Jul 03 '11 at 03:26
  • 1
    Make sure that you are compiling in newest version. – Zemzela Jul 03 '11 at 10:21

4 Answers4

4

When a JVM starts crashing like that, it is a sign that something has broken the JVM's execution model.

Does your application include any native code? Does it use any 3rd-party libraries with native code components? If neither is true, then the chances are that this is a bug in the Apple port of the JVM. It could be a JIT compiler bug, or a bug in some JVM native code library.

What can you do about a bug like that?

Not a lot.

  • Reduce your application by progressively chopping out bits until you have a small testcase that exhibits the problem.
  • Based on the testcase, see if there's some empirical way to avoid the problem.
  • Submit a bug report to Apple with the testcase.
Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • No, my application doesn't include any native code and I'm not using any 3rd-party libraries. I'll follow your suggestions, let's see how much time it takes me to find the bug. Thanks! – David Robles Jul 03 '11 at 04:03
4

I just came across this situation and it turned out to be related to a piece of code that was serializing a JSON object with a cyclic reference to itself. I removed the cycle and the error went away. I suspect this is related to a memory overflow error that is now handled differently by newer JVMs on Mac OSX. In this case, I was running Mac OSX 10.7.

For completeness the errors I was receiving were:

Invalid access of stack red zone 0x10e586d30 rip=0x10daabba6
Bus error: 10

And:

Invalid memory access of location 0x10b655890 rip=0x10a8baba6
Segmentation fault: 11
Michael Gaylord
  • 7,282
  • 8
  • 50
  • 47
0

Please check if /etc/hosts is empty and verify that it include these configurations :

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost 
fe80::1%lo0     localhost
Youcef LAIDANI
  • 55,661
  • 15
  • 90
  • 140
tiger
  • 1
  • 1
0

Also verify that you are building the GUI on the event dispatch thread and never updating a GUI component from any other thread.

Related errors are notoriously hard to reproduce, but the change associated with altered timing is suggestive.

trashgod
  • 203,806
  • 29
  • 246
  • 1,045