MarshalX / tgcalls

Voice chats, private incoming and outgoing calls in Telegram for Developers
https://t.me/tgcallslib
GNU Lesser General Public License v3.0
516 stars 91 forks source link

Reconnecting or rejoining exits with `free(): invalid pointer` #109

Closed nitanmarcel closed 3 years ago

nitanmarcel commented 3 years ago

So, by mistake I forgot to switch accounts so I tried joining with the same account as I was streaming and the app crashed for me with free(): invalid pointer.

I know you can't join an account if is already joined but probably the error should be handled to not interrupt the workflow.

Debug Logs:


DEBUG:asyncio:Using selector: EpollSelector
DEBUG:pytgcalls.dispatcher.dispatcher:Build storage of handlers for dispatcher.
DEBUG:pytgcalls.implementation.group_call_native:Create a new native instance..tgcalls v1.0.0, Copyright (C) 2020-2021 Il`ya (Marshal) <https://github.com/MarshalX>Licensed under the terms of the GNU Lesser General Public License v3 (LGPLv3) 
DEBUG:pytgcalls.implementation.group_call_native:Native instance created.[generic] bbc_radio_one: Requesting headerWARNING: Could not send HEAD request to https://stream.live.vc.bbcmedia.co.uk/bbc_radio_one: HTTP Error 400: Bad Request[generic] bbc_radio_one: Downloading webpage
DEBUG:pytgcalls.implementation.group_call_native:Start native group call..
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7fe3d77d0a30>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=1998451030 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 1998451030, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fe3d77dbcd0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Network state updated..
DEBUG:pytgcalls.implementation.group_call_native:Set is muted. New value: False.
DEBUG:pytgcalls.dispatcher.dispatcher:Trigger handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.dispatcher.dispatcher:Get handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.implementation.group_call_native:New network state is True.
DEBUG:pytgcalls.implementation.group_call_native:Start status (call action) worker..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 766878737, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fe3d7415490>})]})
DEBUG:pytgcalls.implementation.group_call_native:Not equal ssrc. Expected: 766878737. Actual: 1998451030
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNonefree(): invalid pointer
MarshalX commented 3 years ago

auto reconnect works for GroupCallFile. There is need more info about your case with GroupCallRaw

nitanmarcel commented 3 years ago

auto reconnect works for GroupCallFile. There is need more info about your case with GroupCallRaw

I'll do some tests when I get home. Maybe something happens when the library reads the raw bytes and a disconnection happens.

Here's a small example on how I prepare the data from reading. The stream comes from a ffmpeg subprocess with the output redirected to stdout instead to a file.

def get_chunk(self, _, length: int) -> Optional[bytes]:
    if self._process:
        data = self._process.stdout.read(length)
nitanmarcel commented 3 years ago

It doesn't happen only on reconnect, it probably has something to do on how the bytes are parsed in the c++ library or I don't know. I have no idea how to debug it honestly

nitanmarcel commented 3 years ago

I tried multiple ways to replicate the error:

Group Call Stop

@MarshalX I did some tests and it looks that free(): invalid pointer also happens on group_call.stop().

Code to reproduce the error:

async def main(client):
    async with client:
        group_call_factory = GroupCallFactory(client, CLIENT_TYPE)
        group_call = group_call_factory.get_raw_group_call(on_played_data=on_played_data)
        await group_call.start(PEER)
        await asyncio.sleep(5)
        await group_call.stop()
        # Exits with free(): invalid pointer

Logs:

DEBUG:asyncio:Using selector: EpollSelector
INFO:telethon.network.mtprotosender:Connecting to 149.154.167.91:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.167.91:443/TcpFull complete!
DEBUG:pytgcalls.dispatcher.dispatcher:Build storage of handlers for dispatcher.
DEBUG:pytgcalls.implementation.group_call_native:Create a new native instance..
DEBUG:pytgcalls.implementation.group_call_native:Native instance created.
DEBUG:pytgcalls.implementation.group_call_native:Start native group call..
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7fc2e62ef9a0>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62fc520>})]})
DEBUG:pytgcalls.implementation.group_call_native:Not equal ssrc. Expected: 253702336. Actual: None
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=253702336 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62ef970>})]})
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7fc2e62ef0a0>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62fc3a0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=253702336 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62ef310>})]})
DEBUG:pytgcalls.implementation.group_call_native:Network state updated..
DEBUG:pytgcalls.implementation.group_call_native:Set is muted. New value: False.
DEBUG:pytgcalls.dispatcher.dispatcher:Trigger handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.dispatcher.dispatcher:Get handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.implementation.group_call_native:New network state is True.
DEBUG:pytgcalls.implementation.group_call_native:Start status (call action) worker..
DEBUG:pytgcalls.implementation.group_call_native:Stop requested.
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
DEBUG:asyncio:Using selector: EpollSelector
INFO:telethon.network.mtprotosender:Connecting to 149.154.167.91:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.167.91:443/TcpFull complete!
DEBUG:pytgcalls.dispatcher.dispatcher:Build storage of handlers for dispatcher.
DEBUG:pytgcalls.implementation.group_call_native:Create a new native instance..
DEBUG:pytgcalls.implementation.group_call_native:Native instance created.
DEBUG:pytgcalls.implementation.group_call_native:Start native group call..
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7fc2e62ef9a0>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62fc520>})]})
DEBUG:pytgcalls.implementation.group_call_native:Not equal ssrc. Expected: 253702336. Actual: None
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=253702336 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62ef970>})]})
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7fc2e62ef0a0>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62fc3a0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=253702336 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 253702336, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7fc2e62ef310>})]})
DEBUG:pytgcalls.implementation.group_call_native:Network state updated..
DEBUG:pytgcalls.implementation.group_call_native:Set is muted. New value: False.
DEBUG:pytgcalls.dispatcher.dispatcher:Trigger handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.dispatcher.dispatcher:Get handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.implementation.group_call_native:New network state is True.
DEBUG:pytgcalls.implementation.group_call_native:Start status (call action) worker..
DEBUG:pytgcalls.implementation.group_call_native:Stop requested.
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone

Group Call Start Leave Current Group Call

This also happens when calling group_call.start() after calling group_call.leave_current_group_call()

Code to reproduce the error:

async def main(client):
    async with client:

        group_call_factory = GroupCallFactory(client, CLIENT_TYPE)
        group_call = group_call_factory.get_raw_group_call(on_played_data=on_played_data)
        await group_call.start(PEER)
        await asyncio.sleep(5)
        await group_call.leave_current_group_call()
        await asyncio.sleep(5)
        await group_call.reconnect()
        # Exits with free(): invalid pointer

Logs:

DEBUG:asyncio:Using selector: EpollSelector
INFO:telethon.network.mtprotosender:Connecting to 149.154.167.91:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.167.91:443/TcpFull complete!
DEBUG:pytgcalls.dispatcher.dispatcher:Build storage of handlers for dispatcher.
DEBUG:pytgcalls.implementation.group_call_native:Create a new native instance..
DEBUG:pytgcalls.implementation.group_call_native:Native instance created.
DEBUG:pytgcalls.implementation.group_call_native:Start native group call..
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7f80fc3e5730>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc374bb0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Not equal ssrc. Expected: 291289022. Actual: None
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=291289022 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc3e5610>})]})
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7f80fc3e5610>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc37cc10>})]})
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=291289022 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc3e5d90>})]})
DEBUG:pytgcalls.implementation.group_call_native:Network state updated..
DEBUG:pytgcalls.implementation.group_call_native:Set is muted. New value: False.
DEBUG:pytgcalls.dispatcher.dispatcher:Trigger handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.dispatcher.dispatcher:Get handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.implementation.group_call_native:New network state is True.
DEBUG:pytgcalls.implementation.group_call_native:Start status (call action) worker..
DEBUG:pytgcalls.implementation.group_call_native:Try to leave current group call.
DEBUG:pytgcalls.implementation.group_call_native:Completely leave current group call.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': True, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc374bb0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Remove ssrcs [291289022].
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 291289022, 'left': True, 'peer': <telethon.tl.types.PeerUser object at 0x7f80fc374eb0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Remove ssrcs [291289022].
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone

Group Call Start Reconnect

I even tried calling group_call.reconnect():

Code to reproduce the error:

async def main(client):
    async with client:

        group_call_factory = GroupCallFactory(client, CLIENT_TYPE)
        group_call = group_call_factory.get_raw_group_call(on_played_data=on_played_data)
        await group_call.start(PEER)
        await asyncio.sleep(5)
        await group_call.leave_current_group_call()
        await asyncio.sleep(5)
        await group_call.reconnect()
        # Exits with free(): invalid pointer

Logs:

DEBUG:asyncio:Using selector: EpollSelector
INFO:telethon.network.mtprotosender:Connecting to 149.154.167.91:443/TcpFull...
INFO:telethon.network.mtprotosender:Connection to 149.154.167.91:443/TcpFull complete!
DEBUG:pytgcalls.dispatcher.dispatcher:Build storage of handlers for dispatcher.
DEBUG:pytgcalls.implementation.group_call_native:Create a new native instance..
DEBUG:pytgcalls.implementation.group_call_native:Native instance created.
DEBUG:pytgcalls.implementation.group_call_native:Start native group call..
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7f93b4130730>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b413e460>})]})
DEBUG:pytgcalls.implementation.group_call_native:Not equal ssrc. Expected: 762352162. Actual: None
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
DEBUG:pytgcalls.implementation.group_call_native:Emit join payload..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=762352162 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b4130880>})]})
DEBUG:pytgcalls.implementation.group_call_native:Group call update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallWrapper>({'chat_id': 'placeholder', 'call': <GroupCallWrapper>({'id': 'placeholder', 'params': <telethon.tl.types.DataJSON object at 0x7f93b4130880>})})
DEBUG:pytgcalls.implementation.group_call_native:Set join response payload..
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b40c90d0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeRtc
DEBUG:pytgcalls.implementation.group_call_native:Join response payload was set.
DEBUG:pytgcalls.implementation.group_call_native:Successfully connected to VC with ssrc=762352162 as PeerUser.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': False, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b4130e20>})]})
DEBUG:pytgcalls.implementation.group_call_native:Network state updated..
DEBUG:pytgcalls.implementation.group_call_native:Set is muted. New value: False.
DEBUG:pytgcalls.dispatcher.dispatcher:Trigger handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.dispatcher.dispatcher:Get handlers of NETWORK_STATUS_CHANGED
DEBUG:pytgcalls.implementation.group_call_native:New network state is True.
DEBUG:pytgcalls.implementation.group_call_native:Start status (call action) worker..
DEBUG:pytgcalls.implementation.group_call_native:Try to leave current group call.
DEBUG:pytgcalls.implementation.group_call_native:Completely leave current group call.
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': True, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b413e4f0>})]})
DEBUG:pytgcalls.implementation.group_call_native:Remove ssrcs [762352162].
DEBUG:pytgcalls.implementation.group_call_native:Group call participants update..
DEBUG:pytgcalls.implementation.group_call_native:<UpdateGroupCallParticipantsWrapper>({'participants': [<GroupCallParticipantWrapper>({'source': 762352162, 'left': True, 'peer': <telethon.tl.types.PeerUser object at 0x7f93b413e040>})]})
DEBUG:pytgcalls.implementation.group_call_native:Remove ssrcs [762352162].
DEBUG:pytgcalls.implementation.group_call_native:Reconnecting..
DEBUG:pytgcalls.implementation.group_call_native:Set connection mode GroupConnectionMode.GroupConnectionModeNone
nitanmarcel commented 3 years ago

Workaround

If both group_call.stop_playout() and group_call.stop_output() are called before calling group_call.stop() the client is able to reconnect without any problems.