Skip to content

Example HelloWorldServer does not gracefully shutdown #6511

@dounan

Description

@dounan

What version of gRPC-Java are you using?

On a fork up at commit d168632

What is your environment?

Mac OSX 10.14.6
Java 11.0.2

What did you expect to see?

The server should allow in-flight RPCs to finish

What did you see instead?

The client receives error WARNING: RPC 1 failed: Status{code=UNAVAILABLE, description=Network closed for unknown reason, cause=null}

Steps to reproduce the bug

  • Add a call to Thread.sleep(15000) in io.grpc.examples.helloworld.HelloWorldServer.GreeterImpl.sayHello
  • Build and run the server
  • Run the client
  • Ctrl+C the server once it gets the request

It seems like server.shutdown() does not wait for in-flight RPCs to finish before returning. The documentation makes it seem like that it should block.

I am able to "fix" the issue by adding a call to server.awaitTermination() in the stop method.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions