I've encountered a very strange bug in a project that I can't explain. I'm using Bullet Physics under my own C wrapper, a simple entity component system of my own design, where entities are allocated objects, each with a single fixed component (For things like transformation and whether or not it should be replicated over a network), and a number of other, variable components. Components are allocated in entirely separate arrays, rather than inside the entity itself. I've created a simple test scene with a handful of static bodies, and a dynamic, rigid body for a character, implemented some simple walking and jumping. My simulation runs at a fixed 60Hz, with physics substeps at 240Hz, and everything works fine.
Then I came to add an extra field to the fixed entity component structure. A single integer to make networking the exact "type" of entity simpler (Rocket, character, vehicle, etc.). I should add that I'm testing this on a single machine, not over a network at the moment. I put this field just above the transformation data, recompiled everything and ran it. The physics simulation was running at about half-speed; walking, jumping, falling, all running slowly. I had the game print out the game timer every frame, along with the frame number and the delta time being fed into world->stepSimulation (and double checked that with a breakpoint on that function), and everything was correct. Additionally, there's a cooldown period on jumping that requires you to have been on the ground for 0.25 seconds before jumping again, and that behaved properly. The only thing that was affected was the physics simulation.
Next step, I moved the "type" field to the very bottom of the fixed component structure. Suddenly everything goes back to normal. I've scoured every usage of the fixed component, making sure I've not done anything weird like accessing a value directly from its memory address, which I haven't. Also perhaps worth mentioning that Bullet doesn't ever read / write directly from / to this component, instead I pull values after the simulation step is complete.
I realise this is a difficult problem to diagnose without source code, but it's a somewhat large project, and at the moment I'm really just looking for something that could point me in the right direction. It's not currently critical, everything seems to be working fine with the "type" field at the bottom, but if anyone has encountered something like this, it'd be good to hear from you.