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

Debugging difficulties in AspectJ LTW @Transactional methods [SPR-10596] #15225

Closed
spring-issuemaster opened this issue May 28, 2013 · 7 comments
Closed

Comments

@spring-issuemaster
Copy link
Collaborator

@spring-issuemaster spring-issuemaster commented May 28, 2013

Dumitru Boldureanu opened SPR-10596 and commented

Since 3.2.2, debugging @Transactional methods weaved with AspectJ is complicated (some might say "not possible").

In version 3.2.2 AbstractTransactionAspect.aj was modified to use @around advice instead of the combination of @before and @after.

After this change I cannot "Step Into" a @Transactional methods and then inside it, "Step Over" line by line.
In Netbeans - this is the main IDE I use, it is possible to "Step Into" the method, but it is not possible to "Step Over" line by line inside the method.
In Eclipse, if you to add a break point inside the method it is possible to step by step inside it, but
for both, it is a problem, when the method ends, instead of getting back to the code that called this method, the debugger takes me to internal AOP/AspectJ classes.

I'm tried different versions of AspectJ, 1.7.0, 1.7.1 and 1.7.2, for all of them the result is the same.

Added a test project:
https://github.com/dboldureanu/spring-framework-issues/tree/master/SPR-10596

  1. Put a break point at line 28, XmlConfigTests.java
  2. Start XmlConfigTests in debug mode.
  3. Step into saveTestData method and there try go line by line.
    Then try the same with an older version of Spring for example 3.2.1.

Affects: 3.2.2, 3.2.3, 4.0 M1

Reference URL: http://forum.springsource.org/showthread.php?137952-Debugging-AspectJ-LTW-classes-methods-issues-with-with-Spring-3-2-2

2 votes, 7 watchers

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented May 31, 2013

Juergen Hoeller commented

Sorry to hear that debugging seems to be so hard now....

The change was motivated by full support for our (quite old) CallbackPreferringPlatformTransactionManager mechanism which wraps the entire target method call in a TransactionCallback, primarily designed for it to be compatible with WebSphere's UOWManager facility. We meant to do this change way earlier but only got reminded lately that we still had to do it.

Not sure what we can do about this in the short term while also preserving support for WebSphere and potential other WebSphere-style transaction demarcation APIs. I'd say that AspectJ around advice should generally be easier to debug; I'll get in touch with our AspectJ guys and see what they say.

Juergen

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 28, 2013

Michael Wiles commented

Yes, I have noticed this as well. I suspect it can probably be addressed on the "other" side as well (the eclipse AJDT plugin). Could it have something to do with the way the source code is mapped after the aspect has been weaved?

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Oct 28, 2013

Dumitru Boldureanu commented

This seems to be an AspectJ issue, some other mentioning can found here: http://stackoverflow.com/questions/14762142/eclipse-debug-stepping-with-aspectj.

From my experience methods that are weaved through @Before, @After, @AfterThrowing aspects are debugging fine, while those with @Around aren't.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 9, 2014

Phil Varner commented

It's not clear if this is an issue with AspectJ or the IDE (in my case IntelliJ IDEA), but it's probably not a problem with Spring. In the SO post that Dumitru linked to, a user asserts that "Stepping through advice has the incorrect file attribute attached to it." I don't know if that's true or not. In IntelliJ IDEA 13.0.1, the debugger does a pretty good job of linking the AspectJ woven code to the original line numbers -- for example, within an @Transactional method, it will link a stack frame with a method name of foo_aroundBody2():440 to source file method foo():440 -- which may just be a coincidence, and it only works b/c AspectJ is doing a good job of keeping the line numbers the same. For @Before and @Annotations, the IDEA debugger re-writes the frame stack to remove the aspectj frames and rename the woven methods to the original ones, so it looks as if the aspects don't exist. I've filed a case with IntelliJ to see if they can do the same for @Around.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 10, 2014

Phil Varner commented

IntelliJ issue http://youtrack.jetbrains.com/issue/IDEA-119214 was filed to hopefully address this. As I said in my previous comment, it's not clear if AspectJ is generating sufficient metadata for @Around for the debugger to clean up the frame stack, but the IDEA developers should be able to figure that out.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Apr 6, 2017

Andrey B commented

In case of IDEA I believe https://youtrack.jetbrains.com/issue/IDEA-142437 is a more relevant ticket.

@spring-issuemaster

This comment has been minimized.

Copy link
Collaborator Author

@spring-issuemaster spring-issuemaster commented Jan 12, 2019

Bulk closing outdated, unresolved issues. Please, reopen if still relevant.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.