Caused by accumulated carbon under the head and/or plugs becoming red hot and ignites the the gas mixture
when the ignition switch is off. carbon may be caused by burning some oil from worn rings...
dirty carburetor or adjusted too rich...poor gas...old gas.
If tractor is used only few hours per year I suggest premium gas and gas stabilizer Stabil or others.