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

bug: Balancer initializes grpc pool with 2 connections refers to different endpoints #1507

Open
YuriyKortev opened this issue Oct 14, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@YuriyKortev
Copy link

Bug Report

YDB GO SDK version:

v3.84.1

Environment

Ubuntu, x86_64

Current behavior:

Balancers initializes grpc pool with 2 connections refers to different endpoints. First correct and second to localhost.
As a result following error occures:

[error] failed to initialize database, got error transport/Unavailable (code = 14, source error = "rpc error: code = Unavailable desc = last connection error: connection error: desc = \"transport: Error while dialing: dial tcp 127.0.0.1:2136: connect: connection refused\"", address: "localhost:2136", nodeID = 1, traceID: "e3fb36d4-10ae-4b4a-bddb-a7c80d4418b8") at `github.com/ydb-platform/ydb-go-sdk/v3/internal/conn.invoke(conn.go:392)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/balancer.(*Balancer).wrapCall(balancer.go:313)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.newSession(session.go:142)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*Client).CreateSession.func1(client.go:108)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*Client).CreateSession(client.go:116)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql.(*Connector).Connect(connector.go:348)`
transport/Unavailable (code = 14, source error = "rpc error: code = Unavailable desc = last connection error: connection error: desc = \"transport: Error while dialing: dial tcp 127.0.0.1:2136: connect: connection refused\"", address: "localhost:2136", nodeID = 1, traceID: "e3fb36d4-10ae-4b4a-bddb-a7c80d4418b8") at `github.com/ydb-platform/ydb-go-sdk/v3/internal/conn.invoke(conn.go:392)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/balancer.(*Balancer).wrapCall(balancer.go:313)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.newSession(session.go:142)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*Client).CreateSession.func1(client.go:108)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/table.(*Client).CreateSession(client.go:116)` at `github.com/ydb-platform/ydb-go-sdk/v3/internal/xsql.(*Connector).Connect(connector.go:348)`

Expected behavior:

All connections in pool a refers to a correct endpoint specified in constructor.

Steps to reproduce:

Use not a localhost endpoint

Related code:

	db, err := gorm.Open(ydb.Open(
		"grpc://192.168.20.20:2136/local",
		ydb.With(ydb2.WithStaticCredentials(
			"user1",
			"pswd",
		),
			//ydb2.With(config.WithNoAutoRetry()), ydb2.WithBalancer(balancers.SingleConn()), // UNCOMMENT FOR WORKAROUND
		),
	), &gorm.Config{
		Logger: logger.New(
			log.Default(),
			logger.Config{
				SlowThreshold: time.Second,
				LogLevel:      logger.Error,
			},
		),
	})
	if err != nil {
		fmt.Println(err)

		err = s.CloseConnect(db)
		if err != nil {
			return nil, err
		}

		return nil, err
	}

Other information:

uncomment line from the example for a workaround.

debug screen

image

@YuriyKortev YuriyKortev added the bug Something isn't working label Oct 14, 2024
@YuriyKortev YuriyKortev changed the title bug: bug: Balancer initializes grpc pool with 2 connections refers to different endpoints Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant