eclipse-aspectj / aspectj

Other
291 stars 84 forks source link

aspectj with logback and springboot deadlock happened #259

Closed walkertest closed 1 year ago

walkertest commented 1 year ago

how to reproduce

some env

java.version: 1.8.0_361
springboot: 2.7.15
aspectjweaver: 1.9.20

I don't know how to avoid this problem, wish your response. Thanks first.

more detailInfo

image

Java stack information for the threads listed above:

"pool-1-thread-1": at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:99)

Found 1 deadlock.


[jstackinfo.txt](https://github.com/eclipse-aspectj/aspectj/files/12495160/26220.txt)
kriegaex commented 1 year ago

Can you please post some more information, for example a call stack, thread dump etc.? I am on the road and would like to understand this issue first, before having a chance to clone your repository. Thanks.

walkertest commented 1 year ago

Hi, I have update the issue with some more info.

kriegaex commented 1 year ago

Thank you for the MCVE and its documentation. Great job! 🙂

I can reproduce the problem, but only in debug mode, not when running the application normally. Either way, it looks as if there is no AspectJ issue, but the problem sits in front of the computer. You use Spring AOP incorrectly. Please change the faulty

@Aspect
@Configuration
public class ComponentTest {

to

@Aspect
@Component
public class ComponentTest {

See PR https://github.com/walkertest/springdemo/pull/1.

I see this error so often and have commented on it on Stack Overflow a lot. It seems there is one faulty source from which everyone copies and pastes their Spring AOP aspects. An aspect is a component, not a configuration class. The types of proxies created for both are different. Correct that, and the problem goes away.

P.S.: Why are you avoiding capital letters where the English language requires them? Orthography is not optional, just because we are computer nerds. It makes reading your text more difficult than necessary.

walkertest commented 1 year ago

Thanks your advice!

kriegaex commented 1 year ago

@walkertest: https://stackoverflow.com/a/56919004/1082681