influxdb icon indicating copy to clipboard operation
influxdb copied to clipboard

Influx 1.3 Internal Server Error 500 after 14 hours (running Docker + node-influx client)

Open antonioaguilar opened this issue 9 years ago • 7 comments

Background

I wrote a simple client that uses the node-influx library to subscribe to data events coming from a NATS.io server, approximately between 1000 and 1500 clients generate those data events every 30 seconds.

I'm seeing the Internal Server Error (500) after pushing data to InfluxDB using this client. The issue is that after approx. 14 hours, the client pushing data to InfluxDB gets the internal server error and I can not push data anymore - not even via other mechanisms (e.g. curl). The InfluxDB server is still running and I can still access it and make queries via the CLI tool. I have stopped traffic to it and I have not restarted the server.

Bug report

System info:

  • InfluxDB version: 1.3
  • OS: Ubuntu 16.04.1 LTS, Linux owc-server 4.4.0-45-generic #66-Ubuntu SMP Wed Oct 19 14:12:37 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
  • Docker version: 17.03.1-ce
  • InfluxDb docker image: 1.3, 1.3.0, latest (influxdb/1.3/Dockerfile)
  • Influx node-influx client library version: 5.0.7

Note: This issue is similar to #8533 but I can still access and make queries in InfluxDB via the CLI tools.

Steps to reproduce:

  1. Pull latest influxdb Docker image, run on Ubuntu box and assign 8GB of memory:

docker run -it -d --name="influxdb" -m 8G -p 8086:8086 -v influxdb:/var/lib/influxdb influxdb

  1. Use the following client to push data to InfluxDB. The client fetches real-time data from a NATS.io server via subscriptions. Below is the stack trace of the error:
{ Error: Internal Server Error
    at new ServiceNotAvailableError (/home/owc/repos/aya-logger/node_modules/influx/lib/src/pool.js:37:28)
    at /home/owc/repos/aya-logger/node_modules/influx/lib/src/pool.js:272:49
    at ClientRequest.<anonymous> (/home/owc/repos/aya-logger/node_modules/influx/lib/src/pool.js:79:13)
    at ClientRequest.g (events.js:291:16)
    at emitOne (events.js:96:13)
    at ClientRequest.emit (events.js:188:7)
    at HTTPParser.parserOnIncomingClient (_http_client.js:473:21)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:99:23)
    at Socket.socketOnData (_http_client.js:362:20)
    at emitOne (events.js:96:13) message: 'Internal Server Error' }
  1. Trying to push any other data to Influx via curl also fails:
curl -i -XPOST 'http://localhost:8086/write?db=db' --data-binary 'cpu,host=server01,region=us-west value=0.64'
HTTP/1.1 500 Internal Server Error
Content-Type: application/json
Request-Id: 1abedda6-6546-11e7-8308-000000000000
X-Influxdb-Version: 1.3.0
Date: Mon, 10 Jul 2017 08:02:32 GMT
Content-Length: 20

{"error":"timeout"}

Expected behavior:

InfluxDb should be able to accept all the data pushed to it

Actual behavior:

Based on a quick look at the debug vars output. InfluxDB was able to write 4880048 ok (pointsWrittenOK: 4880048) but failed to write: 1005176 (pointsWrittenFail: 1005176). See snapshot of the debug/vars output (truncated):

"system": {
  "currentTime": "2017-07-10T11:42:24.083661406Z",
  "started": "2017-07-09T17:35:42.747324136Z",
  "uptime": 65201
},

"httpd::8086": {
  "name": "httpd",
  "tags": {
    "bind": ":8086"
  },
  "values": {
    "authFail": 0,
    "clientError": 1,
    "pingReq": 5,
    "pointsWrittenDropped": 0,
    "pointsWrittenFail": 1022553,
    "pointsWrittenOK": 4880048,
    "queryReq": 19,
    "queryReqDurationNs": 6406869243,
    "queryRespBytes": 37226,
    "req": 1475685,
    "reqActive": 1,
    "reqDurationNs": 2609584781263550,
    "serverError": 255639,
    "statusReq": 0,
    "writeReq": 1475651,
    "writeReqActive": 0,
    "writeReqBytes": 844638839,
    "writeReqDurationNs": 2609333769035439
  }
}

Also, below is the output of docker stats for the InfluxDB container:

CONTAINER           CPU %               MEM USAGE / LIMIT   MEM %               NET I/O             BLOCK I/O           PIDS
influxdb            0.10%               3.137 GiB / 8 GiB   39.21%              1.53 GB / 790 MB    301 MB / 12.3 GB    20

Additional info:

antonioaguilar avatar Jul 10 '17 13:07 antonioaguilar

Does the same code/setup work with 1.2.4?

ryantxu avatar Jul 10 '17 16:07 ryantxu

It looks like you are hitting the deadlock fixed via #8577

jwilder avatar Jul 10 '17 16:07 jwilder

@ryantxu I can run a test tonight using the influxdb 1.2.4 container image. I'm currently using the following Docker run command to launch influxdb:

docker run -it -d --name="influxdb" -m 8G -p 8086:8086 -v influxdb:/var/lib/influxdb influxdb

Do you want me to pass any additional flags to facilitate debugging?

antonioaguilar avatar Jul 10 '17 17:07 antonioaguilar

@ryantxu @jwilder I'm glad to announce that I have been running the same test using influxdb version 1.2.4 for about 6 hours without any write fails. It is possible that the issue that I experienced with failed writes could be specific to influxdb version 1.3. I will leave the test running for the night and will report more conclusive data tomorrow.

UPDATE: After 14 hours, no reported write fails. A total of 1769993 writes (2019 writes per minute / 33.5 writes per second) were injected to influxdb version 1.2.4. Docker container memory usage was between 300MB and 500MB. Docker container CPU usage remained under 5% load. Docker container volume storage size 271.6MB.

I'm marking this issue as closed, as it seems to be only specific to influxdb version 1.3 and already investigated (fixed) via #8577.

antonioaguilar avatar Jul 10 '17 21:07 antonioaguilar

I'm marking this issue as closed, as it seems to be only specific to influxdb version 1.3 and already investigated (fixed) via #8577.

antonioaguilar avatar Jul 11 '17 08:07 antonioaguilar

I'm seeing this on 1.2.4. Writing 2 metrics with ~10 different points each every 2 seconds. InfluxDB shell version: 1.2.4

{ Error: Request timed out
    at new ServiceNotAvailableError (/code/at/node_modules/influx/lib/src/pool.js:37:28)
    at /code/at/node_modules/influx/lib/src/pool.js:286:38
    at ClientRequest.<anonymous> (/code/at/node_modules/influx/lib/src/pool.js:79:13)
    at emitNone (events.js:105:13)
    at ClientRequest.emit (events.js:207:7)
    at Socket.emitRequestTimeout (_http_client.js:658:42)
    at Object.onceWrapper (events.js:312:19)
    at emitNone (events.js:110:20)
    at Socket.emit (events.js:207:7)
    at Socket._onTimeout (net.js:401:8)
    at ontimeout (timers.js:488:11)
    at tryOnTimeout (timers.js:323:5)
    at Timer.listOnTimeout (timers.js:283:5) message: 'Request timed out' }

alek-p avatar Jul 20 '17 18:07 alek-p

@alek-p : same issue here

srinivasrk avatar Oct 17 '18 15:10 srinivasrk