Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic off event data capture but user still live #216

Open
masumr opened this issue Apr 16, 2024 · 7 comments
Open

Automatic off event data capture but user still live #216

masumr opened this issue Apr 16, 2024 · 7 comments
Assignees
Labels
bug Something isn't working

Comments

@masumr
Copy link

masumr commented Apr 16, 2024

It seems like the user is live, and the package is supposed to provide event data. However, after some time, the event data capture stops, and an error is generated below-
image

Package Version

My version of TikTokLive is 6.0.5.

@isaackogan
Copy link
Owner

isaackogan commented Apr 16, 2024

Thanks for the report, though I can't see where the error was originating from.

Do you have a larger stacktrace?

Please also double check the version with pip freeze.

@isaackogan isaackogan added the bug Something isn't working label Apr 16, 2024
@masumr
Copy link
Author

masumr commented Apr 17, 2024

Rechecking with TikTokLive package version 6.0.5
image

@isaackogan
Copy link
Owner

Hi, is that pip freeze or requirements.txt? They are not necessarily equivalent. It's likely your issue is genuinely occurring in the latest version but I'd just like to confirm since I can't reproduce it myself.

Best,
Isaac

@masumr
Copy link
Author

masumr commented Apr 22, 2024

Let me, describe things more clear.
Back in the version 6.0.3 and 6.0.4 I didn't got this type of issue.
But , now in this latest version 6.0.5 , for every tiktok live, I am getting this type of issues.
User is in live (say for example 2-3 hrs+) suddenly , the event-data stopped coming BUT USER STILL IN LIVE at tiktok.

Please, let me know, if there's any point of confusion.

@diego-fmachado
Copy link

diego-fmachado commented Apr 22, 2024

I get a similar error sometimes when using client.disconnect():

Exception in thread [ConnectionManager]Async-stop:
Traceback (most recent call last):
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 963, in transfer_data
    message = await self.read_message()
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 1033, in read_message
    frame = await self.read_data_frame(max_size=self.max_size)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 1108, in read_data_frame
    frame = await self.read_frame(max_size)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 1165, in read_frame
    frame = await Frame.read(
            ^^^^^^^^^^^^^^^^^
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\framing.py", line 68, in read
    data = await reader(2)
           ^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\asyncio\streams.py", line 726, in readexactly
    raise exceptions.IncompleteReadError(incomplete, n)
asyncio.exceptions.IncompleteReadError: 0 bytes read on a total of 2 expected bytes

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Program Files\Python311\Lib\threading.py", line 1038, in _bootstrap_inner
    self.run()
  File "C:\Program Files\Python311\Lib\threading.py", line 975, in run
    self._target(*self._args, **self._kwargs)
  File "C:\Users\...\code_ultimate\module\base\module.py", line 219, in wait
    future.result()
  File "C:\Program Files\Python311\Lib\concurrent\futures\_base.py", line 456, in result
    return self.__get_result()
           ^^^^^^^^^^^^^^^^^^^
  File "C:\Program Files\Python311\Lib\concurrent\futures\_base.py", line 401, in __get_result
    raise self._exception
  File "C:\Users\...\code_ultimate\module\connection_manager\client\client_new.py", line 30, in stop
    await self._client.disconnect()
  File "C:\Users\...\venvnew\Lib\site-packages\TikTokLive\client\client.py", line 212, in disconnect
    await self._event_loop_task
  File "C:\Users\...\venvnew\Lib\site-packages\TikTokLive\client\client.py", line 233, in _client_loop
    async for event in self._ws_loop(initial_response):
  File "C:\Users\...\venvnew\Lib\site-packages\TikTokLive\client\client.py", line 257, in _ws_loop
    async for response_message in self._ws.connect(*self._build_connect_info(initial_response)):
  File "C:\Users\...\venvnew\Lib\site-packages\TikTokLive\client\ws\ws_client.py", line 158, in connect
    async for webcast_message in self.connect_loop(uri, headers):
  File "C:\Users\...\venvnew\Lib\site-packages\TikTokLive\client\ws\ws_client.py", line 194, in connect_loop
    async for message in websocket:
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 498, in __aiter__
    yield await self.recv()
          ^^^^^^^^^^^^^^^^^
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 568, in recv
    await self.ensure_open()
  File "C:\Users\...\venvnew\Lib\site-packages\websockets\legacy\protocol.py", line 939, in ensure_open
    raise self.connection_closed_exc()
websockets.exceptions.ConnectionClosedError: no close frame received or sent

@isaackogan
Copy link
Owner

Hey,

I get what you guys are saying but there isn't really a lot for me to do with it. There's no description of the code triggering the issue, and the stacktraces are not really helpful.

I'm not ashamed to say I could use a little help debugging here. Any ideas, thoughts?

@diego-fmachado
Copy link

I've solved this by supressing the exception in connect_loop, allowing the loop to open a new websocket connection

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants