Skip to content

geoip2/geoip2 breaks the execution sometimes #1040

@kyteinsky

Description

@kyteinsky

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions