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

Running Redis queues with Supervisor throwing the error - Call to undefined function Moontoast\Math\bcadd() #2326

Closed
harunthuo opened this issue Oct 14, 2019 · 1 comment

Comments

@harunthuo
Copy link

Info:

  • Docker version: Docker version 19.03.2
  • Laradock commit : 04c6aaf3389ebd30e2874788b90437f229effb0b
  • System info: Windows 10 PRO
  • System info disto/version: Docker Desktop for Windows, Version 2.1.0.3 Engine 19.03.2

Issue:

I'm running a Laravel project on Laradock. I have a Job class that handles a Notification class that sends mail. The Job uses Redis for the queue driver and everything is well set up

I have Supervisor all set up and working. Below is my .conf file that is executed by Supervisor when the Job runs:

[program:laravel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/artisan queue:work redis --sleep=3 --tries=5 --daemon
autostart=true
autorestart=true
numprocs=8
user=root
redirect_stderr=true
stdout_logfile=/var/www/worker.log

This is set up in Laradock's php-worker>supervisord.d directory. I also have Laravel Horizon set up to monitor my Redis queues. When the Job is executed, Supervisor runs the Job and this is confirmed in my worker.log file that logs the processing of the Job, as defined in the above .conf file, as shown below:

[2019-10-14 12:18:27][21] Processing: App\Jobs\NewStaffAdded
[2019-10-14 12:18:30][21] Processing: App\Jobs\NewStaffAdded
[2019-10-14 12:18:31][21] Processing: App\Jobs\NewStaffAdded
[2019-10-14 12:18:33][21] Processing: App\Jobs\NewStaffAdded
[2019-10-14 12:18:35][21] Processing: App\Jobs\NewStaffAdded

When i visit my Horizon dashboard, i find that the Job failed. Clicking on the failed Job to learn more details, i get this exception:

Symfony\Component\Debug\Exception\FatalThrowableError: Call to undefined function Moontoast\Math\bcadd() in /var/www/vendor/moontoast/math/src/Moontoast/Math/BigNumber.php:506

Looking around for possible solutions for the above exception, i see suggestions that the cause is absence of the Bcmath module for PHP but I've run the following command and confirmed I have this module:

dpkg --list | grep -i bcmath

Shows I have the Bcmath module for my PHP version(7.3). So don't know why I'm getting the mentioned exception, which is preventing my queue from being executed.


Expected behavior:

My Redis Queues should be executed as expected

@harunthuo
Copy link
Author

The issue was down to not having the Bcmath module in Laradock's .env file under the PHP_WORKER section set to true. Firstly the module has to be installed in your workspace, then turn it on under BOTH the PHP_FPM AND PHP_WORKER sections. My mistake was that i had only set true under PHP_FPM section so had to do the same under PHP_WORKER section

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

1 participant