Github user zentol commented on a diff in the pull request: https://github.com/apache/flink/pull/5062#discussion_r153796142 --- Diff: flink-queryable-state/flink-queryable-state-client-java/src/main/java/org/apache/flink/queryablestate/network/AbstractServerBase.java --- @@ -205,6 +212,11 @@ public void start() throws Throwable { private boolean attemptToBind(final int port) throws Throwable { log.debug("Attempting to start {} on port {}.", serverName, port); + // here we reset the future every time because in case of failure + // to bind, we call shutdown here and this may interfere with future + // shutdown attempts. + this.serverShutdownFuture.getAndSet(null); --- End diff -- If we intend to only support a single start of a server this should use compareAndSet and fail immediately if a shutdown is in progress. If we intend to support multiple starts of a server we should guard start() and shutdown() with a lock since otherwise you easily end up in an inconsistent state.
---