Random CEC problem

Hello,
I’m still using CE 19.5 with a s905D device. I have this CEC problem for quite a long time. Just ask here for some hints. I have a Sony TV conneted to a Yamaha AV receiver. CE device and other devices are all connected to the receiver. I control CE by the TV remote through CEC. When I turn on the TV, the TV turns on the receiver. When I turn off the TV, the TV close the receiver. Other devices are kept on. This routine works without any problem usually. But randomly when I turn on the TV, the TV can not detect the receiver so it does not turn it on. Once that happen, no matter how many times I restart the TV, it will not detect the receiver. I tested to reboot all the devices in the chain, the only rescue is to reboot CE device. Actually, only a reboot of Kodi is required(I control Kodi by Yatse). Once kodi GUI is shutdown, the TV detects the receiver and turns it on immediately. Then every thing comes back to normal, untill the problem happens at another time randomly. I tried to tune the options in kodi CEC settings but none works.
So my question is, is this a mostly a CE problem or the receiver? If it’s the CE problem, I’d like to look more deeply. If not, then I think I have to live with that since there is nothing to look for them.