I put the code to query the thread stack frames back in to see if fixing the stack size helped, and it seems to work again. The interesting thing is that running the applications worked, as long as I didn’t ask for the stack frames, but as soon as I requested them, the VM died.
Here’s my theory: When the JVM is just running, it has a stack that always has the maximum size, or at least that one that isn’t really segmented into individual frames. The JVM just pushes and pops stuff on and off the stack. When my stack frame was too small, that didn’t matter. When the JVM runs an application, it ignores the stack frame size.
When it needs to return an array of stack frames, though, it needs to separate the one lump of stack into individual pieces. For this, it uses the information about the stack frame size contained in the code attributes. When this information isn’t right, it gets off track and the stack frames returned don’t actually correspond to the real frames.
I’ll have to test this a little more, but so far, it looks encouraging