Github user tillrohrmann commented on a diff in the pull request: https://github.com/apache/flink/pull/5430#discussion_r168187481 --- Diff: flink-runtime/src/main/java/org/apache/flink/runtime/webmonitor/WebMonitorEndpoint.java --- @@ -593,6 +617,8 @@ public void shutdown(Time timeout) { } catch (Exception e) { log.warn("Error while stopping leaderElectionService", e); } + + super.shutdown(timeout); --- End diff -- Because `leaderElectionService.stop()` can call `revokeLeadership`. Inside of `revokeLeadership` we call `RestServerEndpoint#getRestAddress` which cannot be accessed after it has been shut down. This happens when calling `super.shutdown`. Moreover, I think it is a good idea to call the close method first on the sub class and then on the parent class in order to guarantee that you don't close any services from the parent class which the sub class might still need for closing.
---