-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Reusing too old connection (ECONNRESET) #868
Comments
Some more information I learned from the package dump: But: Whenever the connection reset happens, all three connections have stopped transmitting data for something like 10 minutes or longer, sometimes hours. So I guess something somewhere went wrong and the polling stopped. Then, after a while, the Telegram server closes the connection, because they idled for too long. So I think I have to revert my analysis of the problem: It's not that sending reuses and old long-forgotten connection, but that a polling fault is not detected and the bot stays offline without anyone noticing. But it may be that the problem is in the Node-Red Bot part, which may ignore polling fault messages and fails to trigger a reconnection. |
Erm, sorry about the noise, I just found the documentation about reacting to polling errors. |
OK, here we go again: We are by now quite sure that telegram-bot-api somehow misses the lost connection and never sends out the |
any news about this? |
Haven't been able to debug this any further, but it is still happening with node-red-contrib-telegrambot 9.4.3, which uses node-telegram-bot-api 0.52.0. |
What's the workaround for this? Is there a way to reestablish connection? I tried creating a new instance of bot every time I need it, but for some reason I still get this error after around 2 hours of it running. |
I still see the problem every now and then:
But it doesn't seem to cause any problems anymore, at least I do not see any failed messages send. Mostly the problem went away when I switched my podman containers to host-network. I had to do that for other reasons and I do not like it, but I did not find the time to fix it. If you want to, you can try an automatic resending:
|
I'm getting the same above error. In our country telegram is ban and I also attach vpn but still getting this error how to resolve? If any can solve please lemme know.... const token = "Enter_Your_Token"; bot.on("message", (msg) => { if (messageText === "/start") { |
The issue actually occurred in https://github.com/windkh/node-red-contrib-telegrambot and has been reported in windkh/node-red-contrib-telegrambot#172 but connection management is not actually done there, so I think the underlying problem is somewhere in here.
A while ago I noticed that messages were randomly not send out to Telegram, the error message is ECONNRESET.
I traced the problem with tcpdump and found the following sequence of events:
So I guess the problem is that telegram-bot-api tries to reuse a connection that may be hours old and which has been forgotten by the server for ages.
Either this needs to be changed to always (or at least if the old connection is too old) making a new connection or alternatively, sending must be retried at least one time after ECONNRESET.
Implementing keep-alive packages (if supported by Telegram) might also be a solution.
The text was updated successfully, but these errors were encountered: