PHP Memory exhaustion errors

Started by apocalypticgoat, March 04, 2022, 02:19:59 AM

Previous topic - Next topic
Hi, I'm getting a php memory exhaustion error below:

[03-Mar-2022 19:47:29 America/New_York] PHP Fatal error:  Allowed memory size of 1073741824 bytes exhausted (tried to allocate 4096 bytes) in /usr/local/opnsense/scripts/dhcp/prefixes.php on line 95

System Information:


FreeBSD 13.0-STABLE stable/22.1-n248059-267a40127d5 SMP amd64
OPNsense 22.1.2 92fcdd63e
Plugins os-acme-client-3.8 os-ddclient-1.2 os-mdns-repeater-1.1 os-net-snmp-1.5_1 os-upnp-1.4_2 os-zabbix-agent-1.11
Time Thu, 03 Mar 2022 19:48:18 -0500
OpenSSL 1.1.1m  14 Dec 2021
PHP 7.4.28


Any idea's as to what's causing this? I did update from 21.7.8 to 22.1.2 this past sunday. I'm wondering if one of the plugins above my be to blame as according to the time stamps...these errors started a little bit after I re-enabled those last night.

Seeing the same error.

line 95 of that file is

exec('opnsense-log dhcpd 2> /dev/null', $log, $ret);

looking into my dhcp settings.  I habe multiple dhcpv4 and dcpv6 subnets and server instances running.

Interesting. I too have multiple v4 and v6 subnets as well for vlan purposes.

We will have to see if anyone else reports the issue with the same conditions before we call it a pattern.

March 05, 2022, 04:37:55 AM #3 Last Edit: March 05, 2022, 04:55:54 AM by heyheyheyhey
I reported the error with the crash reporter.  Are you on 22.1.2_1 ?

Also I have loads. of memory 12+GB Free right now

I'm on 22.1.2.

My unit has 12GB of ram, all of which is available for opnsense to use.


I've sent it via the reporter as well but wanted to check here for more information.

Sounds like a large log file, this https://github.com/opnsense/core/commit/71a8da452cca02412aab8906c2df0140cc434b28 might help, although the prefixes action will likely still take quite some time due to the size it needs to parse.


To apply the patch, the following command should do the trick:

opnsense-patch 71a8da4


Best regards,

Ad

I've applied the patch using the command provided. I'll monitor and report back.

Thanks!


I just built/started using OPNSense yesterday and woke up to this exact error, down to the number. I went ahead and applied the same patch and will keep an eye on it.

Quote from: AdSchellevis on March 05, 2022, 03:57:55 PM
Sounds like a large log file, this https://github.com/opnsense/core/commit/71a8da452cca02412aab8906c2df0140cc434b28 might help, although the prefixes action will likely still take quite some time due to the size it needs to parse.


To apply the patch, the following command should do the trick:

opnsense-patch 71a8da4


Best regards,

Ad

Its been 24 hours since I've applied the patch and the memory exhaustion errors have not returned. Previously I was getting the exhausting error multiple times an hour, 24 hours a day. Since the patch was applied it has not returned and thus it would seem to indicate that the target of the patch was indeed my issue.

I plan to continue monitoring closely for a while to ensure the error does not return.

Is there an ETA on the update that will contain this patch?

Not yet, usually we keep these on the development branch for at least one release, maybe since this is a relative small fix we can release it earlier, but if that's not the case you can still use patch after an update in the meantime.

Thanks for letting us know this fixes your issue, certainly helps in the release cycle.

Best regards,

Ad

Quote from: AdSchellevis on March 07, 2022, 08:48:42 AM
Not yet, usually we keep these on the development branch for at least one release, maybe since this is a relative small fix we can release it earlier, but if that's not the case you can still use patch after an update in the meantime.

Thanks for letting us know this fixes your issue, certainly helps in the release cycle.

Best regards,

Ad

Final Update: Its been 5 days since I applied the patch and the errors have not returned. At this point I'm comfortable declaring the patch the fix for my issue.

Understood on the release. I'll keep an eye on the patch notes and repatch after updates until I see it show up in the patch notes.

Quote from: AdSchellevis on March 05, 2022, 03:57:55 PM
Sounds like a large log file, this https://github.com/opnsense/core/commit/71a8da452cca02412aab8906c2df0140cc434b28 might help, although the prefixes action will likely still take quite some time due to the size it needs to parse.


To apply the patch, the following command should do the trick:

opnsense-patch 71a8da4


Best regards,

Ad

I applied this patch to the most recent version of OPNSense about a week ago and the errors have not returned.

Thanks,

Al