My servo heats up, even with nothing attached. (MG90S) Code problem?

Hello guys!
I'm working on a project where I have attached a HMC5883L and MPU 9250. The readings from both the devices are fine.
Problem is when I servo write my MPU value to servo motor, it's heating up to the point it stops working.
I was wondering that is it a coincident that two of the servos turned out to be faulty or is it something in the code causing that?
thanks!

I have attached the code below

headcode.ino (10.6 KB)

Do not attempt to power motors or servos from the Arduino.

Use a separate power supply (4xAA battery pack is fine for one servo) and connect the grounds.

I'm using a dedicated power supply. The power supply I'm using is in the link below:

This power supply provides for the Arduino and the servos at the same time. Could that possibly be the problem?

Does your servo work properly using the servo-sweep example?

...R

hadn't tried it before running it with the code, but definitely not after burning...

junaidhalepota:
hadn't tried it before running it with the code, but definitely not after burning...

Then you need a new servo - but you probably did not need me to tell you that.

The overheating may have been caused by your code trying to force the motor beyond its physical end-stop. Servos are not designed to be able to produce their maximum torque continuously.

...R

Thank you for your insight.