Technology1 min read

Slow Job Alerts and Replica Commit IDs in Laravel 13.40

By · Published by Everything Blog

In short

Laravel version 13.40.0 introduces monitoring callbacks that trigger whenever scheduled commands or background queue jobs run past configured execution time limits. Developers can now utilize database commit ID verification across major SQL systems to determine precise replication states instead of guessing synchronization delays. The release also implements connection handling patches for lock wait timeouts and lost database connections. Furthermore, a critical patch was issued to resolve a remote code execution vulnerability involving output handling inside the Concurrency process driver.

Key points

  • Direct commit ID tracking allows applications to verify read replica synchronization inst…: Direct commit ID tracking allows applications to verify read replica synchronization instead of depending on estimated lag measurements.
  • Framework routing now includes helper functions to inject custom middleware directly befo…: Framework routing now includes helper functions to inject custom middleware directly before or after core middleware layers.
  • Upgrading eliminates a remote code execution vulnerability connected to output handling w…: Upgrading eliminates a remote code execution vulnerability connected to output handling within the framework Concurrency process driver.

Sources checked by our analysis pipeline: 1

The Laravel team released v13.40.0 with callbacks for queue jobs and scheduled tasks that run too long, commit IDs for checking whether a read replica has a write, insertBefore()

and insertAfter()

for the middleware stack, a strict

flag on request input helpers, and a security fix for the Concurrency

process driver.

Queue::whenJobRunsLongerThan()

andSchedule::whenTaskRunsLongerThan()

DB::getLastCommitId()

andDB::hasCommitId()

for read replicas- Insert middleware before or after a built-in middleware

- A

strict

flag forinteger()

,float()

,boolean()

, andstring()

- Signed result output for

Concurrency::run()

with the process driver - Transaction fixes for lost connections and lock wait timeouts

Alerts for Long-Running Jobs and Scheduled Tasks

Jack Bayliss added Queue::whenJobRunsLongerThan()

, which runs a callback when a job attempt takes longer than a threshold. Laravel already has DB::whenQueryingForLongerThan()

and similar methods for requests and commands, but not for queued jobs:

use Carbon\CarbonInterval; use Illuminate\Support\Facades\Queue; Queue::whenJobRunsLongerThan(CarbonInterval::seconds(90), function ($job, $duration) { Log::warning("{$job->resolveName()} took {$duration}ms"); });

The callback listens to the JobAttempted

event, so it also runs for attempts that fail or are released. A plain number is read as milliseconds, and the duration passed to the…

Technology