-
-
Notifications
You must be signed in to change notification settings - Fork 109
Open
Labels
Description
Describe the bug
I have 2 AppleTV boxes : one on tvOS 18.3 and another with 18.4 beta.
The one with 18.4 beta raises a connection lost exception right after the connection (the other one works fine).
I paired the device with 2 protocols : companion and airplay. The disconnection is raised when using the companion protocol, (airplay is fine).
Edit : tested with python 3.12 and 3.13, on windows and a Ubuntu docker instance.
See the sample code below to reproduce it with the following steps
- Pair the Apple TV device with companion protocol using tvOS 18.4
- Connect to it with pyatv
- Subscribe to connection lost/closed events by implementing the
DeviceListener
interface - The client will receive a lost connection event a few milliseconds later
class AppleTvClient(DeviceListener):
async def start_client():
self._atv = AppleTv(device=config, loop=_LOOP)
await self._atv.connect()
self._atv.listener = self
def connection_lost(self, _exception) -> None:
_LOG.exception("[%s] Lost connection %s", self.log_id, _exception)
def connection_closed(self) -> None:
_LOG.debug("[%s] Connection closed!", self.log_id)
### Error log
Extraction of logs (full logs attached), see the `pyatv.protocols.companion.connection:Connection lost to remote device: None`
```log
DEBUG:__main__:[Salon Apple TV] Updating app list
DEBUG:pyatv.protocols.companion.protocol:Exchange OPACK: {'_i': 'FetchLaunchableApplicationsEvent', '_t': 2, '_c': {}, '_x': 20683}
DEBUG:pyatv.protocols.companion.protocol:Send OPACK: {'_i': 'FetchLaunchableApplicationsEvent', '_t': 2, '_c': {}, '_x': 20683}
DEBUG:pyatv.protocols.companion.connection:>> Send data (Data=e4425f696046657463684c61756e636861626c654170706c69636174696f6e734576656e74425f740a425f63e0425f7831cb50, FrameType=08)
DEBUG:pyatv.protocols.companion.connection:>> Send (Encrypted=9321a4c7e7672125d7db2a4e7e1e1085ad6c605d165f5368a476b89b75d326b14f4a7d4a3b2221343d9cbee4ef0d264de86dcda9f2b08497c63b6509afaf1fd60bc865, Header=08000043)
DEBUG:pyatv.protocols.companion.connection:Received data (Data=080003eb9c2012840d634416fce4079ce20dc26d7569db9e9507e25b7cd0def7b968dac4e67e28be8e99c408ce5937d44e5e0f9bede16d49f318b49b0e1f72fa1fe8d0c8ebd170533f8348e962ef89e87a79d620968457e2b7e60f28c0022ebceff90b2dbf400a69ae8294863e28f7c2b288cbbb8298d1797993dcd96fd5c0e033e3c8c904d8f2fa5f6b5410512d24fb23caee1a5aa9d814fe41e2131974255ce1f5a80601701fe4568d2009ca872ce2a120f67c49244b0310f2acd2010916a2011bf0cc24ea2da236bd4741e8119e9506a3379a7ac5022c44a81209bb12330c9acc8aee21ee636246874d332915730bef7598d82174f23934845dc1a9de6...)
DEBUG:pyatv.protocols.companion.protocol:Received frame FrameType.E_OPACK: b'\xe4B_x1\xcbPC_rT\nB_c\xefa!com.canalplusdistrib.mycanal.prodGmyCANALScom.firecore.infuseFInfuseQcom.apple.FitnessEFormeRcom.apple.podcastsHPodcastsRcom.cbs.canada.appJParamount+Rcom.apple.TVMoviesEFilmsUcom.apple.TVWatchListBTVRcom.apple.TVPhotosFPhotosTcom.apple.TVAppStoreJApp\xc2\xa0StoreUcom.amazon.aiv.AIVAppKPrime VideoQcom.apple.TVShowsKS\xc3\xa9ries\xc2\xa0TVPcom.apple.ArcadeFArcadeTorg.videolan.vlc-iosCVLCRcom.apple.TVSearchJRechercherNfr.kaze.kzplayCADNYtv.molotov.MolotovAppProdIMolotovTVWcom.apple.TVHomeSharingKOrdinateursRcom.apple.facetimeHFaceTimeVcom.google.ios.youtubeGYouTubeQtv.mrmc.mrmc.tvosDMrMCYcom.lvmh.RadioClassiqueTVORadio ClassiqueTcom.olimsoft.oplayerGOPlayer[com.dailymotion.dailymotionMdailymotionTV^com.ubisoft.raymanadventurestvQRayman AdventuresUcom.disney.disneyplusGDisney+Tcom.apple.TVSettingsIR\xc3\xa9glagesUcom.apple.appleeventsR\xc3\x89v\xc3\xa9nements AppleScom.netflix.NetflixGNetflixWcom.firecore.infuse.proLInfuse Pro 4Qcom.apple.TVMusicGMusiqueXcom.allocine.applifranceIAlloCin\xc3\xa9\x03B_t\x0b'
DEBUG:pyatv.protocols.companion.protocol:Process incoming OPACK frame (FrameType.E_OPACK): {'_x': 20683, '_rT': 2, '_c': {'com.canalplusdistrib.mycanal.prod': 'myCANAL', 'com.firecore.infuse': 'Infuse', 'com.apple.Fitness': 'Forme', 'com.apple.podcasts': 'Podcasts', 'com.cbs.canada.app': 'Paramount+', 'com.apple.TVMovies': 'Films', 'com.apple.TVWatchList': 'TV', 'com.apple.TVPhotos': 'Photos', 'com.apple.TVAppStore': 'App\xa0Store', 'com.amazon.aiv.AIVApp': 'Prime Video', 'com.apple.TVShows': 'Séries\xa0TV', 'com.apple.Arcade': 'Arcade', 'org.videolan.vlc-ios': 'VLC', 'com.apple.TVSearch': 'Rechercher', 'fr.kaze.kzplay': 'ADN', 'tv.molotov.MolotovAppProd': 'MolotovTV', 'com.apple.TVHomeSharing': 'Ordinateurs', 'com.apple.facetime': 'FaceTime', 'com.google.ios.youtube': 'YouTube', 'tv.mrmc.mrmc.tvos': 'MrMC', 'com.lvmh.RadioClassiqueTV': 'Radio Classique', 'com.olimsoft.oplayer': 'OPlayer', 'com.dailymotion.dailymotion': 'dailymotionTV', 'com.ubisoft.raymanadventurestv': 'Rayman Adventures', 'com.disney.disneyplus': 'Disney+', 'com.apple.TVSettings': 'Réglages', 'com.apple.appleevents': 'Événements Apple', 'com.netflix.Netflix': 'Netflix', 'com.firecore.infuse.pro': 'Infuse Pro 4', 'com.apple.TVMusic': 'Musique', 'com.allocine.applifrance': 'AlloCiné'}, '_t': 3}
DEBUG:pyatv.protocols.companion.connection:Connection lost to remote device: None
DEBUG:pyatv.protocols.airplay.mrp_connection:Closing connection
How to reproduce the bug?
- Pair the Apple TV device with companion protocol using tvOS 18.4
- Connect to it with pyatv
- Subscribe to connection lost/closed events by implementing the
DeviceListener
interface - The client will receive a lost connection event a few milliseconds later
What is expected behavior?
The client should not disconnect (unless there is a network failure...)
Operating System
Tested on Windows and Ubuntu
Python
3.12
pyatv
16.0.0
Device
Apple TV 4K (gen 2), tvOS 18.4
Additional context
maxileith