The rattling you are asking about turned out on my 320 to be the catalytic
converter breaking up internally.
no oil
Your bad muffler might be part of the reason your check engine light comes on. Usually, your bad muffler causes something else to go wrong and that causes your check engine light to come on. Problems cascade.
A hole in a muffler is from two causes. It has either rusted through or been damaged by something hitting it.
loud, and shety muffler
Fatigue, maybe from missing or broken hangers.
Is your oil level?
The guy in the trunk is still alive!!!
hotness
Possibly a loose heat shield or other component.
Two main causes: the inner parts have failed, or the outer heat shield has failed.
A muffler going bad can be caused by many things. But generally, it is either contact with the ground causing a dent, oil burning causing sludge and residue in the muffler, or corrosion from age and moisture in the exhaust pipe causing a hole or the collapse of baffles.
If you are running at high rpms and turn the key off the unburned fuel will be pumped from the cylinders in the engine into the muffler. The muffler is still hot enough to ignite the unburned fuel.