Graal app falsely reports of duplicate routes after running Graal Tracing Agent
See original GitHub issueI created a micronaut app with an aim to convert it to native app. So far, the application works fine when running as a regular Java program. However, after running graalvm
tracing agent to generate graalvm
config files, the app strangely reports of duplicate routes, when there’s only one route in the entire app.
Steps to Reproduce
- Create app via cli:
mn create-app micronaut-two --lang=kotlin --features=graal-native-image
- Create a kotlin data class (in this case, I called it
DepartureRow
), then create aController
:
@Controller("/invoices")
class InvoiceGenerator {
@Post("/generate")
fun generate(@Body departures: List<DepartureRow>) = "data size: ${departures.size}"
}
- Run
./gradlew assemble
- Run the app with tracing agent enabled (replacing
/PATH/TO/APP
with your own path):
java -agentlib:native-image-agent=config-output-dir=/PATH/TO/APP/micronaut-two/src/main/resources/META-INF/native-image -jar build/libs/micronaut-two-*-all.jar
POST
an empty JSON array tolocahost:8080/invoices/generate
, then close the app- Run
./gradlew assemble
again (to make/build
folder pick up files generated by tracing agent) - Run
native-image --no-server -cp build/libs/micronaut-two-*-all.jar
- Run the resulting executable:
./micronaut-two
, andPOST
empty JSON array to it again. If you’re usinghttpie
, you can do:
echo '[]' | http POST localhost:8080/invoices/generate --json
Expected Behaviour
The app should return a string: data size: 0
Actual Behaviour
The app returns HTTP 400:
{
"_links": {
"self": {
"href": "/invoices/generate",
"templated": false
}
},
"message": "More than 1 route matched the incoming request. The following routes matched /invoices/generate: POST - /invoices/generate, POST - /invoices/generate"
}
Environment Information
- Operating System:
./gradlew -version
------------------------------------------------------------
Gradle 5.5
------------------------------------------------------------
Build time: 2019-06-28 17:36:05 UTC
Revision: 83820928f3ada1a3a1dbd9a6c0d47eb3f199378f
Kotlin: 1.3.31
Groovy: 2.5.4
Ant: Apache Ant(TM) version 1.9.14 compiled on March 12 2019
JVM: 1.8.0_222 (Oracle Corporation 25.222-b08-jvmci-19.2-b02)
OS: Mac OS X 10.14.6 x86_64
- Micronaut Version:
1.2.3
- JDK Version:
java -version
openjdk version "1.8.0_222"
OpenJDK Runtime Environment (build 1.8.0_222-20190711112007.graal.jdk8u-src-tar-gz-b08)
OpenJDK 64-Bit GraalVM CE 19.2.0.1 (build 25.222-b08-jvmci-19.2-b02, mixed mode)
Example Application
The app can be found here. FYI, the project already has all kotlin classes and config files, so you can start from step 6 onward.
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Assisted Configuration with Tracing Agent - GraalVM
During execution, the agent interfaces with the Java VM to intercept all calls that look up classes, methods, fields, resources, or request proxy...
Read more >graalvm/native-image - Gitter
Now the build is failing on running a native-image with this command ./gradlew dockerBuildNative . Failing build is here: https://github.com/conorfennell/ ...
Read more >Past Agent Releases - AppDynamics Documentation
Version 21.3.0 – March 25, 2021. This release includes the following enhancements: The Analytics Agent bundled in Machine Agent 20.8 ...
Read more >Introducing the Tracing Agent: Simplifying GraalVM Native ...
json files by observing the application behavior when running on the Java HotSpot VM, i.e., when running the application not as a native...
Read more >Table of Contents - Micronaut Documentation
Micronaut is a modern, JVM-based, full stack Java framework designed for building modular, easily testable JVM applications with support for Java, Kotlin and ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
For reference you should not need to run the tracing agent on a Micronaut application since Micronaut is reflection free. If you are having an issue with a third party library then use the tracing agent but generate the files into a separate directly and select only the output that relates to the library.
I also experience this issue. It’s a pretty common part of the workflow.