influxdb-client-go
influxdb-client-go copied to clipboard
WriteAPIBlocking and QueryAPI got EOF for sometime
Specifications
- Client Version: v2.9.0
- InfluxDB Version: 1.8.9
- Platform: CentOS 7.9
Steps to reproduce
This problem occurs occasionally. In my scenario, Points are generated periodically and written to InfluxDB.
writeAPI := l.data.InfluxdbClient.WriteAPIBlocking("", constant.InfluxdbBucket)
err := writeAPI.WritePoint(context.TODO(), toLoadPoint(entityId, loadType, resourceLoad, ts))
Meanwhile, another goroutine periodically reads data from InfluxDB.
queryAPI := l.data.InfluxdbClient.QueryAPI("")
cmd := toListLoadsQueryCmd(entityId, start, end, groupByCfg, loadTypes)
result, err := queryAPI.Query(context.TODO(), cmd)
Expected behavior
No error returned.
Actual behavior
Write points to InfluxDB sometimes got this error:
Post "https://{INFLUXDB_DOMAIN}/api/v2/write?bucket=chief%2Fautogen&org=&precision=ns": EOF
Read data from InfluxDB sometimes got this error:
Post "https://{INFLUXDB_DOMAIN}/api/v2/query?org=": EOF
Additional info
I noticed that the default value of Close for the generated http.request (in doHTTPRequestWithURL function) is false, just set it to true may be able to solve this problem.
If there are other scenarios to consider, whether the requestCallBack function used in DoPostRequest is released to the user in NewClient.