Skip to content

Auto-reloading breaks server if server request is made too quickly after code change #4717

Open
@dex-max

Description

@dex-max

Ktor version/setup
Ktor Project Generator: Ktor 3.1.1, Netty, Gradle Kotlin, Routing plugin

Issue
I am trying to set up a local environment for developing a Ktor application with auto-reloading. The auto-reloading has been working, but it seems like if a code change is made and then a request to the server is sent immediately after before the compiler is finished, the server breaks.

Usually if the auto-reloading works properly, the following lines are outputted:

INFO Application - Changes in application detected.
INFO Application - Application auto-reloaded in 0.019 seconds.

However if the issue is reproduced then only the first line is outputted and the server does not respond to the request.

Steps to reproduce
New Ktor project from Ktor Project Generator with the settings above.
Enable auto-reload following these steps: https://ktor.io/docs/server-auto-reload.html
Run ./gradlew build --continuous and ./gradlew run
Make a change in code to the router
Immediately send a request to the server (you might have to send 2-3 in a row)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions