Skip to content

Possible bug Artisan::queue() with queue:work "The option does not exist" #17487

@poppabear8883

Description

@poppabear8883
  • Laravel Version:
    5.3.29
  • PHP Version:
    5.6.27
  • Database Driver & Version:
    mysql Ver 14.14 Distrib 5.7.16, for Linux (x86_64) using EditLine wrapper

Description:

The "--owner" option does not exist.' in /var/www/clients/client4/web9/web/vendor/symfony/console/Input/ArrayInput.php:172

Steps To Reproduce:

Note 1: the command works perfectly fine via terminal manually

# php artisan make:module test --owner=web9 --group=client4 --quick
     0/4 [>---------------------------]   0%
    Warning: Changing owner and group 'web9:client4' for directory /var/www/clients/client4/web9/web/app/Modules/Test
     4/4 [============================] 100%
    Module generated successfully.

Note 2: takeing out --owner and --group the command works:

Artisan::queue('make:module', [
        'slug' => strtolower($name),
        '--quick' => true
]);

Supervisor configuration
Note: The reason that the worker runs as root user is that my jobs/commands require certain tasks to be done as the root user. The nature of this project is a server management interface. Hopefully that sheds some light to the type of methods i am trying to apply.

[program:nxpanel-worker]
process_name=%(program_name)s_%(process_num)02d
command=php /var/www/nxpanel.app/web/artisan queue:work database --sleep=3 --tries=3
autostart=true
autorestart=true
user=root
numprocs=8
redirect_stderr=true
stdout_logfile=/var/www/nxpanel.app/web/worker.log
// Methods that puts the command in queue
/**
 * Creates a module
 *
 * @param array $params
 * @return response
 */
protected function create($params = [])
{
    $validator = $this->valid_for_create($params);
 
    if ($validator->fails())
        return response(['errors' => $validator->failed()], 400);
 
    $owner = trim(exec('whoami'));
    $g = explode(' ', exec('groups'));
    $group = trim($g[0]);
 
    $module = $this->module->create($params['name'], $owner, $group);
    return response($module, 200);
}
 
public function create($name, $owner=null, $group=null)
{
    Artisan::queue('make:module', [
        'slug' => strtolower($name),
        '--owner' => $owner,
        '--group' => $group,
        '--quick' => true
    ]);
 
    return Module::getProperties(strtolower($name));
}
 
// The command signiture
protected $signature = 'make:module
        {slug : The slug of the module}
        {--owner= : The user}
        {--group= : The group}
        {--quick : Skip the make:module wizard and use default values}';
 
// PAYLOAD
{"job":"Illuminate\\Foundation\\Console\\QueuedJob","data":["make:module",{"slug":"test","--owner":"web9","--group":"client4","--quick":true}]}
 
// STACK TRACE
exception 'Symfony\Component\Console\Exception\InvalidOptionException' with message 'The "--owner" option does not exist.' in /var/www/clients/client4/web9/web/vendor/symfony/console/Input/ArrayInput.php:172
Stack trace:
#0 /var/www/clients/client4/web9/web/vendor/symfony/console/Input/ArrayInput.php(134): Symfony\Component\Console\Input\ArrayInput->addLongOption('owner', 'web9')
#1 /var/www/clients/client4/web9/web/vendor/symfony/console/Input/Input.php(62): Symfony\Component\Console\Input\ArrayInput->parse()
#2 /var/www/clients/client4/web9/web/vendor/symfony/console/Command/Command.php(219): Symfony\Component\Console\Input\Input->bind(Object(Symfony\Component\Console\Input\InputDefinition))
#3 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#4 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(821): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#5 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(187): Symfony\Component\Console\Application->doRunCommand(Object(App\Console\Modules\Generators\MakeModuleCommand), Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#6 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(118): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#7 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Console/Application.php(107): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArrayInput), Object(Symfony\Component\Console\Output\BufferedOutput))
#8 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(218): Illuminate\Console\Application->call('make:module', Array)
#9 [internal function]: Illuminate\Foundation\Console\Kernel->call('make:module', Array)
#10 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/QueuedJob.php(36): call_user_func_array(Array, Array)
#11 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(73): Illuminate\Foundation\Console\QueuedJob->fire(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#12 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(203): Illuminate\Queue\Jobs\Job->fire()
#13 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(154): Illuminate\Queue\Worker->process('database', Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#14 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(75): Illuminate\Queue\Worker->runNextJob('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#15 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Worker->daemon('database', 'default', Object(Illuminate\Queue\WorkerOptions))
#16 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(85): Illuminate\Queue\Console\WorkCommand->runWorker('database', 'default')
#17 [internal function]: Illuminate\Queue\Console\WorkCommand->fire()
#18 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Container/Container.php(508): call_user_func_array(Array, Array)
#19 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Console/Command.php(169): Illuminate\Container\Container->call(Array)
#20 /var/www/clients/client4/web9/web/vendor/symfony/console/Command/Command.php(254): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Console/Command.php(155): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(821): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(187): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/clients/client4/web9/web/vendor/symfony/console/Application.php(118): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#25 /var/www/clients/client4/web9/web/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(121): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#26 /var/www/clients/client4/web9/web/artisan(36): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 {main}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions