glpi-project / glpi-inventory-plugin

GLPI Inventory plugin
GNU Affero General Public License v3.0
46 stars 27 forks source link

error in cron job: PHP User Warning (512): Invalid item "Agent" (69) in /glpi/plugins/glpiinventory/inc/task.class.php at line 833 #313

Closed wytchmaster closed 1 year ago

wytchmaster commented 1 year ago

Describe the bug

after updating to lasted GLPI (10.0.6) I get errors from the cron-Job:

PHP Warning:  Invalid item "Agent" (69). in /opt/web/<SNIP>/glpi/plugins/glpiinventory/inc/task.class.php on line 833
PHP Warning:  Invalid item "Agent" (69). in /opt/web/<SNIP>/glpi/plugins/glpiinventory/inc/task.class.php on line 833

and

[2023-02-22 11:30:04] glpiphplog.WARNING:   *** PHP User Warning (512): Invalid item "Agent" (69). in /opt/web/<SNIP>/glpi/plugins/glpiinventory/inc/task.class.php at line 833
  Backtrace :
  plugins/glpiinventory/inc/task.class.php:833       trigger_error()
  plugins/glpiinventory/inc/task.class.php:663       PluginGlpiinventoryTask->getAgentsFromActors()
  plugins/glpiinventory/inc/task.class.php:913       PluginGlpiinventoryTask->prepareTaskjobs()
  src/CronTask.php:1018                              PluginGlpiinventoryTask::cronTaskscheduler()
  front/cron.php:84                                  CronTask::launch()

I have already updated from your git-repository and checked out v1.1.0 which was slighly newer as the version I used with GLPI 10.0.5.

To reproduce

  1. Update GLPI to 10.0.6
  2. wait for cron-job (5 minutes)
  3. finding error in mail from cron-daemon and in phperrors.log inside glpi

Expected behavior

There should be no error message, neither in cron nor in the logfile

Operating system

Linux

GLPI Agent version

1.4, Other (See additional context below)

GLPI version

10.0.6

GLPIInventory plugin

1.1.0

Additional context

I have not tested, if software deployment still works. Agents still change their 'last contact' data field. So it's not completely broken ;-) I have some old fusioninventory agents out there and some glpi-agents (v1.4). But this looks more like a server side problem.

stonebuzz commented 1 year ago

Can you check task actors from your GLPI ?

stonebuzz commented 1 year ago

Hi =)

wytchmaster commented 1 year ago

Can I check check my task actors for what? Tasks like mailgate work flawlessly. So I think task actors work in general.

stonebuzz commented 1 year ago

"Can I check check my task actors for what"

If all is OK, if you don't have a blank line on actors list for example. Or if all agent are linked to a Computer

Tasks like mailgate work flawlessly. So I think task actors work in general.

Apparently not

stonebuzz commented 1 year ago

It seems that a task uses the agent with ID 69

Invalid item "Agent" (69)

Can you check on your GLPI but I think this agent does not exist anymore.

Best regards

wytchmaster commented 1 year ago

Doesn't look like there's an agent with ID 69. There are phones with id < 10 an computers start with ID > 236. The table "glpi_agents" is the right place to look for, right?

stonebuzz commented 1 year ago

Yes it's the right place.

just find the task and reset actor list

wytchmaster commented 1 year ago

Look like there was an old job with status "running". I reset the state, It looks promising. No more error messages / mails from cron. I will have an eye on it for next couple of executions and give feedback later. Thanks for your support.

wytchmaster commented 1 year ago

OK, that was to early. Still doing errors. I will check again :-/

wytchmaster commented 1 year ago

After disabling and re-enabling all deploy jobs, it looks good now. But I haven't found any Item-ID 69 in the database ... But no more error messages. So may I close the issue?

stonebuzz commented 1 year ago

I think too

Maybe agent with ID 69 was deleted

Best regards

wytchmaster commented 1 year ago

Problem solved