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

Add support for duplicated context in the gRPC clients #23731

Merged

Conversation

cescoffier
Copy link
Member

No description provided.

@quarkus-bot quarkus-bot bot added the area/grpc gRPC label Feb 15, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 15, 2022

Failing Jobs - Building 13e5e3c

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs

Full information is available in the Build summary check run.

Failures

⚙️ Gradle Tests - JDK 11 Windows #

- Failing: integration-tests/gradle 

📦 integration-tests/gradle

io.quarkus.gradle.devmode.MultiSourceProjectDevModeTest.main line 22 - More details - Source on GitHub

org.awaitility.core.ConditionTimeoutException: Condition with lambda expression in io.quarkus.test.devmode.util.DevModeTestUtils that uses java.util.function.Supplier, java.util.function.Supplierjava.util.concurrent.atomic.AtomicReference, java.util.concurrent.atomic.AtomicReferencejava.lang.String, java.lang.Stringboolean was not fulfilled within 1 minutes.
	at org.awaitility.core.ConditionAwaiter.await(ConditionAwaiter.java:164)
	at org.awaitility.core.CallableCondition.await(CallableCondition.java:78)

@@ -35,6 +41,12 @@
public void test() {
String neo = service.invoke("neo-mutiny");
assertThat(neo).matches("Hello neo-mutiny");

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would be good to also test if client interceptors are invoked with the same duplicated context

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test checks that it does call you on the same duplicated context. Not the interceptor, but the actual items.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems we didn't understand each other :)
OTOH, it's unlikely interceptor invocation would hijack context somehow, so maybe we're good without a test I wrote a bout

super.start(new ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) {

@Override
public void onReady() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was under impression that we want to invoke client stuff always with duplicated context but we stick to only propagating the context, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.
The problem is that if we start using a duplicated context, we cannot block anymore, which would break the blocking clients. So I just propagate if there is a context.

.map(HelloReply::getMessage)
.invoke(() -> assertThat(Vertx.currentContext().getDelegate())
.isNotInstanceOf(EventLoopContext.class).isNotInstanceOf(WorkerContext.class)
.isEqualTo(duplicate))
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's where we verify we are called on the same duplicated context

super.start(new ForwardingClientCallListener.SimpleForwardingClientCallListener<RespT>(responseListener) {

@Override
public void onReady() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes.
The problem is that if we start using a duplicated context, we cannot block anymore, which would break the blocking clients. So I just propagate if there is a context.

@cescoffier cescoffier merged commit 84428b3 into quarkusio:main Feb 16, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Feb 16, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.2.Final Feb 21, 2022
@cescoffier cescoffier deleted the grpc-client-duplicated-context branch March 15, 2022 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants