Skip to content

Random timeouts on fread() in MaxMind/Db/Reader/Util.php:18 #1147

@Xaymar

Description

@Xaymar

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

  1. Install the App in Nextcloud
  2. Upload/Download any number of files.
  3. Random requests will take several minutes to complete, or even hit the timeout of 5 minutes and be terminated on the spot.

Expected behaviour

This GeoIP check likely shouldn't even be running if the user has already agreed to the ToS, much less on every single request.

Actual behaviour

About 1 in 100 requests times out and results in the PHP process being terminated due to that. Below is the stacktrace, every single one of these is identical except for the pid:

[02-Mar-2026 21:19:07]  [pool www] pid 852518
script_filename = /mnt/main/nextcloud/web/remote.php
[0x00007fa8a7016520] fread() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Util.php:18
[0x00007fa8a7016460] read() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php:128
[0x00007fa8a70163a0] decodeByType() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.>
[0x00007fa8a70162b0] decode() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php:237
[0x00007fa8a70161e0] decodeMap() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.php>
[0x00007fa8a7016120] decodeByType() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader/Decoder.>
[0x00007fa8a7016030] decode() /mnt/main/nextcloud/web/apps/terms_of_service/vendor/maxmind-db/reader/src/MaxMind/Db/Reader.php:99
[0x00007fa8a7015f40] __construct() /mnt/main/nextcloud/web/apps/terms_of_service/lib/CountryDetector.php:31
[0x00007fa8a7015ea0] getCountry() /mnt/main/nextcloud/web/apps/terms_of_service/lib/Checker.php:100
[0x00007fa8a7015da0] currentUserHasSigned() /mnt/main/nextcloud/web/apps/terms_of_service/lib/Filesystem/Helper.php:101
[0x00007fa8a7015d30] verifyAccess() /mnt/main/nextcloud/web/apps/terms_of_service/lib/Filesystem/CacheWrapper.php:45
[0x00007fa8a7015cc0] formatCacheEntry() /mnt/main/nextcloud/web/lib/private/Files/Cache/Wrapper/CacheWrapper.php:110
[0x00007fa8a7015c50] array_map() /mnt/main/nextcloud/web/lib/private/Files/Cache/Wrapper/CacheWrapper.php:110
[0x00007fa8a7015bc0] getFolderContentsById() /mnt/main/nextcloud/web/lib/private/Files/View.php:1514
[0x00007fa8a7015920] getDirectoryContent() /mnt/main/nextcloud/web/lib/private/Files/Node/Folder.php:82
[0x00007fa8a70158b0] getDirectoryListing() /mnt/main/nextcloud/web/apps/dav/lib/Connector/Sabre/Directory.php:250
[0x00007fa8a70157c0] getChildren() /mnt/main/nextcloud/web/3rdparty/sabre/dav/lib/DAV/Tree.php:218
[0x00007fa89d6579c0] getChildren() /mnt/main/nextcloud/web/3rdparty/sabre/dav/lib/DAV/Server.php:900
[0x00007fa89d663d40] generatePathNodes() /mnt/main/nextcloud/web/3rdparty/sabre/dav/lib/DAV/Server.php:982
[0x00007fa89d6da440] getPropertiesIteratorForPath() /mnt/main/nextcloud/web/3rdparty/sabre/dav/lib/DAV/Server.php:1664

Turning off the app fixes the issue entirely.

Server configuration

  • Web server: nginx
  • Database: PostgreSQL + Redis + APCu
  • PHP version: 8.4
  • Nextcloud version: 32.0.6
List of activated apps
root@merenka:/mnt/main/nextcloud/web# php occ app:list
Enabled:
  - activity: 5.0.0
  - admin_audit: 1.22.0
  - app_api: 32.0.0
  - bruteforcesettings: 5.0.0
  - calendar: 6.2.1
  - camerarawpreviews: 0.8.8
  - circles: 32.0.0
  - cloud_federation_api: 1.16.0
  - collectives: 3.6.1
  - comments: 1.22.0
  - contacts: 8.3.4
  - contactsinteraction: 1.13.1
  - dashboard: 7.12.0
  - dav: 1.34.2
  - dav_push: 1.0.1
  - encryption: 2.20.0
  - end_to_end_encryption: 1.18.1
  - epubviewer: 1.9.2
  - federatedfilesharing: 1.22.0
  - files: 2.4.0
  - files_accesscontrol: 3.0.2
  - files_downloadlimit: 5.0.0-dev.0
  - files_pdfviewer: 5.0.0
  - files_photospheres: 1.32.0
  - files_reminders: 1.5.0
  - files_sharing: 1.24.1
  - files_trashbin: 1.22.0
  - files_versions: 1.25.0
  - firstrunwizard: 5.0.0
  - forms: 5.2.4
  - groupfolders: 20.1.12
  - logreader: 5.0.0
  - lookup_server_connector: 1.20.0
  - memories: 7.8.2
  - music: 3.0.0
  - notes: 4.13.0
  - notifications: 5.0.0
  - notify_push: 1.3.0
  - oauth2: 1.20.0
  - password_policy: 4.0.0
  - photos: 5.0.0
  - previewgenerator: 5.13.0
  - privacy: 4.0.0
  - profile: 1.1.0
  - provisioning_api: 1.22.0
  - recognize: 10.0.7
  - recommendations: 5.0.0
  - related_resources: 3.0.0
  - richdocuments: 9.0.3
  - serverinfo: 4.0.0
  - settings: 1.15.1
  - spreed: 22.0.9
  - suspicious_login: 10.0.0
  - systemtags: 1.22.0
  - tables: 1.0.4
  - text: 6.0.1
  - theming: 2.7.0
  - twofactor_backupcodes: 1.21.0
  - twofactor_nextcloud_notification: 6.0.0
  - unroundedcorners: 1.1.5
  - updatenotification: 1.22.0
  - user_status: 1.12.0
  - viewer: 5.0.0
  - webhook_listeners: 1.3.0
  - workflowengine: 2.14.0
Disabled:
  - audiocoverpreview: 0.9.0 (installed 0.9.0)
  - audiowaveform_preview_provider: 0.3.0 (installed 0.3.0)
  - federation: 1.22.0 (installed 1.22.0)
  - files_archive: 1.2.8 (installed 1.2.8)
  - files_external: 1.24.1
  - fulltextsearch_elasticsearch: 32.0.2 (installed 32.0.2)
  - fulltextsearch_sql: 1.3.3 (installed 1.3.3)
  - integration_deepl: 2.1.0 (installed 2.1.0)
  - journeys: 0.20.2 (installed 0.20.2)
  - localthumbs: 1.0.1 (installed 1.0.1)
  - nextcloud_announcements: 4.0.0 (installed 4.0.0-dev.0)
  - sharebymail: 1.22.0 (installed 1.22.0)
  - support: 4.0.0 (installed 4.0.0-dev.0)
  - survey_client: 4.0.0 (installed 4.0.0-dev.0)
  - tasks: 0.17.1 (installed 0.17.1)
  - terms_of_service: 4.6.1 (installed 4.6.1)
  - twofactor_totp: 14.0.0 (installed 14.0.0)
  - user_ldap: 1.23.0
  - weather_status: 1.12.0 (installed 1.12.0)
  - whiteboard: 1.5.7 (installed 1.5.7)
Nextcloud configuration
{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "htaccess.RewriteBase": "\/",
        "htaccess.IgnoreFrontController": true,
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "pgsql",
        "version": "32.0.6.1",
        "overwrite.cli.url": "***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbtableprefix": "oc_",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "dbpersistent": "true",
        "installed": true,
        "forbidden_filename_basenames": [
            "con",
            "prn",
            "aux",
            "nul",
            "com0",
            "com1",
            "com2",
            "com3",
            "com4",
            "com5",
            "com6",
            "com7",
            "com8",
            "com9",
            "com\u00b9",
            "com\u00b2",
            "com\u00b3",
            "lpt0",
            "lpt1",
            "lpt2",
            "lpt3",
            "lpt4",
            "lpt5",
            "lpt6",
            "lpt7",
            "lpt8",
            "lpt9",
            "lpt\u00b9",
            "lpt\u00b2",
            "lpt\u00b3"
        ],
        "forbidden_filename_characters": [
            "<",
            ">",
            ":",
            "\"",
            "|",
            "?",
            "*",
            "\\",
            "\/"
        ],
        "forbidden_filename_extensions": [
            " ",
            ".",
            ".filepart",
            ".part"
        ],
        "maintenance": false,
        "maintenance_window_start": 5,
        "defaultapp": "files",
        "default_phone_region": "DE",
        "filelocking.enabled": true,
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "log_rotate_size": 1048576,
        "memories.db.triggers.fcu": true,
        "memories.exiftool": "\/mnt\/main\/nextcloud\/web\/apps\/memories\/bin-ext\/exiftool-amd64-glibc",
        "memories.vod.path": "\/mnt\/main\/nextcloud\/web\/apps\/memories\/bin-ext\/go-vod-amd64",
        "memories.vod.ffmpeg": "\/usr\/bin\/ffmpeg",
        "memories.vod.ffprobe": "\/usr\/bin\/ffprobe",
        "app_install_overwrite": [],
        "theme": "",
        "loglevel": 2,
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379,
            "timeout": 0,
            "read_timeout": 0,
            "user": "nextcloud",
            "password": "***REMOVED SENSITIVE VALUE***",
            "dbindex": 1
        },
        "enable_previews": true,
        "preview_concurrency_all": 2048,
        "preview_concurrency_new": 24,
        "enabledPreviewProviders": [
            "OC\\Preview\\Image",
            "OC\\Preview\\BMP",
            "OC\\Preview\\EMF",
            "OC\\Preview\\GIF",
            "OC\\Preview\\HEIC",
            "OC\\Preview\\Illustrator",
            "OC\\Preview\\JPEG",
            "OC\\Preview\\Krita",
            "OC\\Preview\\Photoshop",
            "OC\\Preview\\PNG",
            "OC\\Preview\\SGI",
            "OC\\Preview\\SVG",
            "OC\\Preview\\TGA",
            "OC\\Preview\\TIFF",
            "OC\\Preview\\WebP",
            "OC\\Preview\\XBitmap",
            "OC\\Preview\\Movie",
            "OC\\Preview\\Imaginary",
            "OC\\Preview\\ImaginaryPDF",
            "OC\\Preview\\MarkDown",
            "OC\\Preview\\MSOffice2003",
            "OC\\Preview\\MSOffice2007",
            "OC\\Preview\\MSOfficeDoc",
            "OC\\Preview\\Office",
            "OC\\Preview\\OpenDocument",
            "OC\\Preview\\PDF",
            "OC\\Preview\\StarOffice",
            "OC\\Preview\\TXT",
            "OC\\Preview\\MP3",
            "OC\\Preview\\Font",
            "OC\\Preview\\Postscript"
        ],
        "preview_max_memory": 2048,
        "preview_ffmpeg_path": "\/usr\/bin\/ffmpeg",
        "files.chunked_upload.max_size": 262144,
        "files.chunked_upload.max_parallel_count": 24
    }
}

Browser

Irrelevant, happens with any of the Nextcloud apps on any of their versions.

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