Skip to content

It takes sbt a long time to consume long commands issued by IntelliJ #6644

@RafalSumislawski

Description

@RafalSumislawski

steps

  • clone https://github.com/http4s/http4s (I'm using it as an example because it's large and it's open source, but other projects are affected the same way)
  • Import it in IntelliJ
  • Enable using sbt shell for builds and imports in IntelliJ.
  • open sbt shell panel in IntelliJ
  • Ask IntelliJ to build the project
  • Watch a "slide show" as sbt slowly (~10 seconds) consumes the command issued by IntelliJ. (The command has a few thousands of characters)
  • Also notice 100% utlisation of one CPU core

sbt version 1.5.5 (1.4.0-1.5.5 are affected)
OS: MacOS 11.5.2
IntelliJ 2021.2.1 CE (but the issue isn't related to specific IntelliJ version)

problem

It appears that starting with 1.4.0 sbt started taking much more time to read characters from sbt console.
The issue did not appear with 1.3.x, and it seems unrelated to the version of IntelliJ in use.

On closer inspection with a profiler it appear that the sbt.internal.util.Terminal.ConsoleTerminal#isEchoEnabled is being called for each character read and that on each call it spawns and waits for a new process.

image

expectation

sbt should consume the input in insignificant amount of time like it did in 1.3.x

notes

Handling of echo has been reworked in jline3, so maybe the issue wouldn't appear if jline3 was used in sbt.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions