title: OpenJDK Segmentation Fault in write_memory_serialize_page
body: <p>I'm trying to debug code written in Java/JNI/C++. I think there must be some sort of library incompatibility, but I haven't been able to figure out what. While stepping through the C++ (in gdb), I get the following seg fault:</p>
  
  <p><a href="https://i.stack.imgur.com/JsuGG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JsuGG.png" alt="enter image description here"></a></p>
  
  <p>It seems like this is being caused by one of the java threads, other than the one calling into C++. Unfortunately, I haven't been successful in pinpointing it. Is there a known incompatibility or coding error which causes this? If nothing else, any suggestions for finding the bug?</p>
  
  <p>I used to have the eclipse debugger and gdb hooked up simultaneously, so I could step through the respective pieces of code. Unfortunately, that seems to be unstable at times. I would eventually do a continue from gdb, but it seems like control never got passed back to java. So, it just hung until I killed the process tree.</p>
  
  <p><strong>Edit:</strong> if I attach both debuggers and just give gdb the continue command, I can step through java to this point:</p>
  
  <p><a href="https://i.stack.imgur.com/DZRfh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/DZRfh.png" alt="enter image description here"></a></p>
  
  <p>where:</p>
  
  <p>lusCodebase = file:./jini/jsk-dl.jar file:./jini/reggie-dl.jar file:./jini/jsk-dl.jar</p>
  
  <p>lusPolicy points to a file with contents: grant {permission java.security.AllPermission "", "";};</p>
  
  <p>lustClasspath =  jini/reggie.jar:jini/jini-ext.jar:jini/jsk-lib.jar:jini/jsk-platform.jar</p>
  
  <p>After stepping over line 130, the seg fault appears in gdb, with the "switching to thread" message.</p>
  
  <p>With -Xcheck:jni added, I see many Warnings like this:</p>
  
  <p><a href="https://i.stack.imgur.com/NlKMB.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NlKMB.png" alt="enter image description here"></a></p>
  
  <p>However, when the seg fault comes up, I don't get one of those warnings. In all the warnings that pop up, I only see a couple references to my application code, and they're related to some minor piece of the GUI, which shouldn't have any effect on the failures I'm seeing in testing.</p>