Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TCP connection closed after write (regression/change from 0.9.6) #5880

Closed
jdtv0 opened this issue Mar 2, 2016 · 1 comment · Fixed by #5887
Closed

TCP connection closed after write (regression/change from 0.9.6) #5880

jdtv0 opened this issue Mar 2, 2016 · 1 comment · Fixed by #5887

Comments

@jdtv0
Copy link

jdtv0 commented Mar 2, 2016

In 0.9.6.1, we were able to POST data to the /write endpoint over http 1.1 and influxdb would keep the connection open, as one would expect in http 1.1.

However, in 0.10.1, with the same POST, influxdb returns a "Connection: closed" header and then closes the connection. Why did this change? Is it intended? Is there another way to periodically send data (say one batch every second) without restarting the connection?

Here is the curl output with the sample command from the InfluxDB Documentation on version 0.9.6.1 (notice the connection stays open):

curl -vvv -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000' 
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8086 (#0)
> POST /write?db=mydb HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8086
> Accept: */*
> Content-Length: 74
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 74 out of 74 bytes
< HTTP/1.1 204 No Content
HTTP/1.1 204 No Content
< Request-Id: 7bec7945-e008-11e5-8005-000000000000
Request-Id: 7bec7945-e008-11e5-8005-000000000000
< X-Influxdb-Version: 0.9.6.1
X-Influxdb-Version: 0.9.6.1
< Date: Tue, 01 Mar 2016 23:51:14 GMT
Date: Tue, 01 Mar 2016 23:51:14 GMT

< 
* Connection #0 to host localhost left intact

Here is the result of the identical command on 0.10.1 - notice the connection is not left intact and the "Connection: close" header is sent:

curl -vvv -i -XPOST 'http://localhost:8086/write?db=mydb' --data-binary 'cpu_load_short,host=server01,region=us-west value=0.64 1434055562000000000'
* Hostname was NOT found in DNS cache
*   Trying 127.0.0.1...
* Connected to localhost (127.0.0.1) port 8086 (#0)
> POST /write?db=mydb HTTP/1.1
> User-Agent: curl/7.35.0
> Host: localhost:8086
> Accept: */*
> Content-Length: 74
> Content-Type: application/x-www-form-urlencoded
> 
* upload completely sent off: 74 out of 74 bytes
< HTTP/1.1 204 No Content
HTTP/1.1 204 No Content
< Request-Id: 3d72a1e6-e009-11e5-801e-000000000000
Request-Id: 3d72a1e6-e009-11e5-801e-000000000000
< X-Influxdb-Version: 0.10.1
X-Influxdb-Version: 0.10.1
< Date: Tue, 01 Mar 2016 23:56:39 GMT
Date: Tue, 01 Mar 2016 23:56:39 GMT
< Connection: close
Connection: close

< 
* Closing connection 0

Thanks,
Jonathan

@jackpoz
Copy link

jackpoz commented Mar 2, 2016

I experienced the same issue yesterday, going from InfluxDB 0.9.4 to 0.10.1 . I opened an issue at influxdata/docs.influxdata.com-ARCHIVE#284 to at least know what the expected behavior should be and if it's a bug or a "feature" and which steps, if any, we can take to set the connection to the standard HTTP/1.1 Keep-Alive behavior.

joelegasse added a commit that referenced this issue Mar 2, 2016
joelegasse added a commit that referenced this issue Mar 2, 2016
Go 1.4.3 was a security release that also created a strange edge-case
that caused connections to not be kept alive and reused when Close()
is called on the Body of the request. Close() hasn't been required on
the Body of a request for some time, so there is no harm is not calling
it anymore.

Fixes #5880
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants