Is It Possible For Two PointCut To Go Infinite Loop?

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Is It Possible For Two PointCut To Go Infinite Loop?

ants

Hi All,

I have two pointcuts designed in my aspectj file. First pointcut checks whether the class under execution has extended a particular class. If so sets a state and another point cut there on track all the method calls into a file ( until the first pointcut  sets the state to false in its after method).

But looks like these two point cut goes into infinite loop. Because the moment I'm using this jar, my program hangs. So I'm guessing it would went infinite loop. Since I'm new to aspect world, first need to make sure the approach what I have taken is correct and is there any possibility that the two point cut can hang?

Note that I'm using load time weaving. 

Your thoughts can help me in debugging.


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

Alexander Kriegisch-2
Hi Anto.

How about sharing some actual code?
-- 
Alexander Kriegisch


Am 25.11.2015 um 16:39 schrieb Anto Aravinth <[hidden email]>:

Hi All,

I have two pointcuts designed in my aspectj file. First pointcut checks whether the class under execution has extended a particular class. If so sets a state and another point cut there on track all the method calls into a file ( until the first pointcut  sets the state to false in its after method).

But looks like these two point cut goes into infinite loop. Because the moment I'm using this jar, my program hangs. So I'm guessing it would went infinite loop. Since I'm new to aspect world, first need to make sure the approach what I have taken is correct and is there any possibility that the two point cut can hang?

Note that I'm using load time weaving. 

Your thoughts can help me in debugging.

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

smime.p7s (3K) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

ants
Here is the actual code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&&!cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }
       

We are trying to use this to track the test cases that are run in:

https://github.com/google/guava

project. (under guava-tests directory) Any help would be really great!
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

ants
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

ants

Any solutions for this issue?

On 26 Nov 2015 15:44, "ants [via AspectJ]" <[hidden email]> wrote:
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.


If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
To unsubscribe from Is It Possible For Two PointCut To Go Infinite Loop?, click here.
NAML
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

Frank Pavageau-2

Well, have you tried attaching a debugger to see if it actually loops infinitely? Or even doing a simple thread dump? You can use the jstack CLI for that.

If you're trying to use aspects, that should be accessible.

Regards,
Frank

Le 28 nov. 2015 18:25, "ants" <[hidden email]> a écrit :

Any solutions for this issue?

On 26 Nov 2015 15:44, "ants [via AspectJ]" <[hidden email]> wrote:
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.


If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
To unsubscribe from Is It Possible For Two PointCut To Go Infinite Loop?, click here.
NAML


View this message in context: Re: Is It Possible For Two PointCut To Go Infinite Loop?
Sent from the AspectJ - users mailing list archive at Nabble.com.

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

Alexander Kriegisch-2

Usually you get a StackOverflowError if you have en endless recursion or circular call problem. Is that what you are seeing?

--
Alexander Kriegisch
http://scrum-master.de
 
 
Frank Pavageau schrieb am 28.11.2015 19:08:

Well, have you tried attaching a debugger to see if it actually loops infinitely? Or even doing a simple thread dump? You can use the jstack CLI for that.

If you're trying to use aspects, that should be accessible.

Regards,
Frank

Le 28 nov. 2015 18:25, "ants" <[hidden email]> a écrit :

Any solutions for this issue?

On 26 Nov 2015 15:44, "ants [via AspectJ]" <[hidden email]> wrote:
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.
 
If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
To unsubscribe from Is It Possible For Two PointCut To Go Infinite Loop?, click here.
NAML

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

Andy Clement
In reply to this post by ants
I work better with complete failing samples rather than just the aspects. I’m not sure what the actual code looks like that you are running it against - I can guess but that doesn’t mean there isn’t a quirk in your code that is causing an infinite loop. I created something that your aspect would apply to and it worked just fine for me. I will say that if your advice is not calling back into your code that matches the pointcuts, I’m not sure you need the cflow() wrappers. Just using !within(GuavaAspect) would work, but if your GuavaAspect is not in com.google then you wouldn’t need that anyway because of your within(com.google..*) clauses.

cheers,
Andy


On Nov 28, 2015, at 9:09 AM, ants <[hidden email]> wrote:

Any solutions for this issue?

On 26 Nov 2015 15:44, "ants [via AspectJ]" <<a href="x-msg://33/user/SendEmail.jtp?type=node&amp;node=4651992&amp;i=0" target="_top" rel="nofollow" link="external" class="">[hidden email]> wrote:
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.


If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
To unsubscribe from Is It Possible For Two PointCut To Go Infinite Loop?, click here.
NAML


View this message in context: Re: Is It Possible For Two PointCut To Go Infinite Loop?
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Is It Possible For Two PointCut To Go Infinite Loop?

ants

Thanks for the reply.

I'm actually running my UftTest class of guava with my aspects. As you said only this particular class is not ending the execution at all. Other test classes of guava works fine.

I'm yet to attach a debugger and find a root cause for it.

On 4 Dec 2015 01:42, "Andy Clement" <[hidden email]> wrote:
I work better with complete failing samples rather than just the aspects. I’m not sure what the actual code looks like that you are running it against - I can guess but that doesn’t mean there isn’t a quirk in your code that is causing an infinite loop. I created something that your aspect would apply to and it worked just fine for me. I will say that if your advice is not calling back into your code that matches the pointcuts, I’m not sure you need the cflow() wrappers. Just using !within(GuavaAspect) would work, but if your GuavaAspect is not in com.google then you wouldn’t need that anyway because of your within(com.google..*) clauses.

cheers,
Andy


On Nov 28, 2015, at 9:09 AM, ants <[hidden email]> wrote:

Any solutions for this issue?

On 26 Nov 2015 15:44, "ants [via AspectJ]" <[hidden email]> wrote:
Sorry this the right code:

aspect GuavaAspect{
       
        public boolean trackState;
        declare precedence : GuavaAspect, *;
        protected pointcut traceMethods() :(execution(* junit.framework.TestCase+.*(..))&& within(com.google..*) && !cflow(within(GuavaAspect)));
        protected pointcut traceMethods2() :(execution(* *(..)) && within(com.google..*) && !cflow(within(GuavaAspect)));
       
        before() : traceMethods2() {
                        if(trackState){
                                //do something here
                        }
                }
        before() : traceMethods() {
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                trackState=true;
                        }
                }
        }
        after()  : traceMethods(){
                trackState=false;
                Signature sig = thisJoinPointStaticPart.getSignature();
                String testCaseName=sig.getName();
                if(testCaseName.length()>=4){
                        String test=testCaseName.substring(0, 4);
                        if(test.equals("test")){
                                try{
                                        //write to file
                                }
                                catch(Exception e){
                                        e.printStackTrace();
                                }
                        }
                }
        }
        }

forgot to add the pointcut on com.google source package. The idea is to track the list of methods happening inside a test case and write to a file.


If you reply to this email, your message will be added to the discussion below:
http://aspectj.2085585.n4.nabble.com/Is-It-Possible-For-Two-PointCut-To-Go-Infinite-Loop-tp4651983p4651987.html
To unsubscribe from Is It Possible For Two PointCut To Go Infinite Loop?, click here.
NAML


View this message in context: Re: Is It Possible For Two PointCut To Go Infinite Loop?
Sent from the AspectJ - users mailing list archive at Nabble.com.
_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users

_______________________________________________
aspectj-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/aspectj-users
Loading...