# DNS timing issue

**URL:** <https://discourse.nodered.org/t/dns-timing-issue/59524>\
**Category:** Core Development\
**Created:** [8 March 2022 09:06 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524 "2022-03-08T09:06:49Z")\
**Posts on this page:** 16\
**Page:** 1

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 09:06 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/1 "2022-03-08T09:06:49Z")

</div>

On my linux system I have 3 different DNS server entries. For testing purposes the first two are invalid/non-existent servers while the 3rd one is the only valid/working server.

I am using the simple HTTP GET request flow from here [Simple GET request : Node-RED](https://cookbook.nodered.org/http/simple-get-request) (in a loop) but I repeatedly get this error

> node[31888]: 8 Mar 09:02:11 - [error] [http request:c3efe083.51344] no response from server

If I change the order of the DNS servers (making the valid server as first option) then the problem goes away and HTTP node works as intended.

I understand name resolution will take a few seconds in this scenario, but I have other apps able to handle this change without disruption with only node-red timing out.

edit: I am using node-red v2.2.2

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 March 2022 09:20 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/2 "2022-03-08T09:20:35Z")

</div>

> [@ssss](#):
>
> I understand name resolution will take a few seconds in this scenario

Can you put a number on this?

You could try setting the requestTimeout property in the `msg` that triggers the request to 30s or more...

```auto
msg.requestTimeout = 30000

```

_(the default is 12000ms / 12s)_

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 March 2022 09:24 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/3 "2022-03-08T09:24:01Z")

</div>

> [@ssss](#):
>
> I am using the simple HTTP GET request flow from here [Simple GET request : Node-RED](https://cookbook.nodered.org/http/simple-get-request) (in a loop) but I repeatedly get this error

When you say "repeatedly" - is this some of the time or all of the time?

When you say "in a loop" - how many requests are you making? Could you benefit from slowing these down by placing a delay node set to rate limin mode (e.g. 1 req per 5 secs) ?

Lastly, could you share your flow?

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 10:18 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/4 "2022-03-08T10:18:21Z")

</div>

Hi Steve,

I have copied my flow below.  
I just have a 1 sec repeat interval set in the "inject node". If I increase the interval to 5 secs then all requests finish successfully.  
If I remove the "repeat" and always make request manually, then also the request is successful.

seems like error is happening only in "1 sec" case.

```auto
[{"id":"a8408096.a246a","type":"tab","label":"Flow 2","disabled":false,"info":""},{"id":"75f4895f.974b98","type":"inject","z":"a8408096.a246a","name":"make request","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"1","crontab":"","once":false,"onceDelay":"1","topic":"","payload":"","payloadType":"date","x":460,"y":300,"wires":[["c3efe083.51344"]]},{"id":"c3efe083.51344","type":"http request","z":"a8408096.a246a","name":"","method":"GET","ret":"txt","paytoqs":"ignore","url":"https://nodered.org","tls":"","persist":false,"proxy":"","authType":"","x":614.5,"y":300,"wires":[["483f18d5.f41c08"]]},{"id":"e14ec4ae.ca9dc8","type":"debug","z":"a8408096.a246a","name":"","active":true,"console":"false","complete":"false","x":970,"y":300,"wires":[]},{"id":"483f18d5.f41c08","type":"html","z":"a8408096.a246a","name":"","property":"","tag":".node-red-latest-version","ret":"text","as":"single","x":791.5,"y":300,"wires":[["e14ec4ae.ca9dc8"]]}]

```

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 March 2022 10:23 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/5 "2022-03-08T10:23:51Z")

</div>

Hi,

Firstly, please do not poll `https://nodered.org` every one second. Node-red project updates are no where near that frequency. Also, many sites will have spam protection and will end up looking like timeouts to node-red.

Secondly, if you have bad DNS (like you stated) then polling every 1 sec, you will simply create a problem where many thousands of queued up `msg`s (that are not getting serviced due to the delays caused by DNS issue) end up crashing your instance.

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 12:15 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/6 "2022-03-08T12:15:13Z")

</div>

I used nodered flow only as example.

I also used http request with google url with a polling of 10 secs and I get random success/fail behavior.  
In case of failure

```auto
"Error: ETIMEDOUT : https://google.com"]

```

and

```auto
node[11388]: 8 Mar 11:41:04 - [error] [http request:c8378401.cb4198] no response from server

```

same setup works when using curl cmdline .

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [8 March 2022 12:42 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/7 "2022-03-08T12:42:20Z")

</div>

> [@ssss](#):
>
> same setup works when using curl cmdline .

Did you run this CURL on the server with DNS issue (where node-red runs)?

Did you run it with same frequency? e.g. `watch -n 10 curl www.google.com`

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 13:29 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/9 "2022-03-08T13:29:58Z")

</div>

> [@Steve-Mcl](#):
>
> Did you run this CURL on the server with DNS issue (where node-red runs)?
> 
> Did you run it with same frequency? e.g. `watch -n 10 curl www.google.com`

Yes and Yes

---

<div class="post-metadata">

**Author:** ![TotallyInformation](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/totallyinformation/32/31_2.png) [@TotallyInformation](https://discourse.nodered.org/u/TotallyInformation)\
**Post date:** [8 March 2022 16:01 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/10 "2022-03-08T16:01:16Z")

</div>

> [@ssss](#):
>
> polling of 10 secs

As has already been said, if you poll any endpoint with this kind of frequency - unless it is set up specifically to cater for that number of updates - you will be treated as an attacker and temporarily or permanently banned.

If you want to do that kind of testing, set up your own endpoint and don't abuse other people's.

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 19:40 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/11 "2022-03-08T19:40:46Z")

</div>

Like I said before, this was just a simple test for the purpose of this post. I have my own setup running into this issue.  
You can get the same behavior using the node-red-node-ping

```auto
[{"id":"5c866b9d.1efa44","type":"ping","z":"17770dd6.c66fb2","protocol":"Automatic","mode":"timed","name":"","host":"google.com","timer":"10","inputs":0,"x":690,"y":280,"wires":[["6e95d31c.5ecdac"]]}]

```

and no you dont get treated as attacker or banned for "pinging" a google server.

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 March 2022 20:45 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/12 "2022-03-08T20:45:05Z")

</div>

> [@ssss](#):
>
> You can get the same behavior using the node-red-node-ping

What exactly do you see when you deploy the ping flow?

Also what version of nodejs are you using?  
`node -v`

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [8 March 2022 21:31 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/13 "2022-03-08T21:31:14Z")

</div>

Node version  
V10.15.3

Output of ping node is

[google.com](http://google.com) : msg.payload: boolean  
false

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [8 March 2022 21:41 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/14 "2022-03-08T21:41:03Z")

</div>

Node red 2.2.2 requires at least nodejs 12

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [11 March 2022 20:19 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/15 "2022-03-11T20:19:35Z")

</div>

@ssss have you confirmed whether the nodejs version was the problem?

---

<div class="post-metadata">

**Author:** ![ssss](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ssss/32/58033_2.png) [@ssss](https://discourse.nodered.org/u/ssss)\
**Post date:** [11 March 2022 20:53 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/16 "2022-03-11T20:53:29Z")

</div>

@Colin i didnt have time but i will test next week and report back

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [10 May 2022 20:53 UTC](https://discourse.nodered.org/t/dns-timing-issue/59524/17 "2022-05-10T20:53:42Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
