Backup package causes crash report in pfSense 2.6.0
-
I experienced a crash when backing up files and directories using the Backup 0.5_6 package. The crash report and PHP_error.log say:
Crash report begins. Anonymous machine information:
amd64
12.3-STABLE
FreeBSD 12.3-STABLE RELENG_2_6_0-n226742-1285d6d205f pfSenseCrash report details:
PHP Errors:
[16-Feb-2022 08:56:44 Europe/Berlin] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 200698672 bytes) in /usr/local/www/csrf/csrf-magic.php on line 149No FreeBSD crash data found.
PHP_errors.log
[16-Feb-2022 08:56:44 Europe/Berlin] PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 200698672 bytes) in /usr/local/www/csrf/csrf-magic.php on line 149
Does anyone have an idea?
Thanks
Robert -
Last time some one showed a related error was here : browser gui misery
The file "/usr/local/www/csrf/csrf-magic.ph" is ok ?
What happens when you use another browser ?
The error itself isn't hard to understand.
When visiting a web page from the pfSense GUI (which one ?), PHP needed more then 200 Mbytes for temporary buffer space. That ..... failed. -
Also tried with IE, but the result is the same. This behavior is since the update to 2.6.0, in 2.5.2 it worked.
I checked the backup.php and found that the backup file was created properly with all the configured files and folder. It is located unter /root/backup/pfsense.bak.tgz and has a size of nearly 200 MB. So i think the error has to do with the download process of that file.
Kind regards
Robert -
-
@robert_knabe said in Backup package causes crash report in pfSense 2.6.0:
and has a size of nearly 200 MB.
If you ask PHP to build a file that weights over 200 Mbytes, then yes, it will break.
What do you want to backup that is that big ??
-
@gertjan
Building the file is not the problem. It is on the machine, it is valid, contains all of the configured data and can be retrieved using SCP. The download via the UI is, what is not working. And this should be independant of the file size. This evening i will remove some parts of the backup configuration and will retry with only a few data. Let's see what happens...
Kind regards
Robert -
@robert_knabe said in Backup package causes crash report in pfSense 2.6.0:
And this should be independant of the file size
Yes, but ...
The transfer of an not-known file from a device to a browser isn't build into pfSense, the GUI.
pfSense is a router after all, not some (file) server.
pfSense supports the down or upload of a file, but these are never greater then a couple of Mbytes - the config file.Later on, some one wrote Backup, but it was still using the locally available nginx/PHP resources, and these have execution time and file size set. Another setup is needed to support bigger files. Which creates security issues.
Btw : I guess a 'crash' (it was actually just PHP bailling out because one of it's execution conditions was wrong) that happened because the file is "to big", should be intercepted in the core code, such as "/usr/local/www/csrf/csrf-magic.php"
-
@gertjan
I reconfigured the default setting in /etc/inc/config.inc. There are lines that look like
if ($ARCH == "amd64") {
ini_set("memory_limit", "512M");
} else {
ini_set("memory_limit", "128M");
}
After changing the "512M" to "1024M" in the second line, everything is running fine on my system with 16GB of memory. In the next couple of weeks i will closer monitor the system to see if there are any visible side effects.
Kind regards
Robert -
@gertjan
One more comment on the post befor:- As far as i understood the documentation, this setting may possibly be overwritten by php.ini with the parameter memory_limit or a direct call to ini_set() in the script itself. Even a .htaccess may change the setting. Currently this does not happen!
- The change is most likely not preserved accross updates. May be it is a good idea, to make this parameter configurable in a global configuration tab and include it in the configuration.xml. Then it would be more accessible and also survive updates.
Kind regards
Robert -
As far as I know, no one is complaining about the small file size handling capability of pfSense.
The RRD files will still fit into the confiig file, and if logs are important (they are for me) an external syslogger shiould be used.But, why not, if you want, you can modify the php.ini file, as that's the way to change memory available to PHP.
Two options :
Write a small shell script that modifies the memory_limit if it doesn't contain the right value for you. Have this script started with the startcmd pfSense package. Use commands like 'sed' to replace a text in the file. You probably have to restart the PHP-FPM to take the new setting in account.Or, edit the php.ini file, and keep the old one.
Create a diff file from these two files.
Use the diff file and the pfSense patch package to patch the existing php.ini file.
You will still have to restart php-fpm to have the modification taken in account.Both solutions will persist even after a pfSense upgrade.
You could add a feature request, just keep in mind that it would be granted only if a lot of people are asking for it.