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

taskscheduler error when using a dynamic group with a criteria on the fields plugins #781

Open
JulienRemi opened this issue Apr 19, 2024 · 4 comments

Comments

@JulienRemi
Copy link

JulienRemi commented Apr 19, 2024

Describe the bug

The taskscheduler cron throw an error when a task use a dynamic group with a criteria on a field from the fields plugin.

Here is the dynamic group with a rule an a field from the fields plugin :
image
As you can see the rule work and filter the search.

From what I can see in the logs, it seems that it doesn't find the key for the field during the taskscheduler cron. (Logs in Additional context)

To reproduce

  1. Create a dynamic group with a criteria rule on a filed from the fields plugin.
  2. Create a task using this dynamic group
  3. Activate the task
  4. Wait for the cron to launch the taskscheduler

Expected behavior

The taskscheduler doesn't throw an error an the actors in the task are prepared or reprepared based on the dynamic group.

Operating system

Windows

GLPI Agent version

1.7.3

GLPI version

10.0.14

GLPIInventory plugin

1.3.5

Additional context

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 1398
Backtrace :
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 3944
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 3944
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 3945
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 3945
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 3955
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 3955
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 3956
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 3956
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Undefined array key 76728 in C:\inetpub\glpi-10.0.12\src\Search.php at line 3964
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 3964
Backtrace :
src\Search.php:1403 Search::addSelect()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.WARNING: *** PHP Warning (2): Trying to access array offset on value of type null in C:\inetpub\glpi-10.0.12\src\Search.php at line 1414
Backtrace :
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

[2024-03-11 16:25:05] glpiphplog.CRITICAL: *** Uncaught Exception TypeError: Search::computeComplexJoinID(): Argument #1 ($joinparams) must be of type array, null given, called in C:\inetpub\glpi-10.0.12\src\Search.php on line 6213 in C:\inetpub\glpi-10.0.12\src\Search.php at line 9147
Backtrace :
src\Search.php:6213 Search::computeComplexJoinID()
src\Search.php:1410 Search::addMetaLeftJoin()
src\Search.php:848 Search::constructAdditionalSqlForMetacriteria()
...ntory\inc\deploygroup_dynamicdata.class.php:243 Search::constructSQL()
...ntory\inc\deploygroup_dynamicdata.class.php:273 PluginGlpiinventoryDeployGroup_Dynamicdata::getDatas()
...ins\glpiinventory\inc\deploygroup.class.php:642 PluginGlpiinventoryDeployGroup_Dynamicdata::getTargetsByGroup()
plugins\glpiinventory\inc\toolbox.class.php:407 PluginGlpiinventoryDeployGroup::getTargetsForGroup()
plugins\glpiinventory\inc\taskview.class.php:1011 PluginGlpiinventoryToolbox->executeAsGlpiinventoryUser()
plugins\glpiinventory\inc\taskview.class.php:832 PluginGlpiinventoryTaskView->getAgentsFromActors()
plugins\glpiinventory\inc\task.class.php:635 PluginGlpiinventoryTaskView->prepareTaskjobs()
src\CronTask.php:1027 PluginGlpiinventoryTask::cronTaskscheduler()
front\cron.php:87 CronTask::launch()

@stonebuzz
Copy link
Contributor

Hi @JulienRemi

can you try this ?

#772

@JulienRemi
Copy link
Author

Hi,

Still the same errors with this Fix.

@stonebuzz
Copy link
Contributor

you can empty the GLPI cache and try again

php bin/console cache:clear

@JulienRemi
Copy link
Author

JulienRemi commented Apr 19, 2024

Still not working

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

2 participants