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

Executes scheduled methods on duplicated contexts #28255

Merged
merged 1 commit into from
Sep 30, 2022

Conversation

cescoffier
Copy link
Member

@cescoffier cescoffier commented Sep 28, 2022

  • Remove the executor from the ScheduledContext as it was confusing and can only be used for blocking methods
  • Create a duplicated context for both blocking and non-blocking invocation
  • Blocking invocation use executeBlocking, which uses the same thread pool as the previous executor
  • It is not possible to create the duplicated context in the thread factory (an idea discussed with Bruno and Martin because it creates a chicken-and-egg problem)
  • Simplify the dev console @scheduled support to use the same strategy - no need to play with the classloader anymore as there is no more in-thread direct invocation and the Vert.x thread that will be used has the right TCCL configured

Fix #28017

A follow-up for Quartz will be implemented later.

- Remove the executor from the ScheduledContext as it was confusing and can only be used for blocking methods
- Create a duplicated context for both blocking and non-blocking invocation
- Blocking invocation use executeBlocking, which uses the same thread pool as the previous executor
- It is not possible to create the duplicated context in the thread factory (an idea discussed with Bruno and Martin because it creates a chicken-and-egg problem)
- Simplify the dev console @scheduled support to use the same strategy - no need to play with the classloader anymore as there is no more in-thread direct invocation and the Vert.x thread that will be used has the right TCCL configured
@gsmet
Copy link
Member

gsmet commented Sep 28, 2022

Should this be backported?

@quarkus-bot

This comment has been minimized.

@cescoffier
Copy link
Member Author

@gsmet no, I would consider that as a new feature.

@mkouba
Copy link
Contributor

mkouba commented Sep 29, 2022

Blocking invocation use executeBlocking, which uses the same thread pool as the previous executor

Did you double-check?

A follow-up for Quartz will be implemented later.

Note that this would be a breaking change because of a different thread used to execute a scheduled method. We should also ask @machi1990 for opinion - there might be some quartz features that rely on execution in the built-in thread pool.

@cescoffier
Copy link
Member Author

@mkouba yes, I double check on which thread pool things were and are executed: it's the same.

@mkouba mkouba added the triage/waiting-for-ci Ready to merge when CI successfully finishes label Sep 29, 2022
@quarkus-bot
Copy link

quarkus-bot bot commented Sep 29, 2022

Failing Jobs - Building 963a588

Status Name Step Failures Logs Raw logs
✔️ JVM Tests - JDK 11
✔️ JVM Tests - JDK 17
JVM Tests - JDK 17 MacOS M1 Set up runner ⚠️ Check → Logs Raw logs
✔️ JVM Tests - JDK 18

@mkouba
Copy link
Contributor

mkouba commented Sep 29, 2022

2022-09-29T09:11:09.6535190Z Starting machine "podman-machine-default"
2022-09-29T09:11:12.6677840Z Error: dial unix /var/folders/mq/dx78dkw10dv2hb0fm0qvchqm0000gp/T/podman/qmp_podman-machine-default.sock: connect: no such file or directory

@holly-cummins JDK 17 MacOS M1failure ^

@gsmet gsmet merged commit 05f50da into quarkusio:main Sep 30, 2022
@quarkus-bot quarkus-bot bot added this to the 2.14 - main milestone Sep 30, 2022
@quarkus-bot quarkus-bot bot added kind/bugfix and removed triage/waiting-for-ci Ready to merge when CI successfully finishes labels Sep 30, 2022
@cescoffier cescoffier deleted the run-scheduled-method-on-dc branch September 30, 2022 13:20
cescoffier added a commit to cescoffier/quarkus that referenced this pull request Oct 3, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
cescoffier added a commit to cescoffier/quarkus that referenced this pull request Oct 6, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
cescoffier added a commit to cescoffier/quarkus that referenced this pull request Oct 6, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
igorregis pushed a commit to igorregis/quarkus that referenced this pull request Oct 16, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
igorregis pushed a commit to igorregis/quarkus that referenced this pull request Oct 16, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
igorregis pushed a commit to igorregis/quarkus that referenced this pull request Oct 16, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
igorregis pushed a commit to igorregis/quarkus that referenced this pull request Oct 17, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
tmihalac pushed a commit to tmihalac/quarkus that referenced this pull request Oct 27, 2022
…ntext.

This is the follow-up of quarkusio#28255.
When running the scheduled method, the lack of duplicated context can lead to contextual data loss (loss only, no leak).
This commit makes sure that the method runs with a duplicated context.

However, this is a breaking change for users expecting the method to run on a Quartz thread.
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.

Regression: Programmatic OpenTelemetry spans get ignored
4 participants