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

Do not clone jobs #222

Merged
merged 3 commits into from
Nov 14, 2023
Merged

Do not clone jobs #222

merged 3 commits into from
Nov 14, 2023

Conversation

yhabteab
Copy link
Member

Fixes a daemon crash when reloading the configs after 5m.

Removing schedule lan Schedules of job lan, as it either no longer exists in the configuration or its config has been changed
PHP Fatal error:  Uncaught InvalidArgumentException: Task lan not scheduled in /usr/local/src/ipl-scheduler/src/Scheduler.php:158
Stack trace:
#0 /usr/share/icingaweb2-modules/x509/application/clicommands/JobsCommand.php(109): ipl\Scheduler\Scheduler->remove(Object(Icinga\Module\X509\Job))
#1 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/ExtEvLoop.php(144): Icinga\Module\X509\Clicommands\JobsCommand->Icinga\Module\X509\Clicommands\{closure}(Object(React\EventLoop\Timer\Timer))
#2 [internal function]: React\EventLoop\ExtEvLoop->React\EventLoop\{closure}()
#3 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/ExtEvLoop.php(208): EvLoop->run(2)
#4 /usr/share/icinga-php/vendor/vendor/react/event-loop/src/Loop.php(55): React\EventLoop\ExtEvLoop->run()
#5 [internal function]: React\EventLoop\Loop::React\EventLoop\{closure}()
#6 {main}
  thrown in /usr/local/src/ipl-scheduler/src/Scheduler.php on line 158

Before Icinga PHP Library `<=0.13.0`, the scheduler was using the PHP
standard `SplObjectStorage`, which automatically generates a unique hash
whenever adding a new task using `attach()`. This hash was generated
internally with `spl_object_hash()`. As a result, when we try to remove
a job from the scheduler that was scheduled e.g `5m` ago (since this is
the default daemon config reload interval), the scheduler crashes with
job `foo` not scheduled.
@cla-bot cla-bot bot added the cla/signed label Nov 13, 2023
@yhabteab yhabteab added the bug Something isn't working label Nov 13, 2023
@yhabteab yhabteab added this to the 1.3.2 milestone Nov 13, 2023
@yhabteab yhabteab self-assigned this Nov 13, 2023
nilmerg
nilmerg previously approved these changes Nov 14, 2023
application/clicommands/JobsCommand.php Outdated Show resolved Hide resolved
@yhabteab yhabteab merged commit b6d2c31 into main Nov 14, 2023
13 checks passed
@yhabteab yhabteab deleted the do-not-clone-jobs branch November 14, 2023 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working cla/signed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants