Github user zentol commented on the issue:
https://github.com/apache/flink/pull/6203
There's a problem with how we designed the `FileUploads` cleanup. The
`AbstractHandler` cleans it up when `AbstractHandler#respondToRequest` returns.
There is however no guarantee that the request has been fully processed at this
point, since `AbstractRestHandler` frequently processes requests asynchronously
using `CompletableFutures`. In turn we may end up deleting files _before_ they
have been processed or _while _ they are being processed.
It appears we can only handle the cleanup in `AbstractHandler` if we let
`AbstractHandler#respondToRequest` return a `CompletableFuture` that marks the
finished request processing.
---