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

Facing "use of closed network connection." #166

Open
shubham19may opened this issue Dec 7, 2022 · 5 comments
Open

Facing "use of closed network connection." #166

shubham19may opened this issue Dec 7, 2022 · 5 comments

Comments

@shubham19may
Copy link

shubham19may commented Dec 7, 2022

Hello Go-Clickhouse team,

Facing following error :

database: xx
table: xxxxxxx
statement: INSERT INTO ....
objects count: 10000
values of 1st object: {...}
}, cause: doRequest: transport failed to send a request to ClickHouse: write tcp [instance-ip]-> [ck-load-balancer-ip]: use of closed network connection. Process will be killed

I have Clickhouse hosted in EKS (kubernetes) and i am inserting data from other kubernetes pod.
Clickhouse is exposed to other pods by load balancer.

Few more information points :

  1. I am inserting 10000 rows in one go, average row size is quite big (200 columns).
  2. Its taking 3-4 seconds averagely to do one insert. (This includes flattening of record 2 sec, actual insert 1.5-2 sec)
  3. Everything is running on AWS EKS
  4. Using go-clickhouse version v1.8.0
  5. Error happens randomly. No specific pattern noticed, sometimes it happens after 2 mins, sometime after 30 mins.
  6. My program works by inserting data in batches of 10000. inserting millions of rows in few hours
@phil-schreiber
Copy link
Contributor

@shubham19may Hey, I'm facing similar issue and was wondering whether you ever resolved this thing?

@shubham19may
Copy link
Author

Hey @phil-schreiber we sorted this issue out by moving to https://github.com/ClickHouse/clickhouse-go as this is more stable.

@DoubleDi
Copy link
Collaborator

DoubleDi commented Feb 3, 2023

Hi! Are you yousing any balancers in the middle?

@phil-schreiber
Copy link
Contributor

@DoubleDi Hey! No, in this particular case we're not using any LBs. We are comitting to clickhouse in parallel with one opened sqlx.DB. I avoid commits at exact same time, which lead to EOF errors, but still we're seeing these closed connection errors randomly.

@phil-schreiber
Copy link
Contributor

I was wondering whether hard-coding the max idle conns to 1 (https://github.com/mailru/go-clickhouse/blob/master/conn.go#L80) could be the culprit in my specific usecase. Generally an sql.DB is supposed to be used by goroutines in parallel.

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

No branches or pull requests

3 participants