Skip to content

WindsurfCustomizationWatcher thread consumes excessive CPU (46,000+ seconds) in IntelliJ plugin #301

@ymajoros

Description

@ymajoros

Bug Report

Summary

The WindsurfCustomizationWatcher thread in the Windsurf IntelliJ plugin enters a hot loop and consumes an extreme amount of CPU time, even when the IDE is idle and no active tasks are running.

Environment

  • Plugin version: 2.13.21 (codeium-2.13.21.jar)
  • IDE: IntelliJ IDEA 2025.3.2 (build 253.30387.90)
  • OS: Linux 6.14.0-1020-oem x86_64 (Ubuntu)
  • JVM: OpenJDK 21.0.9+10-b1163.94

Observed behavior

After running IntelliJ for ~13 hours, the WindsurfCustomizationWatcher thread had accumulated over 46,500 seconds of CPU time — by far the highest of any thread in the process. The main IntelliJ process was reporting ~80–100% CPU usage despite no active user work.

jstack output for the offending thread:

"WindsurfCustomizationWatcher" #290 [1516551] daemon prio=5 os_prio=0 cpu=46509381.81ms elapsed=47022.17s tid=0x000058d90a109430 nid=1516551 runnable  [0x000074782f9fd000]
   java.lang.Thread.State: RUNNABLE
	at java.util.concurrent.LinkedBlockingDeque.take(java.base@21.0.9/LinkedBlockingDeque.java:673)
	at sun.nio.fs.AbstractWatchService.take(java.base@21.0.9/AbstractWatchService.java:118)
	at com.intellij.platform.core.nio.fs.MultiRoutingWatchServiceDelegate.take(MultiRoutingWatchServiceDelegate.java:41)
	at com.codeium.intellij.settings.WindsurfFileConfigWatcher$setupCustomizationWatchers$2.invoke(WindsurfFileConfigWatcher.kt:130)
	at com.codeium.intellij.settings.WindsurfFileConfigWatcher$setupCustomizationWatchers$2.invoke(WindsurfFileConfigWatcher.kt:127)
	at kotlin.concurrent.ThreadsKt$thread$thread$1.run(Thread.kt:30)

Analysis

The thread is supposed to be blocking on WatchService.take() waiting for filesystem events in WindsurfFileConfigWatcher.kt (line 127–130). However, it appears the MultiRoutingWatchServiceDelegate is returning immediately or spinning rather than blocking, causing a busy-wait loop that consumes an entire CPU core over time.

Secondary effects observed:

  • G1 GC threads (Conc#0/1/2) also showing elevated CPU, likely driven by garbage generated by the spin loop
  • Overall system load average: ~6.2 on a 16-core machine

Steps to reproduce

  1. Install Windsurf plugin 2.13.21 in IntelliJ IDEA 2025.3.x on Linux
  2. Open IntelliJ with a project
  3. Leave idle for several hours
  4. Run jstack <intellij-pid> and check WindsurfCustomizationWatcher CPU time
  5. Observe excessive accumulated CPU time

Expected behavior

The WindsurfCustomizationWatcher thread should block indefinitely on WatchService.take() when no filesystem events are occurring, consuming near-zero CPU while idle.

Workaround

Disabling the Windsurf plugin resolves the issue.

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