line / armeria

Your go-to microservice framework for any situation, from the creator of Netty et al. You can build any type of microservice leveraging your favorite technologies, including gRPC, Thrift, Kotlin, Retrofit, Reactive Streams, Spring Boot and Dropwizard.
https://armeria.dev
Apache License 2.0
4.73k stars 899 forks source link

Healthcheck service returning unhealthy between tests if service is reconfigured #5701

Open Dogacel opened 1 month ago

Dogacel commented 1 month ago

This issue is mentioned as a comment here but probably unnoticed:

routeAdded, routeRemoved look useful for HealthCheckService also. At this moment, a newly reconfigured HealthCheckService doesn't work because the service depends on the server's start status:

https://github.com/line/armeria/blob/8ed438da36ba4e0f7d111c00f748b3fcc2906e2c/core/src/main/java/com/linecorp/armeria/server/healthcheck/HealthCheckService.java#L292-L297 And we should remove ServerListener when routeRemoved. It remains and wastes our memory (a little 😅).

Originally posted by @0x1306e6d in https://github.com/line/armeria/issues/3041#issuecomment-1322901060

Minimum reprod:

class STE : FunSpec({
    val server =
        object : ServerExtension(true) {
            override fun configure(sb: ServerBuilder) {
                sb.http(12345)
                    .service("/healthcheck", HealthCheckService.of())
            }
        }
    extensions(JUnitExtensionAdapter(server))

    test("is healthy") {
        val client = server.webClient()

        client.get("/healthcheck").aggregate().join().contentUtf8() shouldBe """{"healthy":true}"""

        server.server().reconfigure {
            it.service("/healthcheck", HealthCheckService.of())
        }

        client.get("/healthcheck").aggregate().join().contentUtf8() shouldBe """{"healthy":true}"""
    }
})
seonWKim commented 2 weeks ago

Maybe we can solve this issue in here or any following issues after it's solved. 🤔