docker-pi-hole icon indicating copy to clipboard operation
docker-pi-hole copied to clipboard

Historical Data: PHP Fatal error: Allowed memory size exhausted

Open lue30499 opened this issue 5 years ago • 10 comments

In raising this issue, I confirm the following:

How familiar are you with the the source code relevant to this issue?:

2


Expected behaviour:

All of my >800k historical data to show

Actual behaviour:

Does show short term data but data larger than a 4 weeks worth errors with:

In web browser debug log Server Error 500 and in "/var/log/lighttpd/error.log" "FastCGI-stderr: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted"

Steps to reproduce:

In pihole 4.x it would show all my data. Ill I did was upgrade to the beta. (I am running this in docker)

I did try a fresh container and copied the pihole-FTL.db into it with the same results.

Debug token provided by uploading pihole -d log:

1rxn14fgtj

Troubleshooting undertaken, and/or other relevant information: I am running the beta.

All that happened was an upgrade. I did fix the error and make all my data show by putting: " ini_set('memory_limit', '1024M'); " At the top of the " /var/www/html/admin/api_db.php "

lue30499 avatar Apr 03 '20 13:04 lue30499

I have the same issue

2020-05-07 10:42:00: (mod_fastcgi.c.2543) FastCGI-stderr: PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 606208 bytes) in /var/www/html/admin/api.php on line 139

ayasystems avatar May 07 '20 08:05 ayasystems

The default memory allocation for PHP is 128M, you'll need to increase that limit if you want to access larger time periods.

dschaper avatar May 07 '20 11:05 dschaper

Where should be changed?? REgards!

ayasystems avatar May 08 '20 06:05 ayasystems

@ayasystems

I was able to fix the issue by hoping into the container (docker exec -it docker_ID bash)

Then I installed nano (apt update && apt install nano) then I edited the api_db.php (nano /var/www/html/admin/api_db.php) and added ini_set('memory_limit', '1024M'); just under the other ini_set. If that makes sense.

I would hope in the future as its a docker container and therefore an isolated environment that maybe there could be an environment variable on run of the container to configure this php setting? @dschaper what would your opinion be?

Regards, Lue

lue30499 avatar May 08 '20 07:05 lue30499

@lue30499

I've test it:

Create 01-memory.ini file within folder php memory_limit = 256M

Mount it mapped to \etc\php\7.0\cgi\conf.d

I'll try .....

ayasystems avatar May 08 '20 08:05 ayasystems

Just want to confirm that the "hack" works for me, too.

I created ./php/7.0/mods-available/memory.ini with the new memory_limit at host and inserted the bind at volumes into my docker-compose.yml: - ./php/7.0/mods-available/memory.ini:/etc/php/7.0/cgi/conf.d/01-memory.ini

BlackF09 avatar Sep 27 '20 23:09 BlackF09

Meanwhile the settings needs to be made for php 7.3 and I also needed 512MB 😁 For me that was memory_limit = 512M with - ./pihole/memory.ini:/etc/php/7.3/cgi/conf.d/01-memory.ini:ro.

pbek avatar Jan 19 '21 09:01 pbek

For long-term data query log of 3M DNS requests I needed 1.5GB memory. Found out by monitoring with portainer and config changes as follows: added to docker_run.sh -v "${PIHOLE_BASE}/memory.ini:/etc/php/7.3/cgi/conf.d/01-memory.ini:ro" \ and contents of ${PIHOLE_BASE}/memory.ini memory_limit = -1 I have no clue why I didn't run into this limitation earlier. This deserves a nicer solution.

Doemaas avatar Jan 30 '21 13:01 Doemaas

Aha, Pi-hole v6.0 with query pagination will solve this. :)

Doemaas avatar Jan 30 '21 14:01 Doemaas

Note: Fixed by https://github.com/pi-hole/AdminLTE/pull/2114

rdwebdesign avatar Apr 05 '22 03:04 rdwebdesign

Closing, as this was fixed by https://github.com/pi-hole/AdminLTE/pull/2114

rdwebdesign avatar Oct 17 '22 21:10 rdwebdesign