• 66. Can't view system log - fatal memory error


    DZMM
    • Minor

    When I try to view my syslog I get this error:

     

    Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 16777224 bytes) in /usr/local/emhttp/plugins/dynamix/include/DefaultPageLayout.php(394) : eval()'d code on line 73

     

    highlander-diagnostics-20180929-0801.zip




    User Feedback

    Recommended Comments

    Million errors about your cache pool

    Sep 28 17:45:30 Highlander kernel: BTRFS warning (device sdd1): lost page write due to IO error on /dev/sdf1
    Sep 28 17:45:30 Highlander kernel: BTRFS error (device sdd1): error writing primary super block to device 3

     

    Link to comment

    I believe that error always happens when there are a lot of logged errors and the syslog gets very large, not sure if it's a bug or a design feature.

     

     

    Edited by johnnie.black
    Link to comment

    By default Unraid reserves 128 MB for the log partition.

    You can make a bigger reservation, e.g. I have the following in my 'go' file

    # resize /var/log
    mount -o remount,size=256m /var/log

     

    Link to comment

    I have the same memory problem, but not because of usual syslog errors. Its only I because I enabled the mover logs and use xfs defragmentation which adds a massive amount of debug lines to the log.

     

    And this bug is not related to the size of /var/log. It's related to the PHP memory limit which is absolutely fine, but in /usr/local/emhttp/plugins/dynamix/include/Syslog.php this line is a problem:

    foreach (file($log) as $line) {

    This is a RAM killer as file() reads the complete log file into the RAM before executing further commands. It could be easily solved by replacing it against:

      $fh = fopen($log, "r");
      while (($line = fgets($fh)) !== false) {

    Or even better (which limits the output to 1000 lines):

      $i=0;
      $line_count = intval(exec("wc -l '$log'"));
      $fh = fopen($log, "r");
      while (($line = fgets($fh)) !== false) {
        $i++;
        if ($i < $line_count - 1000) {
          continue;
        }

    I tested this and now the RAM usage of my browser dropped by 1.6GB while viewing the syslog page and this is the first time I was able to open the syslogs through my smartphone which took ages before.

     

    The fixed file:

    Syslog.zip

     

    EDIT: Ok, I found the file in the repository:

    https://github.com/limetech/webgui/blob/master/plugins/dynamix/include/Syslog.php

     

    Will try to fix it ^^

     

    EDIT2: Yeah, my very first github pull request 😅

    https://github.com/limetech/webgui/pull/770

     

    Syslog.zip

    Edited by mgutt
    • Like 3
    • Thanks 1
    Link to comment


    Join the conversation

    You can post now and register later. If you have an account, sign in now to post with your account.
    Note: Your post will require moderator approval before it will be visible.

    Guest
    Add a comment...

    ×   Pasted as rich text.   Restore formatting

      Only 75 emoji are allowed.

    ×   Your link has been automatically embedded.   Display as a link instead

    ×   Your previous content has been restored.   Clear editor

    ×   You cannot paste images directly. Upload or insert images from URL.


  • Status Definitions

     

    Open = Under consideration.

     

    Solved = The issue has been resolved.

     

    Solved version = The issue has been resolved in the indicated release version.

     

    Closed = Feedback or opinion better posted on our forum for discussion. Also for reports we cannot reproduce or need more information. In this case just add a comment and we will review it again.

     

    Retest = Please retest in latest release.


    Priority Definitions

     

    Minor = Something not working correctly.

     

    Urgent = Server crash, data loss, or other showstopper.

     

    Annoyance = Doesn't affect functionality but should be fixed.

     

    Other = Announcement or other non-issue.