nextcloud / nextcloud/terms_of_service

geoip2/geoip2 breaks the execution sometimes

Open
#1,040 0 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

0. Needs triage bug
Dominant language
JavaScript
Stars
40
Forks
23
Avg merge
3d 3h
Merged PRs (30d)
11

Description

How to use GitHub
  • Please use the 👍 reaction to show that you are affected by the same issue.
  • Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
  • Subscribe to receive notifications on status change and new comments.

Steps to reproduce

There are no reproduction steps, only logs:

{"reqId":"wt7OfYLChkfuicb7c9oa","level":3,"time":"2025-01-17T05:50:08+00:00","remoteAddr":"x.x.x.x","user":"user","app":"index","method":"GET","url":"/index.php/apps/files/","message":"MaxMind\\Db\\Reader\\Decoder::decodeByType(): Argument #1 ($type) must be of type int, null given, called in /var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 111 in file '/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php' line 114","userAgent":"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36","version":"29.0.10.3","exception":{"Exception":"Exception","Message":"MaxMind\\Db\\Reader\\Decoder::decodeByType(): Argument #1 ($type) must be of type int, null given, called in /var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 111 in file '/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php' line 114","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1060,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","Line":170,"Previous":{"Exception":"TypeError","Message":"MaxMind\\Db\\Reader\\Decoder::decodeByType(): Argument #1 ($type) must be of type int, null given, called in /var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 111","Code":0,"Trace":[{"file":"/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php","line":111,"function":"decodeByType","class":"MaxMind\\Db\\Reader\\Decoder","type":"->"},{"file":"/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php","line":99,"function":"decode","class":"MaxMind\\Db\\Reader\\Decoder","type":"->"},{"file":"/var/www/html/nextcloud/apps/terms_of_service/lib/CountryDetector.php","line":31,"function":"__construct","class":"MaxMind\\Db\\Reader","type":"->"},{"file":"/var/www/html/nextcloud/apps/terms_of_service/lib/Checker.php","line":95,"function":"getCountry","class":"OCA\\TermsOfService\\CountryDetector","type":"->"},{"file":"/var/www/html/nextcloud/apps/terms_of_service/lib/Filesystem/Helper.php","line":101,"function":"currentUserHasSigned","class":"OCA\\TermsOfService\\Checker","type":"->"},{"file":"/var/www/html/nextcloud/apps/terms_of_service/lib/Filesystem/CacheWrapper.php","line":45,"function":"verifyAccess","class":"OCA\\TermsOfService\\Filesystem\\Helper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php","line":94,"function":"formatCacheEntry","class":"OCA\\TermsOfService\\Filesystem\\CacheWrapper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Node/Root.php","line":495,"function":"get","class":"OC\\Files\\Cache\\Wrapper\\CacheWrapper","type":"->"},{"function":"OC\\Files\\Node\\{closure}","class":"OC\\Files\\Node\\Root","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/nextcloud/lib/private/Files/Node/Root.php","line":493,"function":"array_map"},{"file":"/var/www/html/nextcloud/lib/private/Files/Node/Root.php","line":427,"function":"getByIdInPath","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Files/Node/LazyFolder.php","line":499,"function":"getFirstNodeByIdInPath","class":"OC\\Files\\Node\\Root","type":"->"},{"file":"/var/www/html/nextcloud/apps/files/lib/Activity/Helper.php","line":64,"function":"getFirstNodeById","class":"OC\\Files\\Node\\LazyFolder","type":"->"},{"file":"/var/www/html/nextcloud/apps/files/lib/Controller/ViewController.php","line":208,"function":"getFavoriteNodes","class":"OCA\\Files\\Activity\\Helper","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":232,"function":"index","class":"OCA\\Files\\Controller\\ViewController","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/Http/Dispatcher.php","line":138,"function":"executeController","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/AppFramework/App.php","line":184,"function":"dispatch","class":"OC\\AppFramework\\Http\\Dispatcher","type":"->"},{"file":"/var/www/html/nextcloud/lib/private/Route/Router.php","line":331,"function":"main","class":"OC\\AppFramework\\App","type":"::"},{"file":"/var/www/html/nextcloud/lib/base.php","line":1060,"function":"match","class":"OC\\Route\\Router","type":"->"},{"file":"/var/www/html/nextcloud/index.php","line":49,"function":"handleRequest","class":"OC","type":"::"}],"File":"/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php","Line":114},"message":"MaxMind\\Db\\Reader\\Decoder::decodeByType(): Argument #1 ($type) must be of type int, null given, called in /var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 111 in file '/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php' line 114","exception":{},"CustomMessage":"MaxMind\\Db\\Reader\\Decoder::decodeByType(): Argument #1 ($type) must be of type int, null given, called in /var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php on line 111 in file '/var/www/html/nextcloud/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php' line 114"}}

Potential fix could be updating the geoip2 library and/or catching a Throwable here: https://github.com/nextcloud/terms_of_service/blob/master/lib/CountryDetector.php#L33

thanks to @nickvergessen 💚

Server configuration

Web server: Apache/Nginx

Database: MySQL/Maria/SQLite/PostgreSQL

PHP version: 8.1/8.2/8.3

Nextcloud version: 29.0.10.3

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with lib/CountryDetector.php around line 33 and trace how the geoip2 reader reaches the logged Decoder error. Use the supplied stack trace to investigate the failure, including the dependency version, and determine whether the issue is resolved by an update or by handling the exception. Done means the reported request path no longer breaks when this geoip2 error occurs.

Written by the indexing model from the issue text.

Assessment

Tech stack
php
Domain
backend
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.