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 for reactive routes and @ConsumeEvent #23669

Merged
merged 2 commits into from
Feb 15, 2022

Conversation

cescoffier
Copy link
Member

  • Verify that reactive routes are invoked on duplicated contexts
  • Ensure that event consumers (@ConsumeEvent) are invoked from unshared duplicated context.


private void process(RoutingContext ctx) {
Context context = Vertx.currentContext();
Assertions.assertFalse(context instanceof EventLoopContext);
Copy link
Contributor

Choose a reason for hiding this comment

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

Would context.isOnEventLoopThread() still return true?

Copy link
Member Author

Choose a reason for hiding this comment

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

in the case of blocking... yes.
I know it's confusing. It's because of executeBlocking which keeps your event loop context.

I've opened a PR on Vert.x to get a better way to check if we are on a duplicated context.

Copy link
Contributor

@mkouba mkouba left a comment

Choose a reason for hiding this comment

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

Looks good otherwise.

@cescoffier cescoffier force-pushed the duplicated-context-checks branch from 347adac to cd63fa6 Compare February 14, 2022 14:55
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 14, 2022

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building cd63fa6

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs
✔️ JVM Tests - JDK 11
JVM Tests - JDK 11 Windows Build Failures Logs Raw logs
✔️ JVM Tests - JDK 17

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 21 - 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)

⚙️ JVM Tests - JDK 11 Windows #

- Failing: extensions/reactive-routes/deployment 
! Skipped: extensions/agroal/deployment extensions/elytron-security-jdbc/deployment extensions/flyway/deployment and 164 more

📦 extensions/reactive-routes/deployment

io.quarkus.vertx.web.context.DuplicatedContextTest.testThatBlockingRoutesAreCalledOnDuplicatedContext line 76 - More details - Source on GitHub

io.smallrye.mutiny.TimeoutException
	at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:64)
	at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)

@cescoffier cescoffier force-pushed the duplicated-context-checks branch from cd63fa6 to f3dbe95 Compare February 14, 2022 19:46
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 14, 2022

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building f3dbe95

Status Name Step Failures Logs Raw logs
Initial JDK 11 Build Build Failures Logs Raw logs

Failures

⚙️ Initial JDK 11 Build #

- Failing: extensions/reactive-routes/deployment 
! Skipped: devtools/bom-descriptor-json docs extensions/agroal/deployment and 174 more

📦 extensions/reactive-routes/deployment

Failed to execute goal net.revelc.code:impsort-maven-plugin:1.6.2:check (check-imports) on project quarkus-reactive-routes-deployment: Imports are not sorted in /home/runner/work/quarkus/quarkus/extensions/reactive-routes/deployment/src/test/java/io/quarkus/vertx/web/context/DuplicatedContextTest.java

@cescoffier cescoffier force-pushed the duplicated-context-checks branch from f3dbe95 to a9cb168 Compare February 15, 2022 07:17
@quarkus-bot
Copy link

quarkus-bot bot commented Feb 15, 2022

This workflow status is outdated as a new workflow run has been triggered.

Failing Jobs - Building a9cb168

Status Name Step Failures Logs Raw logs
Gradle Tests - JDK 11 Windows Build Failures Logs Raw logs
JVM Tests - JDK 11 Build Failures Logs Raw logs
JVM Tests - JDK 11 Windows Build Failures Logs Raw logs
JVM Tests - JDK 17 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)

⚙️ JVM Tests - JDK 11 #

- Failing: extensions/reactive-routes/deployment 
! Skipped: extensions/agroal/deployment extensions/elytron-security-jdbc/deployment extensions/flyway/deployment and 164 more

📦 extensions/reactive-routes/deployment

io.quarkus.vertx.web.context.DuplicatedContextTest.testThatBlockingRoutesAreCalledOnDuplicatedContext line 76 - More details - Source on GitHub

io.smallrye.mutiny.TimeoutException
	at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:64)
	at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)

⚙️ JVM Tests - JDK 11 Windows #

- Failing: extensions/reactive-routes/deployment 
! Skipped: extensions/agroal/deployment extensions/elytron-security-jdbc/deployment extensions/flyway/deployment and 164 more

📦 extensions/reactive-routes/deployment

io.quarkus.vertx.web.context.DuplicatedContextTest.testThatBlockingRoutesAreCalledOnDuplicatedContext line 76 - More details - Source on GitHub

io.smallrye.mutiny.TimeoutException
	at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:64)
	at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)

⚙️ JVM Tests - JDK 17 #

- Failing: extensions/reactive-routes/deployment 
! Skipped: extensions/agroal/deployment extensions/elytron-security-jdbc/deployment extensions/flyway/deployment and 164 more

📦 extensions/reactive-routes/deployment

io.quarkus.vertx.web.context.DuplicatedContextTest.testThatBlockingRoutesAreCalledOnDuplicatedContext line 76 - More details - Source on GitHub

io.smallrye.mutiny.TimeoutException
	at io.smallrye.mutiny.operators.uni.UniBlockingAwait.await(UniBlockingAwait.java:64)
	at io.smallrye.mutiny.groups.UniAwait.atMost(UniAwait.java:65)

@mkouba
Copy link
Contributor

mkouba commented Feb 15, 2022

The DuplicatedContextTest fails with timeout - maybe increase the duration (although 10s is usually enough)?

@cescoffier
Copy link
Member Author

Yes, that's weird. Something else is happening. I will have a look (I can't reproduce it locally of course).

The for-loop is not necessary for the blocking test, so I may just simplify it.

@cescoffier cescoffier force-pushed the duplicated-context-checks branch from a9cb168 to 1017a9a Compare February 15, 2022 12:42
@cescoffier cescoffier merged commit 31d858e into quarkusio:main Feb 15, 2022
@quarkus-bot quarkus-bot bot added this to the 2.8 - main milestone Feb 15, 2022
@gsmet gsmet modified the milestones: 2.8 - main, 2.7.2.Final Feb 21, 2022
@cescoffier cescoffier deleted the duplicated-context-checks branch March 15, 2022 07:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants