Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Crash, once a day in the morning

    Scheduled Pinned Locked Moved 2.1 Snapshot Feedback and Problems - RETIRED
    8 Posts 4 Posters 2.6k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      Macom2007
      last edited by

      Hi,

      every morning a got a message that a crash occured. It is every time a php script which times out, but not alway the same script. Sample message :

      Crash report details:

      PHP Errors:
      [01-Oct-2012 03:37:28 UTC] PHP Fatal error:  Maximum execution time of 900 seconds exceeded in /etc/inc/notices.inc on line 351

      Any ideas how to solve this ?

      1 Reply Last reply Reply Quote 0
      • jimpJ
        jimp Rebel Alliance Developer Netgate
        last edited by

        Those aren't really "crashes" per se, not like there was a panic/reboot.

        I'd look in the logs and see what was happening 900 seconds before that timestamp to see what it was doing.

        Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

        Need help fast? Netgate Global Support!

        Do not Chat/PM for help!

        1 Reply Last reply Reply Quote 0
        • M
          Macom2007
          last edited by

          I dont got this solved yet. But is has to do with lcdproc_client.php. Once i stop the client, the error is gone. This error happens once a day, after the error lcdproc_client is stopped.

          Any ideas ?

          Crash report begins.  Anonymous machine information:

          i386
          8.3-RELEASE-p4
          FreeBSD 8.3-RELEASE-p4 #1: Sat Oct 13 14:30:31 EDT 2012    root@snapshots-8_3-i386.builders.pfsense.org:/usr/obj./usr/pfSensesrc/src/sys/pfSense_SMP.8

          Crash report details:

          PHP Errors:
          [18-Oct-2012 14:07:06 UTC] PHP Fatal error:  Maximum execution time of 900 seconds exceeded in /etc/inc/interfaces.inc on line 68

          1 Reply Last reply Reply Quote 0
          • P
            phil.davis
            last edited by

            /etc/rc.php_ini_setup sets:

            max_execution_time = 900
            

            Normal things done on the GUI, even downloading and installing an update, should never use more than 900 CPU seconds on any platform.
            Things like lcdproc are scripts that run forever in the background, so it will clock up 900 seconds of CPU eventually and get terminated by the PHP interpreter.
            By adding set_time_limit(0) before loop_status is called in lcdproc_client.php it should be allowed to run forever:

            /* Connect to the LCDd port and interface with the LCD */
            $lcd = fsockopen(LCDPROC_HOST, LCDPROC_PORT, $errno, $errstr, 10);
            if (!$lcd) {
              lcdproc_warn("Failed to connect to LCDd process $errstr ($errno)");
            } else {
              set_time_limit(0);
              build_interface($lcd);
              loop_status($lcd);
              /* loop exited? Close fd and wait for the script to kick in again */
              fclose($lcd);
            }
            
            

            (The fragment above is from the version in the lcdproc package - lcdproc-dev is a little different, but same principle.)
            Give this a try, then this should be fixed in the lcdproc / lcdproc-dev packages.
            Any other packages that use a PHP script as a background process that runs forever will also eventually reach the 900 second limit - they will also need set_time_limit(0) added.

            As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
            If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

            1 Reply Last reply Reply Quote 0
            • stephenw10S
              stephenw10 Netgate Administrator
              last edited by

              Hmm, this is interesting.
              The lcdproc (original) package has a separate script, lcdclient.sh, that runs a loop continuously restarting lcdclient.php. In an effort to reduce the complexity this was removed from the dev package. At the time there seemed no reason for it to be there and it seemed like one less thing to worry about while trying to squash some bugs in the startup script. This could have been an error.  ::)
              See:
              http://forum.pfsense.org/index.php/topic,44034.msg239547/topicseen.html#msg239547

              Steve

              1 Reply Last reply Reply Quote 0
              • P
                phil.davis
                last edited by

                max_execution_time = 900 was only done a few months ago, now on 2.1 stuff needs to be aware of that.
                It means that a script that has gone into a loop should eventually get killed by the PHP interpreter when it chews up 900 seconds of CPU time. That might be helpful interactively. After losing control of a remote site, you might be able to get a coffee or 2 (or 3) and then find that the thing that went into a loop has been zapped and the WebGUI responds again.
                Anything that needs to run "forever" or for an extended (CPU) time should now specify that by calling set_time_limit - this just needs to be brought to the attention of whoever maintains lcdproc.
                The new code in lcdproc-dev looks like it is handling the various error/retry conditions it needs, it just needs to also avoid having the PHP interpreter kill it.

                As the Greek philosopher Isosceles used to say, "There are 3 sides to every triangle."
                If I helped you, then help someone else - buy someone a gift from the INF catalog http://secure.inf.org/gifts/usd/

                1 Reply Last reply Reply Quote 0
                • stephenw10S
                  stephenw10 Netgate Administrator
                  last edited by

                  Well that's good and bad. The client crashes out on my box under 2.0.1 and this would have been a nice explanation. Back to debugging.  ;)

                  Steve

                  1 Reply Last reply Reply Quote 0
                  • M
                    Macom2007
                    last edited by

                    Your solution works for me. Thanks!

                    @phil.davis:

                    /etc/rc.php_ini_setup sets:

                    max_execution_time = 900
                    

                    Normal things done on the GUI, even downloading and installing an update, should never use more than 900 CPU seconds on any platform.
                    Things like lcdproc are scripts that run forever in the background, so it will clock up 900 seconds of CPU eventually and get terminated by the PHP interpreter.
                    By adding set_time_limit(0) before loop_status is called in lcdproc_client.php it should be allowed to run forever:

                    /* Connect to the LCDd port and interface with the LCD */
                    $lcd = fsockopen(LCDPROC_HOST, LCDPROC_PORT, $errno, $errstr, 10);
                    if (!$lcd) {
                      lcdproc_warn("Failed to connect to LCDd process $errstr ($errno)");
                    } else {
                      set_time_limit(0);
                      build_interface($lcd);
                      loop_status($lcd);
                      /* loop exited? Close fd and wait for the script to kick in again */
                      fclose($lcd);
                    }
                    
                    

                    (The fragment above is from the version in the lcdproc package - lcdproc-dev is a little different, but same principle.)
                    Give this a try, then this should be fixed in the lcdproc / lcdproc-dev packages.
                    Any other packages that use a PHP script as a background process that runs forever will also eventually reach the 900 second limit - they will also need set_time_limit(0) added.

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post
                    Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.