Command quick actions blocking all browser tabs

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Command quick actions blocking all browser tabs

Post by WillemDH »

Hello,

I've had this problem in the past with Reactor chains when it was just released. When clicking a quick action, all browser tabs become unresponsive. As I'm now almost finished migrating my Reactor chains to commands which start a Rundeck bash script, it seem like this problem was never solved for commands.
So how to reproduce =>
- Create a Bash script which takes 2-3 minutes to finish
- Create a quick action with a command which starts this Bash script
- Open Nagios XI and click the quick action. The quick action output of the bash script should appear in a newly opened tab
- The Nagios XI page where the quick action was clicked hangs untill the quick action finishes

Hopefully there is an easy fix for this.

Grtz

Willem
Nagios XI 5.8.1
https://outsideit.net
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Command quick actions blocking all browser tabs

Post by mcapra »

The solution will likely be using an asynchronous request over jQuery instead of opening a new browser window/tab to run the command/script.

Going to play around with some things and get back to you. Shouldn't take too long :)
Former Nagios employee
https://www.mcapra.com/
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Command quick actions blocking all browser tabs

Post by mcapra »

I was able to replicate this issue on XI 5.2.9 / Actions 1.6.6 for Firefox and Chrome. All I did was write a dummy PHP script that runs for 3 minutes and prints a number:

Code: Select all

<?php
$count = 0;

while ($count < 180) {
        echo $count . PHP_EOL;
        $count++;
        sleep(1);
}
?>
Which locked up the main Nagios XI tab. It looks like this is an issue with system/exec calls that has been reported fixed as of PHP 5.6:
https://bugs.php.net/bug.php?id=44942

If you'd prefer a more short-form solution, I modified /usr/local/nagiosxi/html/includes/components/actions/runcmd.php around line 123 to the following:

Code: Select all

session_write_close();
system($cmdline);
Adding a session_write_close call before the system call seems to have fixed the issue. Unsure about the possible repercussions with the $_SESSION itself, but my XI machine isn't doing anything terribly weird yet.
Former Nagios employee
https://www.mcapra.com/
User avatar
WillemDH
Posts: 2320
Joined: Wed Mar 20, 2013 5:49 am
Location: Ghent
Contact:

Re: Command quick actions blocking all browser tabs

Post by WillemDH »

Adding a session_write_close call before the system call seems to have fixed the issue for me too.

Thanks for this tip. This is a big improvement and should get in some future XI release.
Nagios XI 5.8.1
https://outsideit.net
SteveBeauchemin
Posts: 524
Joined: Mon Oct 14, 2013 7:19 pm

Re: Command quick actions blocking all browser tabs

Post by SteveBeauchemin »

Thank you... I'm starting to depend on Quick Actions more and was wondering what 'Normal' was for it.
I now see that the browser freeze was normal, but avoidable.
I have also added that line to my system.

Steve B
XI 5.7.3 / Core 4.4.6 / NagVis 1.9.8 / LiveStatus 1.5.0p11 / RRDCached 1.7.0 / Redis 3.2.8 /
SNMPTT / Gearman 0.33-7 / Mod_Gearman 3.0.7 / NLS 2.0.8 / NNA 2.3.1 /
NSClient 0.5.0 / NRPE Solaris 3.2.1 Linux 3.2.1 HPUX 3.2.1
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: Command quick actions blocking all browser tabs

Post by mcapra »

I have filed a bug report for this issue (ID 9752). The official solution will probably be a bit more elegant than my hotfix.
Former Nagios employee
https://www.mcapra.com/
Locked