fusioninventory-for-glpi icon indicating copy to clipboard operation
fusioninventory-for-glpi copied to clipboard

9.2+1.0-9.3+1.1 (GLPI 9.2.3-9.3.2): Display/Usability Issue: "Tasks - Monitoring/Logs" empty - data in glpi_plugin_fusioninventory_taskjoblogs

Open Megachip opened this issue 5 years ago • 12 comments

In reference to #2600

  • Job executions within plugins/fusioninventory/front/task.form.php working as expected.
  • plugins/fusioninventory/front/taskjob.php is empty

Megachip avatar Nov 02 '18 14:11 Megachip

it's due to this new condition

https://github.com/fusioninventory/fusioninventory-for-glpi/blob/9107173e31f84df31bc21065a8f548933739fd47/inc/task.class.php#L959

introduce by this PR -> https://github.com/fusioninventory/fusioninventory-for-glpi/pull/2527

Now, if we request a task job log without a task ID, the plugin returns an empty array

you can modify the condition to initialize the variable $asks_list with empty string instead of returning an array

Pay attention to the memory that can cause a fatal mistake on Allowed memory size

Best regards

stonebuzz avatar Mar 22 '19 13:03 stonebuzz

could you please explain us how to initialize the variable $tasks_list with empty string in /inc/task.class.php ?

ppenin avatar Mar 27 '19 11:03 ppenin

line 959, replace the return statement by $task_list = ''; Pay attention to the memory that can cause a fatal mistake on Allowed memory size Because FI try to display all log

Cordialy

stonebuzz avatar Apr 15 '19 12:04 stonebuzz

Hello I have replace the line return ['tasks' => $logs, 'agents' => $agents]; with $task_list = ''; and now each second in php_error.log: [2019-07-23 09:11:24] glpiphplog.ERROR: Toolbox::userErrorHandlerNormal() in /bustools/glpi/inc/toolbox.class.php line 659 *** PHP Notice(8): Undefined variable: tasks_list Backtrace : plugins/fusioninventory/inc/task.class.php:990 plugins/fusioninventory/inc/task.class.php:1426 PluginFusioninventoryTask->getJoblogs() plugins/fusioninventory/ajax/taskjob_logs.php:58 PluginFusioninventoryTask->ajaxGetJobLogs()

Could you please help us ?

tazzland avatar Jul 23 '19 07:07 tazzland

I have the same problem in fress-install glpi 9.4.4 - no results on monitoring/logs page even mysql table glpi_plugin_fusioninventory_taskjoblogs is not empty. I've changed $task_list to empty and I can see taksk on monitoring/log page. So, where the problem lays?

tylkonasmieci avatar Nov 27 '19 10:11 tylkonasmieci

glpi_plugin_fusioninventory_taskjobstates if empty?

ddurieux avatar Nov 27 '19 10:11 ddurieux

no, it's not empty

tylkonasmieci avatar Nov 27 '19 10:11 tylkonasmieci

Hello, I have the same problem. Global tasklog is blank screen, but display in each task work. (only timer dropbox don't display actual delay). PM

pmoussier avatar Apr 07 '20 11:04 pmoussier

Still the same problem on GLPI 9.5.1 and FusionInventory 9.5.0+1.0

tguichard25 avatar Sep 11 '20 08:09 tguichard25

Hello, I have the same problem with 9.5+3.0 Have-you any solution ?

pmoussier avatar Apr 13 '21 16:04 pmoussier

Hi, I'm still having the issue on GLPI 9.5.7 and FusionInventory 9.5+3.0. Applying the following patch (based on stonebuzz suggestion) :

--- /tmp/fusioninventory/inc/task.class.php	2021-03-21 19:46:06.000000000 +0000
+++ /srv/glpi/public/plugins/fusioninventory/inc/task.class.php	2022-03-07 13:00:51.736646872 +0000
@@ -958,7 +958,8 @@
          $tasks_list = "AND task.`id` IN ('".implode("', '", $task_ids)."')";
       } else {
          // Not task identifiers provided
-         return ['tasks' => $logs, 'agents' => $agents];
+         //return ['tasks' => $logs, 'agents' => $agents];
+	  $tasks_list = "";
       }
 
       // Restrict by IP to prevent display tasks in another entity use not have right

Almost works, but it triggers the following JS exception :

Uncaught TypeError: "job_93_PluginFusioninventoryDeployPackage_53_0" is not a non-null object
    cache https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    set https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    access https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    queue https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    queue https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    each https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:14
    each https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:14
    queue https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    delay https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    update_logs https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:819
    success https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1142
    setTimeout handler*success https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1141
    l https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    fireWith https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    T https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    e https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    send https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    ajax https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    ajax https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7 line 25 > eval:304
    get_logs https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1132
    queue_refresh_logs https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1229
    queue_refresh_logs https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1231
    update_logs_timeout https://glpi.cemea.org/plugins/fusioninventory/js/taskjobs.js?v=9.5+3.0:1206
    <anonymous> https://glpi.cemea.org/plugins/fusioninventory/front/taskjob.php:843
    u https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    f https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    setTimeout handler*Deferred/then/o/< https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    l https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    fireWith https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    fire https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    l https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    fireWith https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    ready https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    V https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    EventListener.handleEvent* https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:25
    <anonymous> https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:14
    <anonymous> https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:14
    i https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:1
    <anonymous> https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:1
    i https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:1
    <anonymous> https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:1
    <anonymous> https://glpi.cemea.org/public/lib/base.min.js?v=9.5.7:1

Updating fusioninventory/js/taskjobs.js with the following patch :

--- fusioninventory/js/taskjobs.js	2021-03-21 19:46:06.000000000 +0000
+++ /srv/glpi/public/plugins/fusioninventory/js/taskjobs.js	2022-03-07 14:51:17.936614063 +0000
@@ -816,7 +816,7 @@
       });
    }
 
-   $(Object.keys(taskjobs.charts)).delay(500).each(function(i,v) {
+   $(Object.keys(taskjobs.charts)).each(function(i,v) {
       taskjobs.update_progressbar(taskjobs.charts[v]);
    });

Resolve this issue and allow front/taskjob.php to properly display all logs without issue.

However, it's a bit of a hack, so a proper fix would be great :)

GuillaumeV-cemea avatar Mar 07 '22 14:03 GuillaumeV-cemea

same problem here

GLPI 9.5.7 FusionInventory 9.5+4.1

kintaro1981 avatar Jul 19 '22 13:07 kintaro1981