[
https://issues.apache.org/jira/browse/SCB-845?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16583230#comment-16583230
]
ASF GitHub Bot commented on SCB-845:
------------------------------------
liubao68 closed pull request #873: [SCB-845] bug fix: some times download file
can not get correct content
URL: https://github.com/apache/incubator-servicecomb-java-chassis/pull/873
This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:
As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):
diff --git
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
index bb922b2a6..caf288731 100644
---
a/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
+++
b/foundations/foundation-vertx/src/main/java/org/apache/servicecomb/foundation/vertx/http/ReadStreamPart.java
@@ -106,10 +106,16 @@ public Context getContext() {
CompletableFuture<T> future = new CompletableFuture<>();
Buffer buffer = Buffer.buffer();
- readStream.exceptionHandler(future::completeExceptionally);
- readStream.handler(buffer::appendBuffer);
- readStream.endHandler(v -> future.complete(converter.apply(buffer)));
- readStream.resume();
+ // if readStream.resume() not run on correct eventloop, will:
+ // 1.create a context task to save last chunk data to buffer
+ // 2.activate connection to read new data
+ // but maybe 2 will run before 1, that will cause lost data or get
incorrect data
+ context.runOnContext(V -> {
+ readStream.exceptionHandler(future::completeExceptionally);
+ readStream.handler(buffer::appendBuffer);
+ readStream.endHandler(v -> future.complete(converter.apply(buffer)));
+ readStream.resume();
+ });
return future;
}
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
> some times download file can not get correct content
> ----------------------------------------------------
>
> Key: SCB-845
> URL: https://issues.apache.org/jira/browse/SCB-845
> Project: Apache ServiceComb
> Issue Type: Bug
> Components: Java-Chassis
> Reporter: wujimin
> Assignee: wujimin
> Priority: Major
> Fix For: java-chassis-1.1.0
>
>
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)