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

netty: fix a race for channelz at server transport creation (backport v1.27.x) #6626

Merged
merged 1 commit into from Jan 22, 2020

Conversation

dapengzhang0
Copy link
Member

This is a chery-pick of b8474d6

A race condition was reported by user in #6601:

ServerImpl.start() calls NettyServer.start() while holding ServerImpl.lock. NettyServer.start() awaits a submitted runnable in eventloop. However, this pending runnable may never be executed because the eventloop might be executing some other task, like ServerListenerImpl.transportCreated(), that is trying to acquire ServerImpl.lock causing a deadlock.

This PR resolves the particular issue reported in #6601 for server with a single port, but NettyServer (https://github.com/grpc/grpc-java/blob/v1.26.0/netty/src/main/java/io/grpc/netty/NettyServer.java#L251) and ServerImpl (https://github.com/grpc/grpc-java/blob/v1.26.0/core/src/main/java/io/grpc/internal/ServerImpl.java#L184) in general still have the same potential risk of deadlock, which need further fix.

A race condition was reported by user in grpc#6601:

`ServerImpl.start()` calls `NettyServer.start()` while holding `ServerImpl.lock`. `NettyServer.start()` awaits a submitted runnable in eventloop. However, this pending runnable may never be executed because the eventloop might be executing some other task, like `ServerListenerImpl.transportCreated()`, that is trying to acquire `ServerImpl.lock` causing a deadlock.

This PR resolves the particular issue reported in grpc#6601 for server with a single port, but `NettyServer` (https://github.com/grpc/grpc-java/blob/v1.26.0/netty/src/main/java/io/grpc/netty/NettyServer.java#L251) and `ServerImpl` (https://github.com/grpc/grpc-java/blob/v1.26.0/core/src/main/java/io/grpc/internal/ServerImpl.java#L184) in general still have the same potential risk of deadlock, which need further fix.
@dapengzhang0 dapengzhang0 changed the title netty: fix a race for channelz at server transport creation netty: fix a race for channelz at server transport creation (backport v1.27.x) Jan 22, 2020
@dapengzhang0 dapengzhang0 merged commit 8c346d0 into grpc:v1.27.x Jan 22, 2020
@dapengzhang0 dapengzhang0 deleted the v1.27.x branch January 22, 2020 00:56
@lock lock bot locked as resolved and limited conversation to collaborators Apr 25, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants