Twice, but the first one wasn't in an airplane.
We had a 36 ft sailboat. It had just had a major overhaul and I was single handed motoring back to our regular harbour. Going round a point where two tides meet I was skirting the race when the engine failed. The boat started drifting into the race which was very, very choppy. I pulled out roller jib (120% masthead so a big sail,) but there wasn't enough wind even to fill it.
The boat drifted further into the race and was working it's way to the rocks. I called Mayday and about thirty minutes later the Coastguard arrived and towed me out of the race but then I had to get a commercial tow which was expensive. Luckily insurance took care of it.
Second time:
Downwind at 1,000 ft after take off coolant temp. soared. Shut down engine and turned for runway. Called Mayday (uncontrolled airfield) to warn gliders using airfield I was returning no engine. Made the runway. Turned out I had left the radiator cap off. Found it sitting on top of engine.(No cowl either!)