I found the cause. I didn't calculate the local inertia for the terrain.
Code:
mCollisionShape->calculateLocalInertia(mass, fallInertia);
I probably don't understand local inertia right. What is it and why is it needed for static objects? Can't find anything in the documentation explaining it.
Also, it's very weird that on debug I can get away with not calculating it.
Can anyone point me to proper documentation, or at least explain in a few words what was happening?
Thank you!
LATER EDIT:
It wasn't needed. The debug had an assert preventing calls of calculateLocalInertia on concave shapes. I shouldn't have passed any inertia to btRigidBodyConstructionInfo at all when constructing the terrain.