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
Revise RetryTopicConfigurationSupport TaskExecutor Strategy #2239
Comments
I started looking into this, and TBH I think it's a slightly worse scenario than what I'd have thought. Turns out when there is a But what I think is the worst part is that there's logic in the I think this is really unexpected and weird behavior, but at least in my test application with Boot 2.6.6 that's how it goes. I'm not sure what'd be a good move here - the less impactful thing I can think of would be if we'd go back to letting the Any thoughts? Thanks. |
You know I think the |
Oh, that sounds great really. TBH, I have no clue of how frequently this timing adjuster kicks in in real life scenarios - it depends on too many factors. But as an overall default dependency for the feature, a full fledged I'll do some testing to see if it has any impact on actual precision and submit a PR with this change. Please let me know if you think of anything else. Thanks! |
Actually, a SATE is probably not good here; especially with long delays; we could end up with many threads sleeping. On the other hand too small a pool could cause some short delay to be queued behind longer delays for other partitions. Maybe in 3.0, we should look at changing the logic to use a |
Hmm, I didn't really know this For clarification, the amount of time sleeping isn't actually related to the delay size. Every time we receive a Let's say Lines 114 to 127 in e1160fa
A different solution might be having a single thread that runs through a list and wakes up the proper consumers at the proper time, but it seems the |
Also, there's a minimal |
About this, considering all that's been said, I think it's worth it using the Another option would be registering the For WDYT? Thanks |
1 similar comment
About this, considering all that's been said, I think it's worth it using the Another option would be registering the For WDYT? Thanks |
Even if a I guess I need to investigate more in Spring Boot what and how they do with many I recently changes Spring Integration to rely on the auto-configured |
How about the idea of turning the The issue I see with that is that currently we have an option of not having a |
Well, the bean method can return |
Nice, I wasn't sure if that was a proper solution, thanks. I think since we have this auto configuration problems and with some not-so-great consequences, it's worth it shielding the solution from that. We can always revise it later for 3.0 if we need to. If that sounds good, I can open a PR for us to look at, probably with the |
See the same
Where However I see in the latest version they did something like this:
The issue is exactly the same what we are talking here about: spring-projects/spring-framework#27903 |
Nice, thanks. They seem to have created a wrapper, perhaps to escape that problem. We already have a I didn't see anyone in that thread address the issue that |
It comes with the:
So, the |
Sorry, I'm not sure I follow... What I mean is, in TaskExecutionAutoConfiguration.java the Then in WebMvcAutoConfiguration.java, the logic tries to fetch the Maybe that's documented somewhere and not a real issue - as a user I was surprised by this side effect though, specially since if I understand correctly that's the Now that I think about it, that would also mean if users inject the provided I guess I'm probably missing something 😄 |
I guess this is it:
The provided task executor is used to: So it looks like a niche use case for this executor. Although the javadocs is perhaps a bit misleading since by default the auto configured |
The point is that either way the WebMvc does not provide any extra |
Sure, makes sense. Also, users relying on injecting the auto configured bean would get a different |
I think I have figured out how we can resolve this using the new Expect a PR in the next day or so. |
Sounds great @garyrussell, thanks! Looking forward to it. |
New back of manager (and factory) that uses a task scheduler to resume the paused partitions.
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
Thanks; good to know the integration tests still work. I will probably just remove the unit tests for the deprecated components.
This is in no way a criticism of your implementation or the necessary addition of the timing adjustment; just evolution.
Yes; I will leave the events though; someone might still want them. Given that the doc still says
I wonder if we can just go ahead and remove everything instead of deprecating it, even in 2.9? @artembilan WDYT? The wrapper should probably be moved to a top level class; I added it so we don't interfere with Boot's auto configured scheduler if Spring Integration and/or I don't think we should auto configure one; the way I've structured it, is we will use the wrapper if present or a single scheduler bean (if present) or Boot's auto configured scheduler, if present, and there are more than one. I think we just need to document that fact. Thanks for taking the time to review; I will start the clean up later today, but probably won't submit a PR until next week (and we have a holiday Monday). I am planning on releasing 2.9.0-RC1 next week; with GA a couple of weeks later. Let me know if there is anything else we should consider for the RC. |
I agree that we can go ahead with removal of the redundant API even in |
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
I added the code purging commit to my branch https://github.com/garyrussell/spring-kafka/commits/GH-2239 Tests are all passing. Let me know if you think I have been too aggressive, or if I have missed anything. I am off work until Tuesday. Docs and PR to follow next week. I left |
This looks good - but just to make sure we're on the same page regarding breaking changes, with this, not only users will need to add the Of course, if that's not a concern to you, it's not to me either, and we do provide the same features with different configurations so maybe that could be considered an API change. One thing I didn't really understand is this: Assert.state(ONLY_ONE_ALLOWED.getAndSet(false), "Only one 'RetryTopicConfigurationSupport' is allowed"); Also, as long as we're removing support for legacy bootstrapping, we can also remove support for legacy bean names in return this.beanFactory.containsBean("internalRetryTopicConfigurer")
? this.beanFactory.getBean("internalRetryTopicConfigurer", RetryTopicConfigurer.class)
: this.beanFactory.getBean(RetryTopicBeanNames.RETRY_TOPIC_CONFIGURER_BEAN_NAME, RetryTopicConfigurer.class); The |
I would normally not make such breaking changes in a minor release, but we were up front in the documentation that, while the feature is stable and supported, the APIs were subject to change. So I believe we are justified. To be honest, I am glad that I added that to the docs; when you first submitted the original PR, the amount of new code was so overwhelming that a normal code review could never fully cover all the bases, so I suspected that we might need some breaking changes as usage increased. If you feel it's too much, we can defer the second commit until 3.0. I am ok with that too; I would just need to pull some of the polishing into 2.9. Please discuss with @artembilan while I am away. The reason I added the "only one allowed" check is because, when I was migrating the tests, I added ...having not noticed there was already one here... With that in place, the blocking retry tests all failed because the overridden method to set up the exceptions was not called. Perhaps I used a sledge hammer to crack a tiny nut; if you can think why that might have happened (and we can detect and correct it somehow), I would be happy to remove the check. That said, Boot no longer allows bean overrides by default; having 2 or more of them in a Boot app won't work because of the bean declarations in the super class (without allowing bean overrides in Boot config). With this technique, we will fail fast with a meaningful message. |
Another reason for the change being ok in 2.9 is nobody is forced to use it; it's opt-in, Boot won't pull it in and the 3.2.0 clients work fine with 2.8 if there's a compelling reason for using those. |
Sure, no worries, I just wanted to make sure you're aware that existing configurations would break too.
Sure, I realize that, and do appreciate a lot you merging the code in such conditions. This opened a whole universe I didn't know existed and I'm really grateful for that.
Not necessary for me - let's break some walls!
Looks like we're all on the same page, but if anything comes up I'll bring it up, and I'll be available if anything is needed.
Looks like the configured beans were overridden by new ones, right?
Sure, no worries, we can leave it that way, I was just curious. Thanks a lot for looking into this! And let me know if there's anything else I can help with. |
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
Resolves spring-projects#2239
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
Resolves spring-projects#2239
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
Resolves spring-projects#2239
New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume.
Resolves spring-projects#2239
Resolves #2239 * GH-2239: Replace PartitionPausingBackOffManager New back of manager (and factory) that uses a task scheduler to resume the paused partitions. Revert change to deprecated PartitionPausingBackoffManager. Log resume. * Remove legacy code. Also fix unrelated race in EKIT. Only allow one `RetryTemplateConfigurationSupport` bean. * Fix static var. * Docs. * More docs. * Remove more dead/deprecated code. * Address PR Comments. * Fix RetryTopicConfigurer bean retrieval. * Remove unnecessary casts in doc. # Conflicts: # spring-kafka/src/main/java/org/springframework/kafka/retrytopic/RetryTopicConfigurer.java # spring-kafka/src/main/java/org/springframework/kafka/retrytopic/RetryTopicInternalBeanNames.java # spring-kafka/src/test/java/org/springframework/kafka/retrytopic/ListenerContainerFactoryConfigurerTests.java
Related to spring-projects#2239 **Cherry-pick to `2.9.x`**
Related to #2239 **Cherry-pick to `2.9.x`**
Related to #2239 **Cherry-pick to `2.9.x`**
See spring-projects#2239 The previous commit removed the implicit bootstrap in favor of enforcing the user to use the `@EnableKafkaRretryTopic` or explicitly extend `RetryTopicConfigurationSupport`. Unfortunately, this breaks Spring Boot because it can auto configure a `RetryTopicConfiguration` bean, which means the infrastructure beans are required. Fallback to late binding of the infrastructure beans if a `RetryTopicConfiguration` bean is found in the application context. **cherry-pick to main**
See spring-projects#2239 The previous commit removed the implicit bootstrap in favor of enforcing the user to use the `@EnableKafkaRretryTopic` or explicitly extend `RetryTopicConfigurationSupport`. Unfortunately, this breaks Spring Boot because it can auto configure a `RetryTopicConfiguration` bean, which means the infrastructure beans are required. Fallback to late binding of the infrastructure beans if a `RetryTopicConfiguration` bean is found in the application context. Tested with a Boot app. **cherry-pick to main**
See #2239 The previous commit removed the implicit bootstrap in favor of enforcing the user to use the `@EnableKafkaRretryTopic` or explicitly extend `RetryTopicConfigurationSupport`. Unfortunately, this breaks Spring Boot because it can auto configure a `RetryTopicConfiguration` bean, which means the infrastructure beans are required. Fallback to late binding of the infrastructure beans if a `RetryTopicConfiguration` bean is found in the application context. Tested with a Boot app. **cherry-pick to main**
See #2239 The previous commit removed the implicit bootstrap in favor of enforcing the user to use the `@EnableKafkaRretryTopic` or explicitly extend `RetryTopicConfigurationSupport`. Unfortunately, this breaks Spring Boot because it can auto configure a `RetryTopicConfiguration` bean, which means the infrastructure beans are required. Fallback to late binding of the infrastructure beans if a `RetryTopicConfiguration` bean is found in the application context. Tested with a Boot app. **cherry-pick to main**
Currently we add a
ThreadPoolTaskExecutor
@Bean
inRetryTopicConfigurationSupport
. That might have undesirable side-effects such as makingSpring Boot
's auto configuration back off from providing a defaultTaskExecutor
for users.We should investigate this further and if necessary look for alternatives.
The text was updated successfully, but these errors were encountered: