Skip to content

Queues. "memory" parameter is not working as expected. #56077

@guram-vashakidze

Description

@guram-vashakidze

Laravel Version

10.48.28

PHP Version

8.2

Database Driver & Version

No response

Description

Hello,

I had to implement my own internal queue handler to replace queue:work. In my handler, I use ini_set to set a memory limit. However, I encountered an issue where some tasks stopped executing due to memory restrictions. At the same time, the configured memory limit did not change. For queue:work I used the --memory=512 parameter.
As a result, I decided to check the logs in Kibana (where I also record memory_get_peak_usage), and it turned out that many tasks exceeded the specified limits by a significant margin.
I would be interested to know the purpose of the --memory parameter in Laravel's queue handler. I assumed it was a memory limit for the tasks, wasn't it?

Steps To Reproduce

  1. Setup simple job, with memory overloading. For example:
while(true) {
    $arr[] = mt_rand();
}
  1. Set this job into queue
  2. Run queue handler with memory parameter. For example: php artisan queue:work --queue=<your-queue-name> --memory=50
  3. See how your memory overloaded

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions