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

Timeout in AspectProcessor.injectDispatchInParentAspects when the maven plugin is used #70

Open
lmouline opened this issue Feb 25, 2019 · 3 comments

Comments

@lmouline
Copy link

lmouline commented Feb 25, 2019

When I use the maven plugin, I got some timeout errors in AspectProcessor.injectDispatchInParentAspects method. More precisely, when the processor is waiting the generation of a parent class (cf. Aspect.xtend#L882). Dispatch methods in some of my parent classes do not consider some of child classes.

I don't have any problem while executing the code using the Eclipse build system: dispatch methods in parent classes are well generated.

I tried to execute the maven build in multi-thread, but the problem is still there.
I also tried to put a waiting loop in the writing method (Helper.writeContentsIfNew) but it didn't fix the problem.

lmouline pushed a commit to lmouline/aintea that referenced this issue Feb 25, 2019
lmouline pushed a commit to lmouline/aintea that referenced this issue Feb 25, 2019
@dvojtise
Copy link
Contributor

Mmh maybe xtend when run in the Eclipse IDE is doing some job in parallel and doesn't in maven...

we don't have much control over the order in which xtend do the processing of xtend files and its active annotations.

do you have some small example that you can archive in order to reproduce the issue?

@lmouline
Copy link
Author

lmouline commented Feb 26, 2019

timeout-error-k3-master.zip
Here a "small" failing project: lmouline/timeout-error-k3

And the problem is visible here: https://travis-ci.org/lmouline/timeout-error-k3/jobs/498801812#L1820

@dvojtise
Copy link
Contributor

dvojtise commented Feb 27, 2023

I've recently looked into this issue.

Apparently in maven, the xtend compilation isn't parallel, so the order in which it takes into account the *.xtend files is important. And this problem mainly occurs because the K3 aspect are split in many individual xtend files instead of one big xtend file (BTW I think that splitting in individual files is a good practice. We do need to support it correctly...)

The timeout occurs because the k3 annotation tries to inject the dispatch code for a child class in the parent class. But the parent class hasn't been generated yet, so it waits for it and fail.

One solution would be to make sure the xtend compilation process the code generation in a specific order (parent first, then childs). However, I haven't seen a simple way to achieve that using xtend API.
Another solution would be to implement a command pattern in order to postpone the injection when it will be really possible (Ie if child is called before the parent, then create a command that'll inject the dispatch code, when the parent is created, apply the command previously created; if parent is called before, when the child is called, directly inject the dispatch code in the parent)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants