-
Notifications
You must be signed in to change notification settings - Fork 38.5k
sync=true
on @Cacheable
looses reactor's Context
#33079
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
Comments
I could not reproduce this as is. If you'd like us to spend some time investigating, please take the time to provide a complete minimal sample (something that we can unzip or git clone, build, and deploy) that reproduces the problem. It would be interesting to try and avoid the scheduling aspect, in order to ensure there are as little moving parts as possible. |
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed. |
Hi, sorry for my late answer @simonbasle Thanks for getting back to me. It seems I have missed in my example the You'll find a maven project here that reproduces the issue. I didn't remove scheduling due to the lack of time on my end. I hope it's sufficient. |
Thanks for the reproducer, @Crystark, this provided good context for deeper analysis. Unfortunately, we cannot support context propagation in the case of Think of it that way: in order to avoid any double invocation of the service method, it is not your controller which subscribes to the mono it returns. Instead, it is the Imagine two concurrent calls to the cached service, each with a different Hope this helps. |
Yes I understand. Thanks for the investigation |
Uh oh!
There was an error while loading. Please reload this page.
Affects: 6.1.8
Describe the bug
@Cacheable
annotation withsync=true
on a reactor publisher returning method looses the reactive contextTo Reproduce
This code reproduces the issue:
Actual behavior
Code execution prints the following
Expected behavior
Code should print
Workaround
If I remove the
sync=true
it all works as expected so the issue comes from the use ofsync=true
This was originally a question on stackoverflow.
The text was updated successfully, but these errors were encountered: