Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix handling of entity length in HTTP/2. #5610

Merged
merged 2 commits into from
Dec 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ public void data(Http2FrameHeader header, BufferData data) {
try {
while (data.available() > 0) {
// todo compression support
// todo one message could span multiple frames
boolean isCompressed = (data.read() == 1);
long length = data.readUnsignedInt32(); // if the result is > than data length, wait for next data?
byte[] bytes = new byte[(int) length];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,14 +217,11 @@ public void data(Http2FrameHeader header, BufferData data) {
writer.write(rst.toFrameData(clientSettings, streamId, Http2Flag.NoFlags.create()), flowControl);
return;
}
expectedLength -= header.length();
if (expectedLength != -1) {
expectedLength -= header.length();
}
try {
inboundData.put(new DataFrame(header, data));
// TODO this is a race condition
// if (Http2FrameTypes.DATA.flags(header.flags())
// .endOfStream()) {
// state = Http2StreamState.HALF_CLOSED_REMOTE;
// }
} catch (InterruptedException e) {
throw new Http2Exception(Http2ErrorCode.INTERNAL, "Interrupted", e);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
import io.grpc.stub.StreamObserver;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Disabled;
import org.junit.jupiter.api.RepeatedTest;

import static org.hamcrest.CoreMatchers.is;
Expand Down Expand Up @@ -81,8 +80,7 @@ void afterEach() throws InterruptedException {
}
}

@RepeatedTest(100)
@Disabled("Hangs when run from maven")
@RepeatedTest(20)
void testUnary() {
String text = "lower case original";
StringMessage request = StringMessage.newBuilder().setText(text).build();
Expand All @@ -91,9 +89,7 @@ void testUnary() {
assertThat(response.getText(), is(text.toUpperCase(Locale.ROOT)));
}

@RepeatedTest(100)
// TODO requires analysis + fix
@Disabled("Intermittently failing on RST_STREAM")
@RepeatedTest(20)
void testBidi() throws Throwable {
List<String> valuesToStream = List.of("A", "B", "C", "D");

Expand All @@ -111,9 +107,7 @@ void testBidi() throws Throwable {
assertThat(echoes, is(valuesToStream));
}

// TODO requires analysis + fix
@Disabled("Intermittently failing on RST_STREAM")
@RepeatedTest(100)
@RepeatedTest(20)
void testClientStream() throws Throwable {
List<String> valuesToStream = List.of("A", "B", "C", "D");
StringsCollector responseObserver = new StringsCollector();
Expand All @@ -129,9 +123,7 @@ void testClientStream() throws Throwable {
assertThat(strings, contains("A B C D"));
}

// TODO requires analysis + fix
@RepeatedTest(100)
@Disabled("Intermittent failures (timing related)")
@RepeatedTest(20)
void testServerStream() throws Throwable {
StringsCollector responseObserver = new StringsCollector();
stub.split(StringMessage.newBuilder().setText("A B C D").build(), responseObserver);
Expand All @@ -150,7 +142,8 @@ public void onNext(StringMessage stringMessage) {

@Override
public void onError(Throwable throwable) {
future.completeExceptionally(throwable);
// wrap in our exception, so we can see who called this (onError) method
future.completeExceptionally(new RuntimeException(throwable));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Copyright (c) 2022 Oracle and/or its affiliates.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
handlers=io.helidon.logging.jul.HelidonConsoleHandler
java.util.logging.SimpleFormatter.format=%1$tY.%1$tm.%1$td %1$tH:%1$tM:%1$tS.%1$tL %5$s%6$s%n
# Global logging level. Can be overridden by specific loggers
.level=INFO

# io.helidon.nima.level=FINEST