# EMFILE Error with Influxdb

**URL:** <https://discourse.nodered.org/t/emfile-error-with-influxdb/8554>\
**Category:** General\
**Created:** [3 March 2019 14:04 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554 "2019-03-03T14:04:08Z")\
**Posts on this page:** 16\
**Page:** 2

<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:** [4 March 2019 22:12 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/22 "2019-03-04T22:12:58Z")

</div>

I meant can you access the influxdb server using an alternative means. However a port scan of the ip address you previously posted suggests that port 8086 is not open.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [5 March 2019 20:59 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/23 "2019-03-05T20:59:01Z")

</div>

Hi Colin

I just ran a port scan using nmap which seems to show that port 8086 is open...showing the following:

Host is up (0.060s latency).  
Not shown: 996 filtered ports  
PORT STATE SERVICE  
22/tcp open ssh  
3389/tcp closed ms-wbt-server  
8083/tcp closed us-srv  
8086/tcp open d-s-n

I am definitely no expert on this and not sure waht the d-s-n means next to it either.

When you say access the server using an alternative means can you explain a bit further. I can SSH into the machine ok if thats what you mean.

---

<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:** [5 March 2019 21:06 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/24 "2019-03-05T21:06:35Z")

</div>

You are right, the port is open, my mistake, I only ran a limited scan.  
I meant can you access the influx database from the machine running node-red by some means other than node-red? That would tell you whether it is a node-red issue or a connection or influx issue.  
Did I ask you to look at the influxdb log on the server to see if they say anything? If not then that would be a good plan.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [5 March 2019 21:37 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/25 "2019-03-05T21:37:05Z")

</div>

I have tried to write data to the influx database from the command line but it says operation time out so it must have something to do with the connection to the machine.

Not sure how to access the influxdb logs, the documentation seems a bit confusing.

---

<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:** [5 March 2019 21:51 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/26 "2019-03-05T21:51:58Z")

</div>

> [@gavraq](#):
>
> Not sure how to access the influxdb logs, the documentation seems a bit confusing.

Where the log is depends on how it is run. Often it will be in /var/log/influxdb.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [5 March 2019 22:05 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/27 "2019-03-05T22:05:31Z")

</div>

There seems to be a lot of files there:

alternatives.log auth.log.2.gz daemon.log.1 dpkg.log kern.log.1 messages.1 syslog.1 syslog.6.gz  
alternatives.log.1 auth.log.3.gz daemon.log.2.gz dpkg.log.1 kern.log.2.gz messages.2.gz syslog.2.gz syslog.7.gz  
apt btmp daemon.log.3.gz faillog kern.log.3.gz messages.3.gz syslog.3.gz unattended-upgrades  
auth.log btmp.1 debug influxdb lastlog ntpstats syslog.4.gz wtmp  
auth.log.1 daemon.log debug.1 kern.log messages syslog syslog.5.gz wtmp.1

Which one would it be?

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [5 March 2019 22:07 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/28 "2019-03-05T22:07:35Z")

</div>

Thats probably a question for an influxdb forum?

---

<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:** [5 March 2019 22:09 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/29 "2019-03-05T22:09:09Z")

</div>

> [@gavraq](#):
>
> There seems to be a lot of files there:

Oddly enough it's probably the one called influxdb, which is what I said. That is likely a folder.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [5 March 2019 22:09 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/30 "2019-03-05T22:09:46Z")

</div>

correct, it is a folder rather than a file but the folder is empty

---

<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:** [5 March 2019 22:12 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/31 "2019-03-05T22:12:35Z")

</div>

It could just be in /var/log/syslog along with all the other system stuff.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [10 March 2019 11:14 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/32 "2019-03-10T11:14:47Z")

</div>

I have now established that the connection to influxdb is working ok. I managed to insert data into a test database using the http request from my local machine so it looks like the error is on the node red side.

One thing that I suspect is an issue is that I am trying to write a large amount of data (approx 11k lines) and in the influx documentation it states:

**Note:** If your data file has more than 5,000 points, it may be necessary to split that file into several files in order to write your data in batches to InfluxDB. By default, the HTTP request times out after five seconds. InfluxDB will still attempt to write the points after that time out but there will be no confirmation that they were successfully written.

So I think my issue is related to this. Any suggestions on how I might break up my messages into batches smaller than 5k?

---

<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:** [10 March 2019 11:29 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/33 "2019-03-10T11:29:40Z")

</div>

I would first confirm that you can write small amounts of data ok from node-red.

---

<div class="post-metadata">

**Author:** ![gavraq](https://avatars.discourse-cdn.com/v4/letter/g/ccd318/32.png) [@gavraq](https://discourse.nodered.org/u/gavraq)\
**Post date:** [10 March 2019 11:32 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/34 "2019-03-10T11:32:00Z")

</div>

Yes I have done that too, also to the same test databse so I know the node red connection works too (for a single line of data)

---

<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:** [10 March 2019 11:38 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/35 "2019-03-10T11:38:52Z")

</div>

OK, what is the form of the data you want to split up?  
Could you provide a mini-flow that generates some sample data that we can work out how to split?

---

<div class="post-metadata">

**Author:** ![FabriLog](https://avatars.discourse-cdn.com/v4/letter/f/cab0a1/32.png) [@FabriLog](https://discourse.nodered.org/u/FabriLog)\
**Post date:** [14 July 2021 10:17 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/36 "2021-07-14T10:17:40Z")

</div>

Hi,  
I am experiencing the same problem as reported in the topic.

Trying to save over 6000 data to influxDB I get the error:  
` Node-RED[14245]: 14 Jul 09:18:05 - [error] [http request:POST to influxdb] Error: connect EMFILE - Local (undefined:undefined)`

The error occurs exactly after saving exaclty 4081 values.

I have tried to divide the sending of data to influxDB into blocks of 1000 values, however I get exactly the same result.

As shown in the screenshot, the **'convert for influxdb'** node receives the data, splits it into blocks of 1000 and sends it to the **'Post to influxDB'** node, the **'check finish'** function triggers the **'convert for influxdb'** node again until all the data has been processed.

 ![immagine](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/2/c/2cd719f17407b72cc018e5df1876fc6885aca6f0.png)

Has a solution been found for this error?  
What is meant by "splitting" the data, an operation suggested in the topic to solve the error?

Thank you for your support.  
Fabrizio

---

<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:** [14 July 2021 11:11 UTC](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554/37 "2021-07-14T11:11:51Z")

</div>

Welcome to the forum @FabriLog

Googling for the error shows that means that the OS is denying your program requests to open more files/sockets, which suggests that possibly the sockets are not being closed for some reason. Can you export that section of the flow and paste it here. See this post for how to post flows - [How to share code or flow json](https://discourse.nodered.org/t/how-to-share-code-or-flow-json/506)

[Previous page](https://discourse.nodered.org/t/emfile-error-with-influxdb/8554.md?page=1)
