-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
@ConsumeEvent annotated method is called twice per message when generic parent class has an abstract method for it #29585
Comments
cc @mkouba |
Actually, I'm not able to reproduce the problem in the development mode even with
|
@benjaminrau Hm, but the test failed and I can reproduce the issue in the production mode. Interesting. |
@mkouba Maybe i understand you wrong but if you wonder why the test fails that might be probably misleading by me: I made the test fail until the bug is fixed. When the bug is fixed it should pass (only one consumer on the address is the expected bahaviour) Ah, missed the first comment of yours. Actually i didnt check the issue for explicit mode, so i didnt notice there is no issue in dev mode. Does NonNull make any difference at all? I will check that right now. It was just there from another (the last) reproduces if built few days ago. |
I justed tested it and NonNull makes no difference here to me. The issues persists. Ive updated the reproducer (removed NonNull) to not be misleading there. Furthermore i am not sure if you mean by development mode anything else that what the log states - if no, the issue is there for me on dev too:
|
@benjaminrau #29620 should fix the problem. It would be great if you could give it a try. |
It seems that the compiler used in the dev mode does not copy the annotations from the original method to the generated bridge method. |
@mkouba I'd really love to but i have to admit that i dont know how to include quarkus at the given commit hash on my repo. Is there probably some documentation you could refer to how to do so? |
Oh, sorry. There are some tips in the readme. You would need to clone the project, then checkout the pull request branch, then build with something like |
@mkouba Will try later today, will let you know whether i was successful or not. Thanks for the hints! Looks quite interesting! |
@mkouba Following the steps i cant reproduce the issue any longer :) It seems you are fixing bugs faster than i am able to describe them. Incredible! Wants again you (Quarkus team) leave me stunned about the experience when reporting (possible) issues here on github. Offtopic: Is there an easy explanation for that?
|
Hm, I thought that "Possible heap pollution" is a compiler warning... not an error. |
- fixes quarkusio#29585 (cherry picked from commit b1664aa)
- fixes quarkusio#29585 (cherry picked from commit b1664aa)
- fixes quarkusio#29585 (cherry picked from commit b1664aa)
Describe the bug
Having a class extending a class with generics which has an abstract method for the consumer method, this will result in the method annotated with
@ConsumeEvent
on the extending class to be called twice per eventbus message.Expected behavior
Its expected that a method annotated with
@ConsumeEvent
is invoked only once per message.public abstract void consume(@NonNull T event);
fromGreetingService
Actual behavior
Having a class extending a class with generics which has an abstract method for the consumer method, this will result in the method annotated with
@Consume
on the extending class to be called twice per eventbus message.consuming HelloEvent on HelloService: ee73ab41-6b9a-465a-967c-d264046e0cc0
How to Reproduce?
Reproducer:
Ive also prepared a test which shows that the consumer is registered twice in Vertx HandlerMap:
https://github.com/benjaminrau/genericdoublesconsumer/blob/master/src/test/java/org/acme/EventBusTest.java
Output of
uname -a
orver
Linux br-builders-nb 5.14.0-1052-oem #59-Ubuntu SMP Fri Sep 9 09:37:59 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Output of
java -version
openjdk version "17" 2021-09-14 OpenJDK Runtime Environment (build 17+35-2724) OpenJDK 64-Bit Server VM (build 17+35-2724, mixed mode, sharing)
GraalVM version (if different from Java)
No response
Quarkus version or git rev
2.14.2.Final
Build tool (ie. output of
mvnw --version
orgradlew --version
)No response
Additional information
The log output clearly shows that the consumer is called twice for the same message since the payload is a randomized UUID string.
The text was updated successfully, but these errors were encountered: