Skip to content

watchdog reloader uses excessive CPU #3054

Closed

Description

@raylu

the watchdog reloader calls run_step every second by default

self.run_step()

on our project with 13,000 files, this causes os.path.isfile to take 15% of a CPU core

I ran py-spy record --pid ... --output profile.speedscope.json --format speedscope for about 8 seconds on an idle app. you can place profile.speedscope.json into https://www.speedscope.app/ and see 8 calls to run() which take about 150ms each:
Image

increasing ReloaderLoop.interval helps a lot, but means reloads have to wait for the next iteration


Environment:

  • Python version: 3.12.7
  • Werkzeug version: 3.0.6

Activity

  1. added this to the 3.1.4 milestone on Nov 27, 2025
  2. locked as resolved and limited conversation to collaborators on Dec 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions