fix(geoip): raise memory limit so database extraction doesn't fail#20
Merged
Conversation
PharData loads the archive into memory, and the ~60MB GeoLite2-City tarball exhausts the default 128M memory_limit. That kills extraction with an uncatchable fatal Error before the .mmdb is ever written, so the scheduled marketix:geoip:update silently fails and geo lookups return all-null. Raise the limit to 512M for this command, and catch \Throwable around extraction so any remaining failure is reported instead of dying quietly. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The MaxMind GeoLite2-City database was never present on production, so
GeoIpServicehad no reader and every click recorded all-null geo data — even for IPs MaxMind clearly resolves (e.g.45.134.232.50→ Germany/DE).Root cause:
PharDataloads the archive into memory, and the ~60MB GeoLite2-City tarball exhausts the default 128Mmemory_limit. Extraction dies with an uncatchable fatalErrorbefore the.mmdbis written. Because the command'scatchonly caught\Exception, it failed silently — the scheduled dailymarketix:geoip:updatehad been dying at "Extracting…" with no error and no database.Fix
memory_limitto512Mfor this command only (scoped viaini_set), so extraction completes.\Throwable(not just\Exception) around extraction so any future failure is reported instead of dying quietly.Verification
Run manually with the raised limit downloads and saves the DB successfully, and the previously-failing lookup now resolves:
Confirmed on the production server:
/app/storage/app/geoip/GeoLite2-City.mmdb(66MB) present, lookups working. This change makes the scheduled->daily()update succeed on its own going forward (after redeploy).🤖 Generated with Claude Code