Skip to content

Breakpoint in HTML DSL with Ktor-Server causes IntelliJ Debugger to hog memory and hang with "Collecting data" message #149

Open
@lehnerpat

Description

@lehnerpat

Reproduction Steps

  • Have a Gradle project with Kotlin (JVM), Ktor and ktor-html-builder / kotlinx-html open in IntelliJ IDEA
  • Use call.respondHtml() to build the response using HTML DSL, as describe here on the Ktor docs
  • Place a breakpoint somewhere in the HTML DSL (see screenshot for example)
    • Note: this is inside of a suspend function
  • Trigger the route with a matching request

Expected Result

  • The IDE stops at the breakpoint
  • The debugger shows the values of any variables in scope in the "Variables" section, like any other regular breakpoint

Actual Result

  • The IDE stops at the breakpoint
  • The debugger shows the (names of the) variables in the "Variables" section
  • But no values are shown at first; instead, the text "Collecting data..." is shown
  • (Note: in some situations, I have observed that not even the list of variables is shown immediately, instead showing a single "Collecting data..." in its place)
  • The debugger takes several minutes, during which CPU usage is very high (>80% of multiple cores) and memory usage keeps increasing (the IDE shows a hint at some point that its allocated memory is insufficient).

hanging-debugger

Further Notes

Version Info:

  • OS: macOS 10.15.4
  • IDE: IntelliJ IDEA 2020.1.1 (Community Edition) (Build #IC-201.7223.91, Runtime version: 11.0.6+8-b765.40 x86_64, VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o)
  • JDK: adopt-openjdk-1.8.0_252
  • Kotlin: observed on 1.3.70 and 1.3.72
  • Ktor-server: 1.3.2 with ktor-server-netty engine
  • kotlinx-html: 0.7.1

Reproduction Example

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