ClickHouse / ClickHouse/clickhouse-go

Intermittent EOF Errors

Open
#1,464 13 comments 5 reactions 0 assignees View on GitHub
bug cloud
Dominant language
Go
Stars
3.3k
Forks
680
Avg merge
2d 3h
Merged PRs (30d)
14

Description

## Observed

Getting this error periodically via the golang clickhouse driver when connecting to the clickhouse cloud service.

```
read:
github.com/ClickHouse/ch-go/proto.(*Reader).ReadFull
/go/pkg/mod/github.com/!click!house/ch-go@v0.61.5/proto/reader.go:62
- EOF
```

Here is our config (with connection details omitted):
```
// nolint:exhaustruct
conn, err := clickhouse.Open(&clickhouse.Options{
TLS: ...,
Protocol: clickhouse.Native,
Addr: ....,
Auth: clickhouse.Auth{
Username: ...,
Password: ...,
Database: ...,
},
ClientInfo: clickhouse.ClientInfo{
Products: []struct {
Name string
Version string
}{
{Name: "....", Version: "0.1"},
},
},
Compression: &clickhouse.Compression{
Method: clickhouse.CompressionLZ4,
},
BlockBufferSize: 10,
MaxOpenConns: 70,
MaxIdleConns: 50,
})
```

After this error occurs, other queries (both reads and write) also fail, all outputting the same EOF error

Because this is intermittent, it's a little hard to reproduce.

I wonder if there's a race condition in the connection lifetime cleanup routine?

## Details

### Environment
* [ ] `clickhouse-go` version: v2.30.0
* [ ] Interface: `database/sql` compatible driver
* [ ] Go version: 1.22.10
* [ ] Operating system: amazon-linux-2023
* [ ] ClickHouse version: 24.8
* [ ] Is it a ClickHouse Cloud? yes
* [ ] ClickHouse Server non-default settings, if any: everything is default

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the intermittent EOF failure using the shown ClickHouse Cloud configuration, then inspect the connection lifetime cleanup path and the proto.Reader.ReadFull stack location. Done means the cause of the EOF failure is established and addressed so subsequent read and write queries do not continue failing.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.