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

Updates not coming consistently with v1.24 branch #3870

Closed
3 tasks done
boxxello opened this issue Jul 11, 2022 · 7 comments
Closed
3 tasks done

Updates not coming consistently with v1.24 branch #3870

boxxello opened this issue Jul 11, 2022 · 7 comments

Comments

@boxxello
Copy link

boxxello commented Jul 11, 2022

Hello, i opened 3-4 days ago an issue regarding update events not coming in consistently.
I tried installing the branch as you advised me to do, but it only got worse:
basically when the bot is ran it works correctly, gets the updates and the events get raised, but after a while it becomes unresponsive.

I have no logs that could reproduce the issue, beside this:

Telegram is having internal issues RpcCallFailError: Telegram is having internal issues, please try again later. (caused by GetChannelDifferenceRequest) .

I could send the full code I'm working on, but I don't think that could make the difference, anyway if it is required there's no problem to do so.
The bot runs on a cloud machine, and I'm 100% sure it was connected at the time the event got raised.

I'm going to revert back to the release, but why is this?

Checklist

  • The error is in the library's code, and not in my own.
  • I have searched for this issue before posting it and there isn't a duplicate.
  • I ran pip3 install -U https://github.com/LonamiWebs/Telethon/archive/v1.24.zip and triggered the bug in the latest version.
@st7105
Copy link
Contributor

st7105 commented Jul 12, 2022

Confirm.

@Lonami
Copy link
Member

Lonami commented Sep 20, 2022

There has been some fixes regarding update handling, particularly for bot accounts. I am going to close this issue since there's no particular error here that's crashing the update handling.

The new update handling should be recovering update gaps (something the old update handling did not). It should still dispatch every update coming in through the socket (much like the old system did). So I'm not sure why "updates could not be coming". If there are still issues in the v1.24 branch let me know (I am referring to commit 363c260 and above).

@Lonami Lonami closed this as completed Sep 20, 2022
@Rongronggg9
Copy link
Contributor

@Lonami I've seen my bot (v1.25) facing both this issue and #3873 in production multiple times in the last 10 days.

#3873 should have been fixed in 2f2a990 but I am not sure since there has not been a new release for me to upgrade.

After reading the recent commit history, I didn't find any fix strongly corresponding to this issue. But my bot actually facing a very similar scenario, so here's my error log:

2022-09-08-17:34:35:WARNING:telethon.client.users - Telegram is having internal issues HistoryGetFailedError: Fetching of history failed (caused by GetChannelDifferenceRequest)
2022-09-08-17:34:37:WARNING:telethon.client.users - Telegram is having internal issues PersistentTimestampOutdatedError: Persistent timestamp outdated (caused by GetChannelDifferenceRequest)
2022-09-08-17:34:40:WARNING:telethon.client.users - Telegram is having internal issues HistoryGetFailedError: Fetching of history failed (caused by GetChannelDifferenceRequest)
2022-09-08-17:34:42:ERROR:telethon.client.updates - Fatal error handling updates (this is a bug in Telethon, please report it)
Traceback (most recent call last):
  File "/opt/venv/lib/python3.10/site-packages/telethon/client/updates.py", line 281, in _update_loop
    diff = await self(get_diff)
  File "/opt/venv/lib/python3.10/site-packages/telethon/client/users.py", line 30, in __call__
    return await self._call(self._sender, request, ordered=ordered)
  File "/opt/venv/lib/python3.10/site-packages/telethon/client/users.py", line 129, in _call
    raise last_error
  File "/opt/venv/lib/python3.10/site-packages/telethon/client/users.py", line 84, in _call
    result = await future
telethon.errors.rpcerrorlist.HistoryGetFailedError: Fetching of history failed (caused by GetChannelDifferenceRequest)

Every time this occurred, my bot no longer received incoming updates.

I suggest (no matter whether these bugs are fixed or not) that there should be an option to immediately raise or exit when a fatal error occurs during handling updates to avoid resulting in an unresponsive bot (especially when some external services will restart the bot on failure).

@Lonami
Copy link
Member

Lonami commented Sep 20, 2022

HistoryGetFailedError, Telegram doesn't cease to surprise me. I guess that code should use a catch-all error 500 rather than specific ones.

Also I've just been cleaning up branches. master is now v2. v1.24 is now v1, and is the default branch, in case some people here are still trying things around. Most older branches have been deleted in favour of just keeping tags to preserve the commits. The command to try now would be:

pip install -U https://github.com/LonamiWebs/Telethon/archive/v1.zip

I suggest (no matter whether these bugs are fixed or not) that there should be an option to immediately raise or exit when a fatal error occurs during handling updates to avoid resulting in an unresponsive bot

Yeah the client should probably raise that back up to the user so they can deal with it in any way they see fit. I can do that before the next version.

@Lonami Lonami reopened this Sep 20, 2022
@Rongronggg9
Copy link
Contributor

Thanks for your suggestion to try the latest snapshot. Unfortunately, I can't do that in production and I've never seen this bug in my local test. I would try adopting the latest snapshot in another less important bot. Waiting for the next release!

@Lonami
Copy link
Member

Lonami commented Sep 20, 2022

Sorry to break it to you but my releases never have really been extensively tested, I simply make them when I feel the code is in a decent spot. I primarily test the changes as I make them. So really current v1 branch is as good as a new release. But I understand your concern.

Rongronggg9 added a commit to Rongronggg9/RSS-to-Telegram-Bot that referenced this issue Sep 20, 2022
@Rongronggg9
Copy link
Contributor

Uhh, the reason why I can't adopt a snapshot in production is just that I can't adopt a snapshot in the production docker image tag my production bot using because there are a lot of downstream image users too, but, meanwhile, I don't want to create another tag, lol.

Mixed with Rongronggg9/RSS-to-Telegram-Bot@5e503f5, I will enter my production container to upgrade telethon for test.

Lonami added a commit that referenced this issue Sep 21, 2022
@Lonami Lonami closed this as completed in c975b56 Sep 21, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants