Live streams, such as with the twitch.tv addon, showcase as buffering via Kodi around every 20 minutes, but I believe it is actually losing the tcp connection (verified by tcpdump/wireshark) and having to rebuild it due to a wifi issue.
This is a section of dmesg from the RPi3 in question. Part of the section below appears over and over, but when it includes the Indicate_Legacy_Packet part I believe the issue happens. This pi is unpingable from other devices on my local network during this event.
Dec 10 17:12:51 OSMC-KODI kernel: DeQueueRunning[0]= TRUE!
Dec 10 17:13:39 OSMC-KODI kernel: DeQueueRunning[0]= TRUE!
Dec 10 17:13:43 OSMC-KODI kernel: 80211> CFG80211_OpsScan ==>
Dec 10 17:13:43 OSMC-KODI kernel: 80211> Can not find any chan info!
Dec 10 17:13:43 OSMC-KODI kernel: 80211> Can not find any chan info!
Dec 10 17:13:44 OSMC-KODI kernel: 80211> cfg80211_scan_done
Dec 10 17:13:44 OSMC-KODI kernel: 80211> CFG80211_OpsSurveyGet ==>
Dec 10 17:13:44 OSMC-KODI kernel: 80211> busy time = 2132420656 -2135099984
Dec 10 17:13:44 OSMC-KODI kernel: Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=128, pRxWI.TID=0, RxD->AMPDU=0!
Dec 10 17:13:44 OSMC-KODI kernel: 625, flush one!
Dec 10 17:13:45 OSMC-KODI kernel: 80211> No scan is running!
Dec 10 17:13:45 OSMC-KODI kernel: Indicate_Legacy_Packet():flush reordering_timeout_mpdus! RxWI->Flags=128, pRxWI.TID=0, RxD->AMPDU=0!
Dec 10 17:13:47 OSMC-KODI kernel: 80211> No scan is running!
Dec 10 17:13:49 OSMC-KODI kernel: 80211> No scan is running!
Dec 10 17:13:51 OSMC-KODI kernel: 80211> No scan is running!
Dec 10 17:13:51 OSMC-KODI kernel: 6b7, flush one!
Dec 10 17:13:56 OSMC-KODI kernel: DeQueueRunning[0]= TRUE!
Dec 10 17:13:56 OSMC-KODI kernel: DeQueueRunning[0]= TRUE!
The driver can block when a scan takes place, which is why you get the slight dropout.
ConnMan sets up automatic scanning with wpa_supplicant. If the signal drops below a certain threshold, wpa_supplicant will think you are roaming away from the base station. I believe this is what causes the scan to take place. But this value is too strict; and some drivers may not always report reliable figures under certain conditions.
It’s being investigated. I will keep you updated of any improvements and they will be made available automatically as an update.
Update: BackgroundScanning=false resolved the issue.
Sam’s solution for next patch is far more elegant and would completely resolve my issue without the need to disable the scan. I have never been worse than -59 in the last 2 days and in my reading anything better than -67 is considered “streaming quality signal”, so -65 seems like the perfect trigger number.