Skip to content

Instantly share code, notes, and snippets.

@chrispian
Created January 23, 2025 23:33
Show Gist options
  • Save chrispian/ea62ba268fbc790ef357a4f463d4f1cd to your computer and use it in GitHub Desktop.
Save chrispian/ea62ba268fbc790ef357a4f463d4f1cd to your computer and use it in GitHub Desktop.
HELP NEEDED: Laravel Jobs Running When Queues Are Stopped and Old Code Is Being Run

I'm on a project at work and running into a very weird problem. The issues are:

  • Even when I stop supervisor and queue a job, the job gets executed
  • The job fails and in the stacktrace the exception caught is OLD code. I modified a vendor file as part of debubbing another problem and the new verbiage for the exception (line 288). I changed the verbiage and moved the exeption to another line but it still shows line 288 in the failed jobs log

Things We've Tried

  • Cleared all caches (opcode, config, route, view, Laravel, and composer caches).
  • Restarted PHP-FPM.
  • Restarted queue workers and supervisor.
  • Rebooted the server.
  • Manually added debugging to vendor/phpoffice/phpspreadsheet/src/PhpSpreadsheet/Reader/Csv.php.
  • Renamed Csv.php to Csv.bak and confirmed a file-not-found error as expected.
  • Verified permissions and ownership of all directories and files involved.
  • Tested manually by reading the file outside of the queue process.
  • Verified the queue:work --once process.
  • Checked logs extensively, focusing on temporary file paths and content previews.
  • Cleared and reinstalled vendor directory using composer install.
  • Disabled OPcache temporarily to rule out cached bytecode.
  • Manually processed the file without queueing (direct Excel::import).
  • Confirmed TemporaryFile::copyFrom was syncing the correct file and location.

What we think we know:

  • This system has been working fine for 2 years
  • Adding a throw at the start of the Csv.php method works when not queued but is ignored in queued jobs.
  • Queued jobs still run old code in Csv.php, showing an outdated exception on line 288.
  • Queue workers are definitely stopped, and there are no rogue queue processes running.
  • The issue is reproducible in Tinker, ruling out browser-specific issues.
  • Temporary files are created and synced correctly, with valid file content.
  • The problem is isolated to queued processes, where modified vendor code is not reflected.
  • The staging environment has the correct file and directory permissions, and manual processing works.
  • OPcache and queue caches were cleared multiple times without resolving the issue.
  • No other environments (e.g., production) share the same queue database, ensuring isolation.
  • This works fine locally and on production
  • Jobs appear in the jobs table but fail almost immediately with the outdated exception.

Help?

If you have any ideas on things to try, I would love to hear them. I'm totally stumped on this one. The root issue we were trying to track down was with Laravel Excel suddently throwing an error saying the temp CSV it creates is not a valid spreadsheet file. I'm sure I can track down the CSV issue but I'm completely stumped on how this old code is running.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment