Skip to content

HandleEntrySchedule dispatched every minute causes memory spikes / OOM in multi-process environments #1437

@ekayaci

Description

@ekayaci

Environment

  • Statamic v6.3.x
  • Eloquent driver
  • Laravel Cloud

Problem

HandleEntrySchedule is unconditionally dispatched every minute in AppServiceProvider:

$this->app->make(Schedule::class)->job(HandleEntrySchedule::class)->everyMinute();

There's no way to disable it via config. On its own this is manageable, but it becomes a real problem when combined with other scheduled Schedule::command(...) tasks.

When Laravel runs a Schedule::command() task, it spawns a subprocess — a full php artisan invocation. That subprocess bootstraps the entire Laravel + Statamic stack in memory. On my setup, Statamic's service providers (eloquent driver, CP routes, Antlers, event listeners, etc.) consume ~350MB on boot.

If I have other scheduled tasks, I end up with (n x 350MB) memory usage.

Combined, this exceeds my pod's memory limit and it gets OOM-killed.

The deeper issue is that Statamic's service providers boot the full web stack in every PHP process — even pure CLI/queue processes that never serve a web request — but I understand that's a bigger architectural change. For now, the simple fix would just be an opt-out flag.


Requested fix

A config flag to disable the HandleEntrySchedule scheduler registration:

// config/statamic/system.php
'entry_schedule_enabled' => env('STATAMIC_ENTRY_SCHEDULE_ENABLED', true),
// Statamic AppServiceProvider
if (config('statamic.system.entry_schedule_enabled')) {
    $this->app->make(Schedule::class)->job(HandleEntrySchedule::class)->everyMinute();
}

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