ydb-platform / ydb-go-sdk

Pure Go native and database/sql driver for YDB
https://ydb.tech
Apache License 2.0
141 stars 76 forks source link

bug: leak goroutines while network problems #1044

Closed rekby closed 7 months ago

rekby commented 9 months ago

Bug Report

YDB GO SDK version: 3.55.0

A lot of goroutines with stacktrace:

goroutine 22945997 [select, 4 minutes]:
google.golang.org/grpc/internal/grpcsync.(*CallbackSerializer).run(0xc00202c5e0, {0x179f0f8, 0xc002e9f950})
    .../vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go:83 +0x112
created by google.golang.org/grpc/internal/grpcsync.NewCallbackSerializer in goroutine 22945995
    .../vendor/google.golang.org/grpc/internal/grpcsync/callback_serializer.go:55 +0x129

Reproduce:

  1. Connect to ydb topic (for read)
  2. Close network by iptables
    iptables -A OUTPUT -p tcp --dport 2135 -j DROP
    ip6tables -A OUTPUT -p tcp --dport 2135 -j DROP
  3. Wait few minutes

It can happens if sdk doesn't close old grpc.Conn

rekby commented 7 months ago

Need close idle https://github.com/ydb-platform/ydb-go-sdk/issues/1044

rekby commented 7 months ago

It is not leak, but keep alive a lot of idle connections. https://github.com/ydb-platform/ydb-go-sdk/issues/1146