Misp: Monolog breaking workers

Created on 2 Sep 2019  路  10Comments  路  Source: MISP/MISP

Work environment

| Questions | Answers
|---------------------------|--------------------
| Type of issue | Bug
| OS version (server) | Ubuntu 18.04
| PHP version | 7.2
| MISP version / git hash | 2.4.0396cc5cb3725336c6f3d0ab0097fd238ef7a9f9

Expected behavior

Misp workers should be running.

Actual behavior

The workers are failing to start. It appears to be because the php code in /var/www/MISP/app/Vendor/kamisama/php-resque-ex-scheduler/bin/resque-scheduler.php.
It tries to call $logger->getInstance()->addInfo where the logger is $logger = new MonologInit\MonologInit($LOG_HANDLER, $LOG_HANDLER_TARGET);.

The new major version of Monolog doesn't have this function anymore. It should be in /var/www/MISP/app/Vendor/monolog/monolog/src/Monolog/Logger.php.

Steps to reproduce the behavior

Blank install misp using provided installer INSTALL.sh -c -M.

Logs, screenshots, configuration dump, ...

/var/www/MISP/app/tmp/logs/resque-worker-error.log

Error: Call to undefined method Monolog\Logger::addInfo()
#0 /var/www/MISP/app/Vendor/kamisama/php-resque-ex/lib/Resque/Worker.php(360): Resque_Worker->log('Starting worker...', 200)
#1 /var/www/MISP/app/Vendor/kamisama/php-resque-ex/lib/Resque/Worker.php(194): Resque_Worker->startup()
#2 /var/www/MISP/app/Vendor/kamisama/php-resque-ex/bin/resque(109): Resque_Worker->work('5')
#3 /var/www/MISP/app/Vendor/kamisama/php-resque-ex/bin/resque(100): startWorker('email', 1, Object(MonologInit\MonologInit), '5')
#4 {main}

Monolog launched a new major version 3 days ago which appears to be the reason that the workers are failing to run.
https://github.com/Seldaek/monolog/releases

I will try to get more info and see if there is an easy way this could be updated to work with the latest version. I would like if the MISP install pinned to a particular version of these dependencies to make the install more stable.

I know that this code is from the app/Vendor path which is in the gitignore so maybe I should report this elsewhere. If there is somewhere more relevant then I would appreciate being pointed in the right direction.

bug

Most helpful comment

As a workaround I've downgraded monolog version using composer.
/var/www/MISP/app$ php ./composer.phar require monolog/monolog=1.24.0
And the workers started succesfully.

All 10 comments

It looks like the resque-scheduler comes from here https://github.com/wa0x6e/php-resque-ex
The composer.json in that project is set to require monolog >= 1.2.0.
https://github.com/wa0x6e/php-resque-ex/blob/master/composer.json#L22
A quick fix would be to set monolog == 1.24.0 in a fork of that project. I don't fully understand the process in which the installer pulls down the php-resque-ex code.

As a workaround I've downgraded monolog version using composer.
/var/www/MISP/app$ php ./composer.phar require monolog/monolog=1.24.0
And the workers started succesfully.

@wiredrat - I can confirm that doing the same on Misp-Docker resolved the issue too.

Argh. Thanks for the bug hunt, will have a look tomorrow how we can do this cleanly.

Como soluci贸n, he degradado la versi贸n de monolog usando composer.
/var/www/MISP/app$ php ./composer.phar require monolog/monolog=1.24.0
Y los trabajadores comenzaron con 茅xito.

Hello

I am presenting the same problem that the workers do not initiate me and I already did the two steps but I still have the same difficulty it will be that someone can help me to solve it

thank you.

If anyone runs into this as well the command to downgrade monlog is:
$ su -s /bin/bash www-data -c 'php /var/www/MISP/app/composer.phar require monolog/monolog=1.24.0'

If anyone runs into this as well the command to downgrade monlog is:
$ su -s /bin/bash www-data -c 'php /var/www/MISP/app/composer.phar require monolog/monolog=1.24.0'

Hello

When I give you the command you indicated, I get: su: Authentication failure

Your install might be different, which user owns the /var/www/MISP folder?

I have the same issue for resolve it. I have change my path for /var/www/MISP/app and after launch su -s /bin/bash www-data -c 'php /var/www/MISP/app/composer.phar require monolog/monolog=1.24.0'

Issue resolved and work fine (_thanks to FafnerKeyZee for the tips_)

image

Im getting this

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ufo0531 picture ufo0531  路  4Comments

honey4free picture honey4free  路  3Comments

RichieB2B picture RichieB2B  路  7Comments

fl0x2208 picture fl0x2208  路  4Comments

Rafiot picture Rafiot  路  3Comments