"what could be the cause of this?"
mine makes a knocking soundDieseling and running on (fuel solenoid off but ignition still on) look totally different. Dieseling from a carbon hot spot or over heated spark plug electrode results in engine operating erratically and usually making some off knocking sounds. With run on the engine just slows down and dies. Which do you have?