Web UI crashes for certain html plugin output

I have posted this problem as a bug here but I hope that somebody has encountered this already and has workaround.

I am using the latest icingaweb2 (2.12.1) on ubuntu 22.04 with php8.1

When an plugin (see example below) outputs a (certain) html table the UI crashes with an “Uncaught” javascript exception.

import sys

############
### MAIN ###
############
def main():

  result_string = """
<body>
<p>Test output table</p>
<table border='1' style="width:100%">
  <tr>
    <th style="text-align:right;font-size:15px;width:60px">MON</th>
    <th>TUE</th>
    <th>WED</th>
    <th>THU</th>
    <th>FRI</th>
    <th>SAT</th>
    <th>SUN</th>
  </tr>
  <tr>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">0</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">1</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">2</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">3</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">4</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">5</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">6</td>
  </tr>
  <tr>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">0</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">1</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">2</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">3</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">4</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">5</td>
    <td style="text-align:right;font-size:15px;width:60px;background-color:#33E3FF">6</td>
  </tr>
</table>
</body>
  """

  print(f"<html>{result_string}</html>")
  sys.exit(0)

if __name__ == '__main__':
  main()

the problem is that the renderer for the top renders the output but cuts the output to 1000 chars, this results in a malformed html and breaks the page.
https://github.com/Icinga/icingadb-web/blob/6029cc1f9e247c6e5b4432d63f2da1928aad5d12/library/Icingadb/Util/PluginOutput.php#L68

the PluginRenderer for the full PluginOutput cuts the overall output for 10000 chars
https://github.com/Icinga/icingadb-web/blob/6029cc1f9e247c6e5b4432d63f2da1928aad5d12/library/Icingadb/Widget/Detail/ObjectDetail.php#L428

If I remember correctly html is working but not fully supported as check output.

there are three options here

  1. wait for a fix
  2. patch icingadb by yourself
  3. create a module and use a custom html renderer for the checks that need such a large html output.
2 Likes

Thank you @moreamazingnick for the response - it is indeed amazing :wink:
I can confirm that by patching the two files (increased the limit) - the problem no longer appears.

I will opt for the solution patch & wait (for the fix). Since we deploy via ansible it was quite easy to modify the limits accordingly.

Hopefully this will be solved soon (but I don’t think this will be trivial since the truncated html needs to be somehow “containerized” so that it does not destroy the rest of the page)

Your answer helped us a lot !

1 Like