influxdata / influxdata/influxdb-client-go

WriteAPIBlocking and QueryAPI got EOF for sometime

Open
#375 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Go
Stars
653
Forks
120
Avg merge
3m
Merged PRs (30d)
3

Description

### 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.

```go
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.

```go
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.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with doHTTPRequestWithURL and inspect how the generated http.request handles Close for the write and query calls. Trace DoPostRequest and the requestCallBack path from NewClient, then reproduce the concurrent WriteAPIBlocking and QueryAPI requests described in the issue. Done means identifying the cause of the intermittent EOF and confirming the fix for both endpoints.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
api, networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.