spring-projects / spring-boot

Spring Boot helps you to create Spring-powered, production-grade applications and services with absolute minimum fuss.
https://spring.io/projects/spring-boot
Apache License 2.0
75.34k stars 40.72k forks source link

@Around Aspect is Inconsistently Intercepting When Execution Invoked by Multiple Threads(~25+) #43206

Open rndinsider opened 1 week ago

rndinsider commented 1 week ago

Running Spring Boot 3.2.5. Using org.springframework.spring-aspects

While Using org.aspectj.lang.annotation.Around we noticed in consistency when using multi threads for invoking a method expected to be get into the aspect. We are using a

@Around("execution( org.springframework.web.client.RestTemplate.(..))")

ExecutorService executor; executor = Executors.newFixedThreadPool(50); .. future.get(); // Inconsistency shows at some cases, expected http enrichments made by the Aspect are not added. After checking we saw that in some cases, the RestTemplate exchange method is not intercepted by the Aspect. This is while in some cases, for the the same argument (same exchange invocations), there are no issues at all, and all exchange calls are intercepted and headers are enriched with required values.

nosan commented 1 week ago

Could you please share a sample to reproduce an issue? At the moment it is quite difficult to help you.

https://github.com/spring-projects/spring-boot/wiki/How-To-Get-Help#defining-the-problem

spring-projects-issues commented 6 hours ago

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.