francodacosta / grav-plugin-page-stats

better page stats for Grav
MIT License
7 stars 4 forks source link

Out of Memory error when installed via Admin Console #19

Closed anders8 closed 2 years ago

anders8 commented 2 years ago

Attempting to install via admin console. Core and all plugins at current rev. Error appears in red popup window after "Dependencies installed" popup:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 177506056 bytes) in /srv/www/[xxxmysite.comxxx]/vendor/symfony/http-client/Response/ResponseTrait.php on line 130 {"error":{"type":"Whoops\\Exception\\ErrorException","message":"Allowed memory size of 134217728 bytes exhausted (tried to allocate 177506056 bytes)","code":1,"file":"\/srv\/www\/[xxxmysite.comxxx]\/vendor\/symfony\/http-client\/Response\/ResponseTrait.php","line":130}}

End result, not installed. 😢 Re-attempting results in same. Tools/Reports shows green checks for all other config.

Server is nginx, "top" on the machine reports: MiB Mem : 1978.855 total, 276.793 free, 646.664 used, 1055.398 buff/cache MiB Swap: 2048.977 total, 1878.227 free, 170.750 used. 1085.695 avail Mem

anders8 commented 2 years ago

Actually... issues via console install also:

 bin/gpm install page-stats
GPM Releases Configuration: Stable
Preparing to install Page Stats [v1.9.3]
  |- Downloading package...     0%PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 2094190 bytes) in /srv/www/[xxxmysite.comxxx]/vendor/symfony/http-client/Response/ResponseTrait.php on line 371
* stopped the pause stream!
* Callback aborted
* Connection #2 to host codeload.github.com left intact
francodacosta commented 2 years ago

@anders8 It seems to me it might be an issue with grav not being able to handle such a big package.

most people work around this by increasing php memory limit in their php.ini or by mnually installing it (just extract the package to user/plugins folder)

Let me know if you need more help

anders8 commented 2 years ago

Installing it manually was ultimately successful, I have three recommendations: 1) Documentation, the "manual install" section doesn't mention that the "configuration" step is required, and while somewhat obvious, the order of those things (configure listed, first, then install) isn't the most streamlined. 2) Without the config done/there, a blurp of errors is the entirety of the tool page. Having a check to see that it was entirely missing would a big benefit. 3) I had to unzip the geo db manually. Everything quietly failed (logged no users/loads) until that was done. Same again, having a check that looks for the geo db before proceeding and warns of it's absence would be great.

Since all of these troubles (from the huge size causing install hassle, to manual install cascading to extra config issues) go back to the large size of the geo db, I humbly submit for consideration: make the geo an optional after-install download. If the plugin worked without it (just didn't have city/country) That would very much still give me 95% of the functionality I'm interested in.

Finally, THANK YOU for building this dude! 👍👍🌞

francodacosta commented 2 years ago

@anders8 want to try out 2.0.0 ?

I moved to a much smaller geolocation db (42Mb instead do the 300MB) all should work fine without exceeding memory limits

(you might want to copy the config file as there are a few ui changes that are now stored in the config) Copy the user/plugins/page-stats/page-stats.yaml to user/config/plugins/page-stats.yaml

anders8 commented 2 years ago

2.0.0 successfully installed via Admin Panel without any hassle. 👍 (And for any readers, no, I never changed any PHP memory limits.)

francodacosta commented 2 years ago

@anders8 perfect!

Let me know of you experience using the plugin, I build it for myself, so i'm not very sure of what other people find useful or not