Hello. Welcome to hcm.
Sudden onset pain is mostly due to injury
when you were sleeping. It is not possible to rule out fracture
unless x ray
is taken and examined.
Rarely it can also be a case of gout
I advice you to visit your doctor who will order x ray first. If its normal and he suspects joint to be fine,then tests for gout can be under taken like aspiration of swelling and examination under microscope.
All the best