I suspect this is because they've not been fertilised - possibly due to a lack of male flowers or a lack of pollinating insects due to the weather.
However, my courgettes are not rotting off even tho' I suspect they've not been pollinated - see my query re Courgette Parador