Influxdb: Got a 204 response when writing data using HTTP/1.0, but no data is written

Created on 22 Feb 2017  路  14Comments  路  Source: influxdata/influxdb

Bug report

__System info:__ InfluxDB version: 1.1; OS: Raspbian Lite on RPi 3

__Steps to reproduce:__

  1. Send HTTP/1.0 POST-request with line protocol in request body to the /write endpoint

__Expected behavior:__ Get HTTP Status 204 response and have the new data written, or get a 4xx response when no data is written for whatever reason

__Actual behavior:__ I got the HTTP status 204 response, but no data is written. If the measurement does not exists before the request, it is not created as expected

__Additional info:__ The client is self-written C++ program, using the Poco libraries. Sending the same line protocol with curl succeeded and sending the same request with my own program, but using HTTP/1.1 instead of HTTP/1.0, succeeded either.

1.x areHTTP areclient wontfix

Most helpful comment

Had a similar issue until I realized I am sending UNIX timestamps in seconds while explicitly specifying precision as milliseconds in the url.
I am using a python client to send data and I had :

line = "measurement1,tag1=wtevevr field1=10 1499978956"
r=requests.post(url="https://server:8086/write?db=eProbeDB&u=myuser&p=mypass&rp=one_week&precision=ms", data=line, verify = False)

Multiplied 1499978956 by 1000 to convert to millis and data started showing in influxdb.
Client is on a Debian 8 machine though, so it's possible that the issue is caused by something else in your case.

All 14 comments

Also seen on Ubuntu 16.04, InfluxDb 0.13.
Can be easily reproduced by creating a DB, adding some measurements, then removing all of them.
Then, although the insert queries through the HTTP API return 204, no data is persisted (SELECT * returns an empty set).

I see this same behaviour using CURL

I'm facing the same issue. Any known fix? I'm able to see the call in the logs but no data in the database.

Had a similar issue until I realized I am sending UNIX timestamps in seconds while explicitly specifying precision as milliseconds in the url.
I am using a python client to send data and I had :

line = "measurement1,tag1=wtevevr field1=10 1499978956"
r=requests.post(url="https://server:8086/write?db=eProbeDB&u=myuser&p=mypass&rp=one_week&precision=ms", data=line, verify = False)

Multiplied 1499978956 by 1000 to convert to millis and data started showing in influxdb.
Client is on a Debian 8 machine though, so it's possible that the issue is caused by something else in your case.

@makareth I am also facing same issue with influx db 1.4 .Have you find any solution /fix for this ?

I am also facing the same issue, only when I pass retention policy (rp) parameter. Otherwise I see that data is persisted. @jwlighting @makareth Did you find any resolution?

I got my issue fixed following @randomeleven suggestion. Added a precision query param to the request.

Hi @yagnasrinath and @randomeleven ,
I am also facing the same issue, but i am using CURL to push the data to influxdb. Below is my command:

measurement="download_speed,component=java_jdk,landscape=aws duration=10,status=100"
echo "$measurement" >/tmp/curl.input
curl -k -m 30 -i -XPOST $url/write?db=<database_name> -u ${username}:${password} --data-binary @/tmp/curl.input
Getting the below output:
HTTP/1.1 204 No Content
Server: nginx/1.13.8
Date: Mon, 19 Mar 2018 08:39:28 GMT
Content-Type: application/json
Connection: keep-alive
Request-Id: 057a880f-2b51-22e8-9r45-000000000000
X-Influxdb-Build: OSS
X-Influxdb-Version: 1.4.2
X-Request-Id: 057a880f-2b51-22e8-9r45-000000000000
Cache-Control: no-cache, must-revalidate
Pragma: no-cache
Expires: Sat, 26 Jul 1997 05:00:00 GMT

But no data at inluxdb.
Could you guys pls help here..!

Regards,
Rohith

@rohithmn3 change the command to

curl -k -m 30 -i -XPOST $url/write?precision=ms&db=<database_name> -u ${username}:${password} --data-binary @/tmp/curl.input

Yup...! 馃憤

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

This issue has been automatically closed because it has not had recent activity. Please reopen if this issue is still important to you. Thank you for your contributions.

I have experienced the same behavior. I am using InfluxDB on RPi3 and logging temperatures to it from my Arduino. I spent a lot of hours debugging my http connection reliability and experimenting with InfluxDb API. I learned that when the http POST request (/write) arrives to the InfluxDb, the response 204 is generated immediately as soon as the headers arrive, its not waiting for the body with the measurements. When the Content-Length header is missing in the POST request the InfluxDB is not flushing the data to the database. I am guessing its still buffering the data somewhere and waiting for some signal which I didn't figure out.
When I added Content-Length header to my requests everything seems to be working fine.

@lehecka Hmm, not using InfluxxDb anymore because waiting 3 years for an answer is not possible for production deployments. Bu thank you for your insight !

Was this page helpful?
0 / 5 - 0 ratings

Related issues

airyland picture airyland  路  3Comments

deepujain picture deepujain  路  3Comments

affo picture affo  路  3Comments

Witee picture Witee  路  3Comments

dandv picture dandv  路  3Comments