Uploaded image for project: 'Observium'
  1. Observium
  2. OBS-1656

browser freezes when big rancid configs are tried to be displayed

Details

    • Improvement
    • Resolution: Fixed
    • Minor
    • None
    • Professional Edition
    • Web Interface
    • Debian GNU/Linux 8, rancid 2.3.8-6
      Observium 0.15.12.7231

    Description

      Browser freezes if rancid configs with i.e. 200k lines are tried to be displayed.
      I tried this with firefox and also safari. Both freeze and need to be killed.

      I tried to workaround with the following change in html/pages/device/showconfig.inc.php

      diff showconfig.inc.php.orig showconfig.inc.php
      227c227,235
      < <?php echo(escape_html($device_config)); ?>

      > <?php
      > $device_config_lines = count(file($device_config_file));
      > if ($device_config_lines < 10000)

      Unknown macro: { > echo(escape_html($device_config)); > }

      else

      Unknown macro: { > echo("Sorry, too many lines to display}

      > ?>

      With this workaround the config is not displayed if it has more than 10k lines. I think it would be nicer to be able to download the config file but at least the browser does not freeze any more.
      I also do not know how many lines can be displayed in a browser without any problems.

      Attachments

        Issue Links

          Activity

            [OBS-1656] browser freezes when big rancid configs are tried to be displayed

            Fixed in r7490.

            landy Mike Stupalov added a comment - Fixed in r7490.

            svn diff html/pages/device/showconfig.inc.php
            Index: html/pages/device/showconfig.inc.php
            ===================================================================
            --- html/pages/device/showconfig.inc.php	(revision 7413)
            +++ html/pages/device/showconfig.inc.php	(working copy)
            @@ -224,7 +224,15 @@
                 <div id="device_config" class="panel-collapse collapse in">
                   <div class="panel-body">
                     <pre class="prettyprint linenums lang-sh">
            -          <?php echo(escape_html($device_config)); ?>
            +          <?php 
            +              $device_config_lines = count(file($device_config_file));
            +              if ($device_config_lines < 10000) {
            +                 echo(escape_html($device_config));
            +              } else {
            +                 echo("Sorry, too many lines to display: ".$device_config_lines);
            +                 echo($device_config_file);
            +              }
            +          ?>
                     </pre>
                   </div>
                 </div>
            

            jok Joerg Krohn added a comment - svn diff html/pages/device/showconfig.inc.php Index: html/pages/device/showconfig.inc.php =================================================================== --- html/pages/device/showconfig.inc.php (revision 7413) +++ html/pages/device/showconfig.inc.php (working copy) @@ -224,7 +224,15 @@ <div id="device_config" class="panel-collapse collapse in"> <div class="panel-body"> <pre class="prettyprint linenums lang-sh"> - <?php echo(escape_html($device_config)); ?> + <?php + $device_config_lines = count(file($device_config_file)); + if ($device_config_lines < 10000) { + echo(escape_html($device_config)); + } else { + echo("Sorry, too many lines to display: ".$device_config_lines); + echo($device_config_file); + } + ?> </pre> </div> </div>

            The correct way to make diffs is "svn diff <filename>" from the installation root.

            adama Adam Armstrong added a comment - The correct way to make diffs is "svn diff <filename>" from the installation root.

            diff showconfig.inc.php.orig showconfig.inc.php
            227c227,235
            <           <?php echo(escape_html($device_config)); ?>
            ---
            >           <?php 
            >               $device_config_lines = count(file($device_config_file));
            >               if ($device_config_lines < 10000) {
            >                  echo(escape_html($device_config));
            >               } else {
            >                  echo("Sorry, too many lines to display: ".$device_config_lines);
            >               }
            >           ?>
            

            With some more knowledge in programming I think it might make sense to offer a link to the config instead of showing a message but at least with that patch my browser does not freeze any more.
            Another improvement could be to offer a new variable in config.php which allows to set the rancid max lines to be shown in the browser before a message is displayed or a link to the config file is offered instead of hard coding the max number of lines.

            jok Joerg Krohn added a comment - diff showconfig.inc.php.orig showconfig.inc.php 227c227,235 < <?php echo(escape_html($device_config)); ?> --- > <?php > $device_config_lines = count(file($device_config_file)); > if ($device_config_lines < 10000) { > echo(escape_html($device_config)); > } else { > echo("Sorry, too many lines to display: ".$device_config_lines); > } > ?> With some more knowledge in programming I think it might make sense to offer a link to the config instead of showing a message but at least with that patch my browser does not freeze any more. Another improvement could be to offer a new variable in config.php which allows to set the rancid max lines to be shown in the browser before a message is displayed or a link to the config file is offered instead of hard coding the max number of lines.

            People

              landy Mike Stupalov
              jok Joerg Krohn
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: