Dgraph Alpha does not shutdown when signaled to when it has not yet joined a cluster

Moved from GitHub dgraph/4035

Posted by danielmai:

What version of Dgraph are you using?

v1.1.0

Have you tried reproducing the issue with the latest release?

Yes

What is the hardware spec (RAM, OS)?

N/A

Steps to reproduce the issue (command/config used to run Dgraph).

  1. Run Dgraph Alpha with no Zero running.

    dgraph alpha
    
  2. Press Ctrl-C (SIGINT) or send a SIGTERM to the Alpha process. The Alpha will show these logs, closing the gRPC and HTTP ports:

    ^CI0920 15:47:54.818842   10214 run.go:547] Caught Ctrl-C. Terminating now (this may take a few seconds)...
    E0920 15:47:54.818949   10214 run.go:331] GRPC listener canceled: accept tcp [::]:9080: use of closed network connection
    E0920 15:47:54.819126   10214 run.go:350] Stopped taking more http(s) requests. Err: accept tcp [::]:8080: use of closed network connection
    I0920 15:47:54.819443   10214 run.go:566] GRPC and HTTP stopped.
    
  3. The Alpha process stays idle indefinitely.

Expected behaviour and actual result.

Dgraph Alpha should shut down properly even if it hasn’t yet been assigned to a group.

The actual result is that the Alpha process continues running unless it is forcibly shutdown with three Ctrl-C’s or forcibly killed by SIGKILL.

This is a low priority issue. Fixing this would be a small operational enhancement.