ALERT - script tried to increase memory_limit

Post general support questions here that do not specifically fall into the Linux or Windows categories.

Moderators: Developers, Moderators

Post Reply
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

ALERT - script tried to increase memory_limit

Post by flaviobatistela »

Hello,

I'm having the following problem below. These are the logs from the syslog.

Jul 26 08:20:01 satellite /USR/SBIN/CRON[6263]: (www-data) CMD (php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log)
Jul 26 08:20:01 satellite suhosin[6264]: ALERT - script tried to increase memory_limit to 285212672 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '/usr/share/cacti/site/poller.php', line 171)
Jul 26 08:20:01 satellite suhosin[6267]: ALERT - script tried to increase memory_limit to 285212672 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '/usr/share/cacti/site/cmd.php', line 33)
Jul 26 08:20:01 satellite suhosin[6267]: ALERT - script tried to increase memory_limit to 4294967295 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file 'unknown')
Jul 26 08:20:01 satellite suhosin[6270]: ALERT - script tried to increase memory_limit to 285212672 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file '/usr/share/cacti/site/cmd.php', line 33)
Jul 26 08:20:01 satellite suhosin[6270]: ALERT - script tried to increase memory_limit to 4294967295 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file 'unknown')
Jul 26 08:20:02 satellite suhosin[6264]: ALERT - script tried to increase memory_limit to 4294967295 bytes which is above the allowed value (attacker 'REMOTE_ADDR not set', file 'unknown')


What could this be? Grateful for the help.
User avatar
gandalf
Developer
Posts: 22383
Joined: Thu Dec 02, 2004 2:46 am
Location: Muenster, Germany
Contact:

Post by gandalf »

Please visit "System Utilities -> Technical Support". We try to estimatate the php memory required. Please use this value as a start in php.ini. Please remember to restart httpd, then.
R.
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

Post by flaviobatistela »

Gandalf,

I increased the memory in php.ini to 4096M, but even so, the messages in the log, keep coming.
Voiper99
Cacti User
Posts: 276
Joined: Thu Mar 01, 2007 5:43 pm
Location: Melbourne, Australia

Post by Voiper99 »

flaviobatistela wrote:I increased the memory in php.ini to 4096M, but even so, the messages in the log, keep coming.
Did you increase it in the php.ini file and then restart the Apache service?

If so, what does it say under "System Utilities -> Technical Support" now? If it still says you need to increase your memory at the same level as it did originally, then you may not have increased it in the correct spot or you have not restarted the Apache service.
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

This is the new suhosin PHP module that prevents a PHP binary from doing some nasty things, like increasing your memory beyond the available bytes.

The Cacti Group is going to have to do something about this as we set the PHP Memory limit quite high on to accommodate all systems sizes. I just had to make a change to Boost to let it be more conservative for "little" systems.

Run the following command:

Code: Select all

grep -r memory_limit <path_cacti>/*
And fix the memory limit in the files to match your system in the mean time.

TheWitness
Last edited by TheWitness on Tue Jul 27, 2010 8:12 am, edited 2 times in total.
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

Post by flaviobatistela »

Voiper99 wrote:
flaviobatistela wrote:I increased the memory in php.ini to 4096M, but even so, the messages in the log, keep coming.
Did you increase it in the php.ini file and then restart the Apache service?

If so, what does it say under "System Utilities -> Technical Support" now? If it still says you need to increase your memory at the same level as it did originally, then you may not have increased it in the correct spot or you have not restarted the Apache service.
In System Utilities -> Technical Support, says:

PHP Information
PHP Version 5.3.2-1
PHP OS Linux
Satellite.abcrede.com.br PHP uname Linux 2.6.26-2-amd64 # 1 SMP Sun Jun 20 20:16:30 UTC 2010 x86_64
PHP SNMP Installed
max_execution_time 30
memory_limit 4096M

I increased the memory in the following file:
/etc/php5/apache2/php.ini, and restarted apache.

Is this correct?
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

Post by flaviobatistela »

TheWitness wrote:This is the new suhosin PHP module that prevents a PHP binary from doing some nasty things, like increasing your memory beyond the available bytes.

The Cacti Group is going to have to do something about this as we set the PHP Memory limit quite high on to accommodate all systems sizes. I just had to make a change to Boost to let it be more conservative for "little" systems.

Run the following command:

Code: Select all

find <path_cacti> -name memory_limit
And fix the memory limit in the files to match your system in the mean time.

TheWitness
There appeared nothing in the output of the command.

Code: Select all

 satellite: ~ # find /usr/share/cacti -name memory_limit 
There appeared nothing.

What files should I change the memory?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Wrong command. Sorry, my bad. Here is the correct command.

Code: Select all

cd <path_cacti>
grep -r memory_limit *
Then "REDUCE" the memory limit to something your system can handle. 4096M is like 4GBytes. Likely too high.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

Post by flaviobatistela »

TheWitness wrote:Wrong command. Sorry, my bad. Here is the correct command.

Code: Select all

cd <path_cacti>
grep -r memory_limit *
Then "REDUCE" the memory limit to something your system can handle. 4096M is like 4GBytes. Likely too high.

TheWitness
Observe the output of the command:

satellite:~# grep -r memory_limit /usr/share/cacti/site/*
/usr/share/cacti/site/cmd.php:ini_set("memory_limit", "4096M");
/usr/share/cacti/site/poller.php:ini_set("memory_limit", "272M");
/usr/share/cacti/site/utilities.php: $max_memory = ini_get("memory_limit");
/usr/share/cacti/site/utilities.php: ini_set("memory_limit", "32M");
/usr/share/cacti/site/utilities.php: ini_set("memory_limit", $max_memory);
/usr/share/cacti/site/utilities.php: print " <td class='textArea'>memory_limit</td>\n";
/usr/share/cacti/site/utilities.php: print " <td class='textArea'>" . ini_get("memory_limit");
/usr/share/cacti/site/utilities.php: if (memory_bytes(ini_get('memory_limit')) < $memory_suggestion) {
/usr/share/cacti/site/utilities.php: print "<br><font color='red'>It is highly suggested that you alter you php.ini memory_limit to " . memory_readable($memory_suggestion) . " or higher. This suggested memory value is calculated based on the number of data source present and is only to be used as a suggestion, actual values may vary system to system based on requirements.</font><br>";


I have to change what files? And what value should I put?
User avatar
TheWitness
Developer
Posts: 17007
Joined: Tue May 14, 2002 5:08 pm
Location: MI, USA
Contact:

Post by TheWitness »

Code: Select all

/usr/share/cacti/site/cmd.php:ini_set("memory_limit", "4096M");
/usr/share/cacti/site/poller.php:ini_set("memory_limit", "272M");
/usr/share/cacti/site/utilities.php: ini_set("memory_limit", "32M");
These ones. They need to be <= total memory. Actually, remove the third one altogether or remove them all and simply let the one in php.ini do all the heavy lifting.

TheWitness
True understanding begins only when we realize how little we truly understand...

Life is an adventure, let yours begin with Cacti!

Author of dozens of Cacti plugins and customization's. Advocate of LAMP, MariaDB, IBM Spectrum LSF and the world of batch. Creator of IBM Spectrum RTM, author of quite a bit of unpublished work and most of Cacti's bugs.
_________________
Official Cacti Documentation
GitHub Repository with Supported Plugins
Percona Device Packages (no support)
Interesting Device Packages


For those wondering, I'm still here, but lost in the shadows. Yearning for less bugs. Who want's a Cacti 1.3/2.0? Streams anyone?
flaviobatistela
Posts: 6
Joined: Mon Jul 26, 2010 6:23 am

Post by flaviobatistela »

TheWitness wrote:

Code: Select all

/usr/share/cacti/site/cmd.php:ini_set("memory_limit", "4096M");
/usr/share/cacti/site/poller.php:ini_set("memory_limit", "272M");
/usr/share/cacti/site/utilities.php: ini_set("memory_limit", "32M");
These ones. They need to be <= total memory. Actually, remove the third one altogether or remove them all and simply let the one in php.ini do all the heavy lifting.

TheWitness
Now everything is OK. No longer appears in the error logs. But I still get an error that I do not know what it means.

See the error below:

Jul 28 16:05:01 satellite /USR/SBIN/CRON[4317]: (www-data) CMD (php /usr/share/cacti/site/poller.php >/dev/null 2>/var/log/cacti/poller-error.log)
Jul 28 16:09:01 satellite /USR/SBIN/CRON[4338]: (root) CMD ( [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -type f -cmin +$(/usr/lib/php5/maxlifetime) -print0 | xargs -n 200 -r -0 rm)
oliversalzburg
Posts: 8
Joined: Fri Jun 29, 2012 7:25 am

Re: ALERT - script tried to increase memory_limit

Post by oliversalzburg »

Code: Select all

attacker 'REMOTE_ADDR not set', file 'unknown'
That is an indicator that the setting originated from php.ini. On Debian the CLI version of the php.ini (/etc/php/cli/php.ini) defaults to setting -1 as the memory_limit. This is the cause of this error.
paulgevers
Cacti Pro User
Posts: 613
Joined: Tue Aug 29, 2006 4:09 pm
Location: NL

Re: ALERT - script tried to increase memory_limit

Post by paulgevers »

For Debian people that find this via Google: This is described in Debian bug 668157, and as long as it is not fixed, you should provide a proper memory_limit in /etc/php5/cli/php.ini yourself.
Maintainer of cacti in Debian (and Ubuntu).
Cacti 1.* is now officially supported on Debian Stretch via Debian backports
FAQ Ubuntu and Debian differences
Generic cacti debugging
Post Reply

Who is online

Users browsing this forum: No registered users and 4 guests