docker-pi-hole
docker-pi-hole copied to clipboard
Historical Data: PHP Fatal error: Allowed memory size exhausted
In raising this issue, I confirm the following:
- [x] I have read and understood the contributors guide.
- [X] The issue I am reporting can be replicated.
- [X] The issue I am reporting isn't a duplicate (see FAQs, closed issues, and open issues).
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 "
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
The default memory allocation for PHP is 128M, you'll need to increase that limit if you want to access larger time periods.
Where should be changed?? REgards!
@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
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 .....
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
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.
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.
Aha, Pi-hole v6.0 with query pagination will solve this. :)
Note: Fixed by https://github.com/pi-hole/AdminLTE/pull/2114
Closing, as this was fixed by https://github.com/pi-hole/AdminLTE/pull/2114