question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Graal app falsely reports of duplicate routes after running Graal Tracing Agent

See original GitHub issue

I 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

  1. Create app via cli: mn create-app micronaut-two --lang=kotlin --features=graal-native-image
  2. Create a kotlin data class (in this case, I called it DepartureRow), then create a Controller:
@Controller("/invoices")
class InvoiceGenerator {
    @Post("/generate")
    fun generate(@Body departures: List<DepartureRow>) = "data size: ${departures.size}"
}
  1. Run ./gradlew assemble
  2. 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
  1. POST an empty JSON array to locahost:8080/invoices/generate, then close the app
  2. Run ./gradlew assemble again (to make /build folder pick up files generated by tracing agent)
  3. Run native-image --no-server -cp build/libs/micronaut-two-*-all.jar
  4. Run the resulting executable: ./micronaut-two, and POST empty JSON array to it again. If you’re using httpie, 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:open
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
graemerochercommented, Oct 3, 2019

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.

0reactions
doctorpanglosscommented, Feb 8, 2020

I also experience this issue. It’s a pretty common part of the workflow.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found