Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

queue:work ignores --memory parameter #25738

Closed
Yahav opened this issue Sep 22, 2018 · 5 comments
Closed

queue:work ignores --memory parameter #25738

Yahav opened this issue Sep 22, 2018 · 5 comments

Comments

@Yahav
Copy link

Yahav commented Sep 22, 2018

  • Laravel Version: 5.7.5
  • PHP Version: 7.2.9
  • Database Driver & Version: mariaDB 5.5.60
  • Queue Driver: beanstalkd 1.10-2
    pda/pheanstalk v3.2.1

Description:

I;m running the queue:work through supervisor with the following command:
artisan queue:work --memory=100 --queue=reportProcessing --sleep=3 --tries=3
In actuality, the processes start at around 400mb (which on itself is too high).
anyway, you would expect that after one job the worker will quite, which doesn't happen.
they will never be shutdown and eventually will reach huge amount of memory.
https://i.imgur.com/2iHwSNz.png

@sisve
Copy link
Contributor

sisve commented Sep 22, 2018

This would happen if the application is down for maintenance, the workers are paused, or you are subscribing to the Looping event and return false. If neither of these scenarios match, can you tell us what memory_get_usage(true) returns, and make sure it matches with the observed memory usage (or at least above your memory limit)?

@Broutard
Copy link
Contributor

Broutard commented Sep 28, 2018

Please provide the results of

Queue::looping(function () {
     dump((memory_get_usage(false)/1024/1024) . ' : ' . (memory_get_usage(true)/1024/1024));
});

The second value (real usage) should never exceed your --memory limit.
If your jobs correctly free the memory, it's normal.

@driesvints
Copy link
Member

Closing this issue because it's already solved, old or not relevant anymore. Feel free to reply if you're still experiencing this issue.

@derotune
Copy link

Im still facing the same or similar issue. I used the --memory parameter together with supervisor and the work command like this:
command=php /var/www/artisan queue:work --sleep=1 --timeout=100 --memory=512

However, a quite big job still fails with the "Allowed memory size of 134217728 bytes exhausted (tried to allocate 5988352 bytes)". What makes me thing that the memory option does not work is the message. It says "of 134217728 byes" which is 128MB, which is the default value of the memory parameter. In the php.ini memory_limit is also set to 512M.

@Broutard
Copy link
Contributor

@derosavage The queue limit works only between two jobs but not within your job.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants