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

not recovering from polling error - (even after longer time period) #97

Closed
ozett opened this issue Jan 23, 2020 · 83 comments
Closed

not recovering from polling error - (even after longer time period) #97

ozett opened this issue Jan 23, 2020 · 83 comments

Comments

@ozett
Copy link

ozett commented Jan 23, 2020

hi,
my internet was gone, the tlgr-bot showed an polling error. that normal.
my internet was recovered after 15 minute, the bot never recovered. the sending nodes stayed showing this polling error and never sended again until i restarted the whole node-red.

does the bot not recover from polling errors after a longer time period?
do i have to work-around this or do you think a config option is missing?

thx

@xraken
Copy link

xraken commented Feb 4, 2020

Ran into the same problem except for some reason the polling errors out almost every day and does not re-start until manual intervention.

@Bobo-amg
Copy link

Bobo-amg commented Feb 12, 2020

Same here. Mine are quite infrequent. Running on a RPi 3.

I just did some testing by dropping the WAN interface, watched the polling error msg come up as expected. I then upped the WAN and (not what I would expect if this was the cause) the Telegram node re-established connection, as it should.

So I am skeptical that this is solely a network issue. What other things can cause a polling error?

Please advise, as this is extremely frustrating and means that Telegram cannot be relied on.

@windkh
Copy link
Owner

windkh commented Feb 12, 2020

I will try to reproduce that... I had never expirienced that problem by myself. Maybe the node can discover that somehow ...
was anything logged into the console of the running node-red process?

@sdavidst
Copy link

I have the same symptoms on my Raspberry Pi 3b. The receiving nodes stop working until a node-red restart. Sending nodes as far as I remember recover after internet connection recovered..

@Bobo-amg
Copy link

was anything logged into the console of the running node-red process?

Nothing ever logged for me.

@ozett
Copy link
Author

ozett commented Feb 13, 2020

i have this running on my telegram-flow
image
but never noticed any logging for the connection-error, sorry

@windkh
Copy link
Owner

windkh commented Feb 13, 2020

I mean was somerhing written to the console not into the debug log?

@xraken
Copy link

xraken commented Feb 14, 2020

I can check for console log and report back.

@Swiftnesses
Copy link

I see this too, worked around it via restarting node red via a dedicated flow...

@ozett
Copy link
Author

ozett commented Feb 20, 2020

I see this too, worked around it via restarting node red via a dedicated flow...

could you kindly share your flow?

but overall seems a complete node-red restart a "second best" solution.
better the node could heal himself...

@Bobo-amg
Copy link

better the node could heal himself...

Well, that is the crux of the issue. It's not whether it disconnects, but why it doesn't re-connect.

@nlef
Copy link

nlef commented Mar 8, 2020

I have the same problem using free soks5 proxy. Maybe bot is stoped, when proxy refuses connection? Bot code sets 'stopPooling' to true on this. But there should be retry...

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

I have the same problem using free soks5 proxy. Maybe bot is stoped, when proxy refuses connection? Bot code sets 'stopPooling' to true on this. But there should be retry...

Ok I will remove stop polling when socks5 is used: see version 7.1.4

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

I deactivated my WIFI while running the bot. It does reconnect on my machine.
So any idea how to reproduce that?

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

Please activate the verbose flag in the options of the bot and tell me what is printed in the debug panel:
verbose

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

On my machine it says:

21 Mar 18:39:13 - [warn] [telegram bot:c3670dce.18aa8] EFATAL: Error: getaddrinfo ENOTFOUND api.telegram.org api.telegram.org:443 util.js:256 21 Mar 18:39:13 - [warn] [telegram bot:c3670dce.18aa8] Network connection may be down. Trying again.

But in this case it recovers from the error...

@nlef
Copy link

nlef commented Mar 21, 2020

@windkh
I just installed 7.1.4.
This problem takes place after several hours of using proxy, that sometimes disconnects.
I activate verbose mode, change Console logging to "debug". And redirected Nodered service logs to file. In the morning i'l look at logs and give you all data from it, if needed!

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

@nlef yes please

@windkh
Copy link
Owner

windkh commented Mar 21, 2020

@ALL please check what nodejs version you have: please send this version to me

@nlef
Copy link

nlef commented Mar 22, 2020

@windkh nodejs version is 12.16.1 (latest lts). And NodeRed is 1.0.4.
And all data from logs from NodeRed. If is restart NodeRed - telegramBot would work perfectly for several hours ( 3-6 for me). So that's my logs:
test.log

@windkh
Copy link
Owner

windkh commented Mar 22, 2020

You started node red and already at that time you get the following. Right?

Mar 20:26:28 - [warn] [telegram bot:6d758a8.37064f4] EFATAL: Error: Client network socket disconnected before secure TLS connection was established

@windkh
Copy link
Owner

windkh commented Mar 22, 2020

And finally that one

04:31:21 - [warn] [telegram bot:6d758a8.37064f4] EFATAL: Error: SOCKS connection failed. TTL expired.

@windkh
Copy link
Owner

windkh commented Mar 22, 2020

I will try to add a reconnect method .... it would be nice if you could test it for me

@nlef
Copy link

nlef commented Mar 22, 2020

You started node red and already at that time you get the following. Right?

Mar 20:26:28 - [warn] [telegram bot:6d758a8.37064f4] EFATAL: Error: Client network socket disconnected before secure TLS connection was established

after some time. From 20-30 seconds to 10 minutes i got this errors.

And finally that one

04:31:21 - [warn] [telegram bot:6d758a8.37064f4] EFATAL: Error: SOCKS connection failed. TTL expired.

Yes. this is a strange error, but it disapeers when i restart Nodered as service! Restarting doesn't hepl me(
If i add to crontab restarting Nodered every 5 hours, bot is working good.

I will try to add a reconnect method .... it would be nice if you could test it for me

I'l help with pleasure)

@windkh
Copy link
Owner

windkh commented Mar 22, 2020

well I tried to find the root of the error "TTL expired" and found it here
https://github.com/mattcg/socks5-client/blob/master/lib/Socket.js line 240 in the function connectSocksToHost. This indicates that a connection is about to be established but aborted with error 6. After all I am more confused than before...

@nlef
Copy link

nlef commented Mar 23, 2020

@windkh i think there should be reconnect in error handler. This error usually occurs using tor or another unstable proxy(
Can you do this on you side or we need to fork and modify socks5-client lib?

@windkh
Copy link
Owner

windkh commented Mar 23, 2020

@nlef well I am not sure if that exactly happens during reconnect... so an additional reconnect won‘t help

@nlef
Copy link

nlef commented Mar 23, 2020

@windkh here is some info from stackexchange

@windkh
Copy link
Owner

windkh commented Mar 23, 2020

I can not open the link

@nlef
Copy link

nlef commented Mar 23, 2020

@windkh I'm sory. I edited comment.
https://tor.stackexchange.com/a/877

@Jinchuu
Copy link

Jinchuu commented Aug 2, 2020

did someone found the solution to this issue? I am stuck in the same problem.

Are you running nodered on a RPi, too?

No, I am using node, but the issue is gone now, I deleted the old bot and made another one and get another token from telegram, now API works. If polling error back I back here. Change token solves the problem for me. thanks.

@windkh
Copy link
Owner

windkh commented Aug 2, 2020

did someone found the solution to this issue? I am stuck in the same problem.

Are you running nodered on a RPi, too?

No, I am using node, but the issue is gone now, I deleted the old bot and made another one and get another token from telegram, now API works. If polling error back I back here. Change token solves the problem for me. thanks.

I can't believe that this is a problem with the token! huh!?

@rvt
Copy link

rvt commented Aug 2, 2020

A redeploy will also fix it. Al I am saying, changing a token will also forse you the redeploy so it’s no proof that changing a token is the fix...

@windkh
Copy link
Owner

windkh commented Aug 2, 2020

Version 8.3.3 resets the polling error status after 80% of poll interval is reached

@windkh
Copy link
Owner

windkh commented Aug 2, 2020

At all RPI users. Please try to change the poll interval to a larger value than 300ms. Maybe the interval ist too short for a small CPU.

@Barabba11
Copy link

Barabba11 commented Aug 2, 2020

Thanks for updating!
Sorry for the stupid question, I've tried to upload it but on paletter there is only 8.2, ok 8.3 is a beta.. but using the command npm i node-red-contrib-telegrambot returns me
C:\Users\Admin.node-red\node_modules>npm i node-red-contrib-telegrambot
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules\node-red-contrib-telegrambot" as it does not contain a package.json file.
I've updated also npm packages, I've tried to download the zip file here and type C:\Users\Admin.node-red\node_modules>npm install C:\Users\Admin\Desktop\Downloads\node-red-contrib-telegrambot-master.zip but same error. I'v enoticed in the zip file there is a folder, I've tried to remove it an place all files to root but same error.
Thanks for help
EDIT: I've manually copied the folder to the node red module's folder and it works

@windkh
Copy link
Owner

windkh commented Aug 3, 2020

I did only release 8.3.3 via npm... some previous versions with sendInvoice alpha were not released via npm

@Barabba11
Copy link

Barabba11 commented Aug 3, 2020

I updated and polling seems always works, even if I switch PC to st-by ) I've noticed that every time I send a message (probably I receive too) the node status have a notification, even if the status was the same before (connected->connected), I was trying to create a function that notificates me by telegram when the node changed status and I didn't filter to catch only disconnect, as result I've got a infinite loop of messages which I luckly blocked without Telegram bans me for flood ))
My suggestion is, is possible to update the status only if it changes from before? Avoiding notifications for every message sent.
Thanks

@Jinchuu
Copy link

Jinchuu commented Aug 4, 2020

A redeploy will also fix it. Al I am saying, changing a token will also forse you the redeploy so it’s no proof that changing a token is the fix...

I agree, but I need solve it faster as I can. now Barabba11 has a clue, and make sense.

@rvt
Copy link

rvt commented Aug 5, 2020

I think the problem is common to everybody, it doesn't reflect the real polling cause the node is able to receive message even if it was "pollig error" from hours, so the real polling works. When I receive a message it switches suddenly to connected, but the sent node still on polling error, if I send a message also that node becomes ok

No,
it really does not work for me. This suggest that the error that's showing might have two different underlaying causes.

With my little test I could easily replicate it. My doorbell would normally send a telegram message, but it does not.
More that happy to further debug it, but node/javascript is not my main language so I would need to have some pointers on how to attach a debugger or get some usefull logging.

@windkh
Copy link
Owner

windkh commented Aug 6, 2020

@rvt on what OS do you run node red?

@inglevir
Copy link

inglevir commented Aug 14, 2020

I also have the similar problem with Node Red on Raspberry Pi 4. This looks like two (probably) unrelated bugs for me.

First - status "not connected" but actually everything works (this happens almost every day).
Second - sometimes, once a week or once a 10 days bot really stops receiving commands until flow restart.

I am not sure, if it is related, but I have on the same Raspberry 2 instances of Node Red and they run 2 different bots. I have read this thread and checked once more, that there are no similar tokens on these two instances.

@windkh
Copy link
Owner

windkh commented Aug 14, 2020

I also have the similar problem with Node Red on Raspberry Pi 4. This looks like two (probably) unrelated bugs for me.

First - status "not connected" but actually everything works (this happens almost every day).
Second - sometimes, once a week or once a 10 days bot really stops receiving commands until flow restart.

I am not sure, if it is related, but I have on the same Raspberry 2 instances of Node Red and they run 2 different bots. I have read this thread and checked once more, that there are no similar tokens on these two instances.

The first status not connected problem should be solved with the last version.
The second remains a mystery until now.

@inglevir
Copy link

inglevir commented Aug 15, 2020

I have upgraded and yes, now "Polling error" is replaced by "polling". Strange thing is, that one bot is "connected", another is "polling". What is the difference?
Node Red Fit  pi - Mozilla Firefox

@windkh
Copy link
Owner

windkh commented Aug 15, 2020

After startup the initial status is connected ... when an error occurs and polling is continued then polling shows up. Are both bots running on the same system?

@rvt
Copy link

rvt commented Aug 15, 2020

@windkh

Linux debian-stretch 4.14.141+ #1 SMP PREEMPT Wed Sep 4 07:14:29 UTC 2019 armv7l GNU/Linux
node: v10.20.1
nodered: 1.0.6

if you need more info, let me know

@inglevir
Copy link

After startup the initial status is connected ... when an error occurs and polling is continued then polling shows up. Are both bots running on the same system?

Both are running on the same Raspberry, but in different processes of Node Red. Thank you for clarification!

@swilson86
Copy link

This polling error and disconnection issue is not unique to Raspberry Pi. I have identical problems running Telegram on node-red on Windows 10. I do know what the problem IS NOT.... I thought I'd install a new bot for every node that needed one (as opposed to using a single bot throughout my node-red). That did not fix the problem. In fact, once you have 20 bots from the BotFather he won't give you any more. Documentation on Telegram is very vague and poorly written.

@rvt
Copy link

rvt commented Oct 22, 2020

Any news on the polling issue?

@windkh
Copy link
Owner

windkh commented Oct 22, 2020

No... could not reproduce it, sorry

@ThierryBegin
Copy link

I'm having the exact same issue using HassOS on a Raspberry Pie 4 and node red on it.

@rvt
Copy link

rvt commented Nov 9, 2020

Would have been nice if we know how to debug this thing :) I can reproduce it in under 5 minutes!

@windkh
Copy link
Owner

windkh commented Nov 9, 2020

@rvt sounds good. What debugger could we use on your system?

@rvt
Copy link

rvt commented Nov 10, 2020

@windkh it's a linux system, I think we could use any we want.Just let me know the commands to run...

@windkh
Copy link
Owner

windkh commented Nov 10, 2020

@windkh
Copy link
Owner

windkh commented May 2, 2021

Maybe issue #172 is a hint into the right direction.

@windkh
Copy link
Owner

windkh commented Jul 31, 2021

Version 10.0.3 should address this problem. Reopen the issue if the problem still exists.

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