GitHub user zentol opened a pull request:
https://github.com/apache/flink/pull/6217
[FLINK-9677][rest] Cleanup encoder after request has been processed
## What is the purpose of the change
This PR fixes an issue in the `RestClient` where the
`HttpPostRequestEncoder` would be closed before the request submission was
complete. `Channel#writeAndFlush();` doesn't block which lead to a race
condition between the actual writing and `HttpPostRequestEncoder#cleanFiles()`.
Instead we now register a listener on the last `ChannelFuture` to cleanup
the encoder once the writing is complete.
## Verifying this change
* `MultipartUploadResource` was modified to also include the upload of a
large (64mb) mb file, which is used by `FileUploadHandlerTest` and
`RestClientMultipartTest`
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zentol/flink 9677
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/flink/pull/6217.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #6217
----
commit 48c10dd686ac97cef6db4703fe61dffa5ff7d913
Author: zentol <chesnay@...>
Date: 2018-06-27T07:34:34Z
[FLINK-9677][rest] Cleanup encoder after request has been processed
----
---