influxdata / influxdb-client-go

InfluxDB 2 Go Client
MIT License
609 stars 116 forks source link

WriteAPIBlocking and QueryAPI got EOF for sometime #375

Open yangsijie666 opened 1 year ago

yangsijie666 commented 1 year ago

Specifications

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.