InfluxDB stops writing

I am writing data to influxdb using the node-influx library.

I am using influx.writePoints to do the writes as explained here,

https://node-influx.github.io/manual/tutorial.html

The only tweak I made is insert in batches. The batchsize is set to 10000.

It writes about 500,000 records and then I start seeing this error following which there are no more writes. It looks like a dns issue but I am running it inside a docker container on ubuntu 18.04 host.

Error: getaddrinfo EAGAIN influxdb influxdb:8086 |at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:56:26)

I have the logging level set to debug but I am not seeing any other errors.

I am able to write using curl even after the error

Update
I am using a worker container to do the writes and the error is happening on it. If I restart this container after I get the error, the writes start happening again for another 500,000 points and then I get the same error.
It could be a connection issue from the worker to influx

Here is the output of

curl http://localhost:8086/debug/vars | jq

 },
  "httpd::8086": {
    "name": "httpd",
    "tags": {
      "bind": ":8086"
    },
    "values": {
      "authFail": 0,
      "clientError": 0,
      "fluxQueryReq": 0,
      "fluxQueryReqDurationNs": 0,
      "pingReq": 0,
      "pointsWrittenDropped": 0,
      "pointsWrittenFail": 0,
      "pointsWrittenOK": 500000,
      "promReadReq": 0,
      "promWriteReq": 0,
      "queryReq": 0,
      "queryReqDurationNs": 0,
      "queryRespBytes": 0,
      "recoveredPanics": 0,
      "req": 52,
      "reqActive": 1,
      "reqDurationNs": 2543066084,
      "serverError": 0,
      "statusReq": 0,
      "writeReq": 50,
      "writeReqActive": 0,
      "writeReqBytes": 61858063,
      "writeReqDurationNs": 2535763137
    }
  }
}
 

As you can see I am not seeing any failures here. It looks like I am running into some limit here, I have already upped the ulimit on the host.

This is my influxdb.conf

reporting-disabled = true 

[meta]
  dir = "/var/lib/influxdb/meta"
  retention-autocreate = false 
  logging-enabled = true

[logging]
  format = "auto"
  level = "debug"

[data]
  engine = "tsm1"
  dir = "/var/lib/influxdb/data"
  wal-dir = "/var/lib/influxdb/wal"
  wal-fsync-delay = "0ms"
  index-version = "inmem"
  wal-logging-enabled = true
  query-log-enabled = true
  cache-max-memory-size = "1g" 
  cache-snapshot-memory-size = "25m" 
  cache-snapshot-write-cold-duration = "10m"
  compact-full-write-cold-duration = "4h"
  max-concurrent-compactions = 0
  compact-throughput = "48m"
  max-points-per-block = 0
  max-series-per-database = 1000000
  trace-logging-enabled = false

[coordinator]
  write-timeout = "30s"
  max-concurrent-queries = 0
  query-timeout = "0s"
  log-queries-after = "0s"
  max-select-point = 0
  max-select-series = 0
  max-select-buckets = 0

[retention]
  enabled = true
  check-interval = "30m0s"

[shard-precreation]
  enabled = true
  check-interval = "10m0s"
  advance-period = "30m0s"

[monitor]
  store-enabled = true
  store-database = "_internal"
  store-interval = "10s"

[http]
  enabled = true
  bind-address = ":8086"
  auth-enabled = false
  log-enabled = true
  max-concurrent-write-limit = 0
  max-enqueued-write-limit = 0
  enqueued-write-timeout = 0

[continuous_queries]
  enabled = false 
  log-enabled = true
  run-interval = "10s"