Open dannemano opened 3 years ago
This issue was accidentally misplaced. Andy McCright placed the following in the StackOverflow thread. This issue should be investigated to potentially provide a better sollution:
StackOverflow post: First, you are 100% correct that you don't need the @Asynchronous annotation on the MP Rest Client interface method - per the MP Rest Client specification, a return type of CompletionStage makes it asynchronous. If you remove the @Asynchronous annotation, it should work.
While investigating the JVM error message, I came across this helpful post that indicates that this message means the JVM encountered a super large exception - probably a StackOverflowError. My guess is that the error occurred because there are now two different asynchronous mechanisms (MP Rest Client and MP Fault Tolerance) playing together - and probably not playing nicely. Without seeing the exception stack trace, we won't know for sure.
I would first suggest removing the annotation and verifying that that works - that is probably a better workaround than using a separate CDI bean. Next, I would suggest opening an issue at https://github.com/OpenLiberty/open-liberty/issues to investigate a better overall solution.
If I annotate a Microprofile REST client with the @Asynchronous, calling the method generates the following output:
[INFO] java.lang.instrument ASSERTION FAILED : "!errorOutstanding" with message transform method call failed at ./src/java.instrument/share/native/libinstrument/JPLISAgent.c line: 873
I wrote a question on Stack Overflow : https://stackoverflow.com/questions/64424384/fault-tolerance-asynchronous-on-microprofile-rest-client-cause-open-liberty-cor
Steps to Reproduce Create a MP Rest client that returns a CompletionStage. Annotate the method with org.eclipse.microprofile.faulttolerance.Asynchronous.
Add extra MP FT annotations, for instance @Timeout and/or @Retry
Expected behavior If MP FT @Asynchronous is not allowed on an already async MP RestClient method, then a helpful error message should be generated, either at build time or run time.
If it should be allowed, then MP FT tolerance functionality should work as explained here:
https://openliberty.io/blog/2020/06/05/asynchronous-programming-microprofile-fault-tolerance-part-2.html
Diagnostic information:
server.xml configuration (WITHOUT sensitive information like passwords) ` <?xml version="1.0" encoding="UTF-8"?>
`