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]V4.10.2 rpc_client.go Call function easily happen RWMutex‘s read lock re-entry then deadlock #2708

Open
yuan0763 opened this issue Apr 25, 2024 · 0 comments

Comments

@yuan0763
Copy link

example:

type TestService struct {
}

func (s *TestService) FuncA() error {
//rpc call 127.0.0.1 node's funcB
client.DefaultClient.Call(
context.Background(),
client.NewRequest("TestService", "TestService.FuncB", nil),
nil,
client.WithAddress("127.0.0.1:8080"),
)
return nil
}

func (s *TestService) FuncB() error {
//get the rpcClient's write lock
go func() {
client.DefaultClient.Init()
}()
//rpc call 127.0.0.1 node's funcC,
//rpcClient's mu read lock re-entry then deadlock
client.DefaultClient.Call(
context.Background(),
client.NewRequest("TestService", "TestService.FuncC", nil),
nil,
client.WithAddress("127.0.0.1:8080"),
)
return nil
}

func (s *TestService) FuncC() error {
return nil
}

func TestRpcClient(t *testing.T) {
s := &TestService{}

go func() {
	s.FuncA()
}()

time.Sleep(time.Minute)

}

@yuan0763 yuan0763 changed the title [BUG]rpc_client.go Call function easily happen RWMutex‘s read lock re-entry then deadlock [BUG]V4.10.2 rpc_client.go Call function easily happen RWMutex‘s read lock re-entry then deadlock Apr 25, 2024
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

1 participant