Skip to content

fix(geoip): raise memory limit so database extraction doesn't fail#20

Merged
DGINXREAL merged 1 commit into
mainfrom
fix/geoip-update-memory-limit
Jun 19, 2026
Merged

fix(geoip): raise memory limit so database extraction doesn't fail#20
DGINXREAL merged 1 commit into
mainfrom
fix/geoip-update-memory-limit

Conversation

@DGINXREAL

Copy link
Copy Markdown
Member

Problem

The MaxMind GeoLite2-City database was never present on production, so GeoIpService had 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: PharData loads the archive into memory, and the ~60MB GeoLite2-City tarball exhausts the default 128M memory_limit. Extraction dies with an uncatchable fatal Error before the .mmdb is written. Because the command's catch only caught \Exception, it failed silently — the scheduled daily marketix:geoip:update had been dying at "Extracting…" with no error and no database.

Fix

  • Raise memory_limit to 512M for this command only (scoped via ini_set), so extraction completes.
  • Catch \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:

45.134.232.50 → country: "Germany", country_code: "DE"

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

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>
@DGINXREAL DGINXREAL requested a review from noidee-dev as a code owner June 19, 2026 09:18
@DGINXREAL DGINXREAL merged commit 70a816d into main Jun 19, 2026
3 checks passed
@DGINXREAL DGINXREAL deleted the fix/geoip-update-memory-limit branch June 19, 2026 09:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant