-
Notifications
You must be signed in to change notification settings - Fork 86
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
Synchronise JoinPointImpl methods dealing with Stack<AroundClosure> #129
Conversation
If we do not synchronise, we will run into problems with nested around-aspects in combination with proceeding asynchronously (in another thread). Fixes eclipse-aspectj#128. Signed-off-by: Alexander Kriegisch <[email protected]>
@aclement, WDYT about synchronising those 4 methods completely. Does that have to be any more fine-granular in your opinion due to performance considerations? Continuing the manual tests from #128 (comment), running the same 4 scenarios as in 1.9.2, i.e.
we see the following logs after commit a3e3680:
Before committing the changes, I had only tested scenario 4, falsely thinking that if that one works, the others would too. That tells us that the synchronisation (alone) does not solve the problem. That this build passed also tells us that we have insufficient test coverage. I am going to inspect the problem further. |
I think I am beginning to understand the situation better now. I think the stack exhaustion problem tells us:
Local tests for all 4 scenarios after commit 1584914 are looking good, and the log output is exactly what I would expect in each case:
But I have not analysed yet if this all works in combination with before/after advice types. As a first indicator, let us wait for the GitHub CI build to finish. Update: OK, the build failed, so I messed something up. Let me check... |
Otherwise, we would jeopardise asynchronous proceeding, see eclipse-aspectj#129 (comment) Instead, we - keep the stack, - but treat it like a list (Stack implements the List interface), - keeping a current closure index, - using 'get(currentArcIndex)' instead of `peek()` and `pop()`. Fixes eclipse-aspectj#128. Signed-off-by: Alexander Kriegisch <[email protected]>
Fixes eclipse-aspectj#128. Signed-off-by: Alexander Kriegisch <[email protected]>
I haven't read it all thoroughly - it will take me a long while to get back in the zone with that code. So I will leave my immediate early thoughts:
Now both of those things are based on how JVMs were when it was written a hundred years ago and it may be, like the test that measures the benefit of inlining around advice, it doesn't matter anymore due to JVM efficiency. |
It isn't quite clear to me if you removed the 'no stack' variant because you had to or because you were trying to introduce consistency and just want to remove the optimization it was attempting? |
I would not even have touched that code, had I thought that you might find time to tackle it. But I am curious and it is a good challenge to try and understand it a bit better. Like I said, the code is not meant to be merged yet and maybe never will. I created the PR mainly because I want the CI build results and your feedback. I have local variants of it with and without synchronisation, with and without stack. Once we found a solution covering both the old test cases and my new ones (not incorporated into AspectJ yet), we can revert or optimise whatever didn't contribute to the fix. Today I am blocked by a maintenance power outage in my area for several hours. If in the meantime you feel like taking a shot, I would be happy. Otherwise I continue playing when I get around to it next time. I just wish someone would give me a brief introduction to the interplay of classes there. They are not well documented, and the code is not quite self-explanatory. |
I just wanted to see if removing it would make more of my tests pass and reduce complexity. Optimisations are often a source of corner case problems. If we find out that there is no problem, we can always revert. I am just poking at code I do not fully understand with sticks and see what happens. I am creating data here, the test logs are quite insightful. Either it helps me fix the problem in the end, or maybe it helps you fix it faster than when starting from zero. Your time for AspectJ is more limited than mine, otherwise the only sensible approach would be pair programming in order to maximise learning and yield a second person who can maintain that code in the future. But I guess, the pair programming ain't a-gonna happen, so I am experimenting by myself in public, documenting my steps, at the danger of embarrassing myself. But I am not afraid of that, if I can learn something or at least help you a tiny bit. |
Sometimes just doing nothing for a day is helpful. This morning, I woke up and the answer just came to me - or so I am thinking. I am going to try something in a new branch. If that works, I am going to close this PR and open a new one. Stay tuned. Either way, the experiments here served a purpose. I learned something by doing and I got your valuable feedback, @aclement. |
Superseeded by #132, therefore closing here. |
If we do not synchronise, we will run into problems with nested around-aspects in combination with proceeding asynchronously (in another thread).
Fixes #128.
Work in progress, because it needs