nextcloud / server

☁️ Nextcloud server, a safe home for all your data
https://nextcloud.com
GNU Affero General Public License v3.0
27.39k stars 4.07k forks source link

[Bug]: PHP AWS SDK appears to be throwing errors #34729

Closed Daemonslayer2048 closed 2 years ago

Daemonslayer2048 commented 2 years ago

⚠️ This issue respects the following points: ⚠️

Bug description

After upgrading version 24.0.6-apache to 25.0.0-apache I began seeing my NextCloud pod in Kubernetes bouncing. I use S3 storage internally, in the previous version there were no issues, though it would appear that is now causing an issue. After the update I have hundred of logs similar to what is posted below regarding the AWS SDK which appears to hint at an S3 issue.

Steps to reproduce

  1. Deploy NextCloud Apache container (Just in docker should be fine) 2.Define an S3 object store for the container to use 3.Create an admin user
  2. Upload some files
  3. Wait the errors should begin rolling in and the container should crash

Expected behavior

The container should handle s3 object storage without crashing.

Installation method

Community Docker image

Operating system

RHEL/CentOS

PHP engine version

PHP 8.1

Web server

Apache (supported)

Database engine version

MariaDB

Is this bug present after an update or on a fresh install?

Updated to a major version (ex. 22.2.3 to 23.0.1)

Are you using the Nextcloud Server Encryption module?

Encryption is Disabled

What user-backends are you using?

Configuration report

{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwriteprotocol": "https",
        "objectstore": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": "nextcloud-data",
                "key": "***REMOVED SENSITIVE VALUE***",
                "secret": "***REMOVED SENSITIVE VALUE***",
                "region": "",
                "hostname": "rook-ceph-rgw-s3-application-store.rook-ceph.svc",
                "port": "80",
                "objectPrefix": "urn:oid:",
                "autocreate": false,
                "use_ssl": false,
                "use_path_style": true,
                "legacy_auth": true
            }
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.0.18",
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "2587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 0,
        "maintenance": false,
        "theme": "",
        "app_install_overwrite": [
            "unsplash",
            "breezedark"
        ]
    }
}
{
    "system": {
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\APCu",
        "apps_paths": [
            {
                "path": "\/var\/www\/html\/apps",
                "url": "\/apps",
                "writable": false
            },
            {
                "path": "\/var\/www\/html\/custom_apps",
                "url": "\/custom_apps",
                "writable": true
            }
        ],
        "memcache.distributed": "\\OC\\Memcache\\Redis",
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "password": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "overwriteprotocol": "https",
        "objectstore": {
            "class": "\\OC\\Files\\ObjectStore\\S3",
            "arguments": {
                "bucket": "nextcloud-data",
                "key": "***REMOVED SENSITIVE VALUE***",
                "secret": "***REMOVED SENSITIVE VALUE***",
                "region": "",
                "hostname": "rook-ceph-rgw-s3-application-store.rook-ceph.svc",
                "port": "80",
                "objectPrefix": "urn:oid:",
                "autocreate": false,
                "use_ssl": false,
                "use_path_style": true,
                "legacy_auth": true
            }
        },
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "***REMOVED SENSITIVE VALUE***"
        ],
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "dbtype": "mysql",
        "version": "25.0.0.18",
        "overwrite.cli.url": "https:\/\/***REMOVED SENSITIVE VALUE***",
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbport": "",
        "dbtableprefix": "oc_",
        "mysql.utf8mb4": true,
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "installed": true,
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "tls",
        "mail_sendmailmode": "smtp",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauth": 1,
        "mail_smtpauthtype": "LOGIN",
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "2587",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "loglevel": 0,
        "maintenance": false,
        "theme": "",
        "app_install_overwrite": [
            "unsplash",
            "breezedark"
        ]
    }
}

List of activated Apps

Enabled:
  - admin_audit: 1.15.0
  - bruteforcesettings: 2.5.0
  - calendar: 4.0.1
  - circles: 25.0.0
  - cloud_federation_api: 1.8.0
  - comments: 1.15.0
  - contacts: 5.0.1
  - contactsinteraction: 1.6.0
  - dashboard: 7.5.0
  - dav: 1.24.0
  - federatedfilesharing: 1.15.0
  - federation: 1.15.0
  - files: 1.20.1
  - files_pdfviewer: 2.6.0
  - files_rightclick: 1.4.0
  - files_sharing: 1.17.0
  - files_trashbin: 1.15.0
  - files_versions: 1.18.0
  - firstrunwizard: 2.14.0
  - logreader: 2.10.0
  - lookup_server_connector: 1.13.0
  - maps: 0.2.1
  - nextcloud_announcements: 1.14.0
  - notifications: 2.13.1
  - oauth2: 1.13.0
  - onlyoffice: 7.6.6
  - password_policy: 1.15.0
  - photos: 2.0.0
  - privacy: 1.9.0
  - provisioning_api: 1.15.0
  - recommendations: 1.4.0
  - related_resources: 1.0.1
  - richdocuments: 7.0.0
  - serverinfo: 1.15.0
  - settings: 1.7.0
  - sharebymail: 1.15.0
  - support: 1.8.0
  - survey_client: 1.13.0
  - systemtags: 1.15.0
  - text: 3.6.0
  - theming: 2.0.0
  - twofactor_backupcodes: 1.14.0
  - twofactor_totp: 7.0.0
  - updatenotification: 1.15.0
  - user_status: 1.5.0
  - viewer: 1.9.0
  - weather_status: 1.5.0
  - workflowengine: 2.7.0
Disabled:
  - activity: 2.16.0
  - encryption
  - files_external
  - suspicious_login
  - user_ldap

Nextcloud Signing status

Technical information
=====================
The following list covers which files have failed the integrity check. Please read
the previous linked documentation to learn more about the errors and how to fix
them.

Results
=======
- related_resources
    - EXCEPTION
        - OC\IntegrityCheck\Exceptions\InvalidSignatureException
        - Signature data not found.

Raw output
==========
Array
(
    [related_resources] => Array
        (
            [EXCEPTION] => Array
                (
                    [class] => OC\IntegrityCheck\Exceptions\InvalidSignatureException
                    [message] => Signature data not found.
                )

        )

)

Nextcloud Logs

{"reqId":"2sIJC9r72y7aKBQnPcOr","level":3,"time":"2022-10-21T16:14:53+00:00","remoteAddr":"10.42.2.199","user":"DaemonSlayer2048","app":"PHP","method":"GET","url":"/avatar/DaemonSlayer2048/64/dark?v=0","message":"Return type of Aws\\Api\\AbstractModel::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/html/3rdparty/aws/aws-sdk-php/src/Api/AbstractModel.php#46","userAgent":"Mozilla/5.0 (X11; Linux x86_64; rv:105.0) Gecko/20100101 Firefox/105.0","version":"25.0.0.18","exception":{"Exception":"Error","Message":"Return type of Aws\\Api\\AbstractModel::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/html/3rdparty/aws/aws-sdk-php/src/Api/AbstractModel.php#46","Code":0,"Trace":[{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/Api/AbstractModel.php","line":7,"function":"onError","class":"OC\\Log\\ErrorHandler","type":"::","args":[8192,"Return type of Aws\\Api\\AbstractModel::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice","/var/www/html/3rdparty/aws/aws-sdk-php/src/Api/AbstractModel.php",46]},{"file":"/var/www/html/lib/composer/composer/ClassLoader.php","line":571,"args":["/var/www/html/3rdparty/aws/aws-sdk-php/src/Api/AbstractModel.php"],"function":"include"},{"file":"/var/www/html/lib/composer/composer/ClassLoader.php","line":428,"function":"Composer\\Autoload\\includeFile","args":["/var/www/html/3rdparty/composer/../aws/aws-sdk-php/src/Api/AbstractModel.php"]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/Api/Service.php","line":11,"function":"loadClass","class":"Composer\\Autoload\\ClassLoader","type":"->","args":["Aws\\Api\\AbstractModel"]},{"file":"/var/www/html/lib/composer/composer/ClassLoader.php","line":571,"args":["/var/www/html/3rdparty/aws/aws-sdk-php/src/Api/Service.php"],"function":"include"},{"file":"/var/www/html/lib/composer/composer/ClassLoader.php","line":428,"function":"Composer\\Autoload\\includeFile","args":["/var/www/html/3rdparty/composer/../aws/aws-sdk-php/src/Api/Service.php"]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/ClientResolver.php","line":511,"function":"loadClass","class":"Composer\\Autoload\\ClassLoader","type":"->","args":["Aws\\Api\\Service"]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/S3/S3Client.php","line":718,"function":"_apply_api_provider","class":"Aws\\ClientResolver","type":"::","args":[{"__class__":"Aws\\Api\\ApiProvider"},["latest",{"__class__":"Closure"},"http://rook-ceph-rgw-s3-application-store.rook-ceph.svc:80/","eu-west-1",true,{"__class__":"Closure"},false,false,[null],false,"v2",{"__class__":"Closure"},"s3","Aws\\S3\\Exception\\S3Exception",[],"https",false,{"__class__":"Aws\\Api\\ApiProvider"}]]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/ClientResolver.php","line":323,"function":"_applyApiProvider","class":"Aws\\S3\\S3Client","type":"::","args":[{"__class__":"Aws\\Api\\ApiProvider"},["latest",{"__class__":"Closure"},"http://rook-ceph-rgw-s3-application-store.rook-ceph.svc:80/","eu-west-1",true,{"__class__":"Closure"},false,false,[null],false,"v2",{"__class__":"Closure"},"s3","Aws\\S3\\Exception\\S3Exception",[],"https",false,{"__class__":"Aws\\Api\\ApiProvider"}],{"__class__":"Aws\\HandlerList"}]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/AwsClient.php","line":199,"function":"resolve","class":"Aws\\ClientResolver","type":"->","args":[["latest",{"__class__":"Closure"},"http://rook-ceph-rgw-s3-application-store.rook-ceph.svc:80/","eu-west-1",true,{"__class__":"Closure"},false,false,[null],false,"v2",{"__class__":"Closure"},"s3","Aws\\S3\\Exception\\S3Exception",[],"https",false,{"__class__":"Aws\\Api\\ApiProvider"}],{"__class__":"Aws\\HandlerList"}]},{"file":"/var/www/html/3rdparty/aws/aws-sdk-php/src/S3/S3Client.php","line":348,"function":"__construct","class":"Aws\\AwsClient","type":"->","args":[["latest",{"__class__":"Closure"},"http://rook-ceph-rgw-s3-application-store.rook-ceph.svc:80/","eu-west-1",true,{"__class__":"Closure"},false,false,[null],false,"v2",{"__class__":"Closure"},"s3","Aws\\S3\\Exception\\S3Exception"]]},{"file":"/var/www/html/lib/private/Files/ObjectStore/S3ConnectionTrait.php","line":144,"function":"__construct","class":"Aws\\S3\\S3Client","type":"->","args":[["latest",{"__class__":"Closure"},"http://rook-ceph-rgw-s3-application-store.rook-ceph.svc:80/","eu-west-1",true,{"__class__":"Closure"},false,false,[null],false,"v2",{"__class__":"Closure"}]]},{"file":"/var/www/html/lib/private/Files/ObjectStore/S3ObjectTrait.php","line":56,"function":"getConnection","class":"OC\\Files\\ObjectStore\\S3","type":"->","args":[]},{"file":"/var/www/html/lib/private/Files/Stream/SeekableHttpStream.php","line":89,"function":"OC\\Files\\ObjectStore\\{closure}","class":"OC\\Files\\ObjectStore\\S3","type":"->","args":["*** sensitive parameters replaced ***"]},{"file":"/var/www/html/lib/private/Files/Stream/SeekableHttpStream.php","line":161,"function":"reconnect","class":"OC\\Files\\Stream\\SeekableHttpStream","type":"->","args":[0]},{"function":"stream_open","class":"OC\\Files\\Stream\\SeekableHttpStream","type":"->","args":["httpseek://","r",[{"__class__":"Closure"}],null]},{"file":"/var/www/html/lib/private/Files/Stream/SeekableHttpStream.php","line":67,"function":"fopen","args":["httpseek://","r",false,null]},{"file":"/var/www/html/lib/private/Files/ObjectStore/S3ObjectTrait.php","line":88,"function":"open","class":"OC\\Files\\Stream\\SeekableHttpStream","type":"::","args":[{"__class__":"Closure"}]},{"file":"/var/www/html/lib/private/Files/ObjectStore/ObjectStoreStorage.php","line":312,"function":"readObject","class":"OC\\Files\\ObjectStore\\S3","type":"->","args":["urn:oid:29301"]},{"file":"/var/www/html/lib/private/Files/Storage/Common.php","line":199,"function":"fopen","class":"OC\\Files\\ObjectStore\\ObjectStoreStorage","type":"->","args":["appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png","r"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Wrapper.php","line":247,"function":"file_get_contents","class":"OC\\Files\\Storage\\Common","type":"->","args":["appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png"]},{"file":"/var/www/html/lib/private/Files/Storage/Wrapper/Availability.php","line":264,"function":"file_get_contents","class":"OC\\Files\\Storage\\Wrapper\\Wrapper","type":"->","args":["appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png"]},{"file":"/var/www/html/lib/private/Files/View.php","line":1181,"function":"file_get_contents","class":"OC\\Files\\Storage\\Wrapper\\Availability","type":"->","args":["appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png"]},{"file":"/var/www/html/lib/private/Files/View.php","line":600,"function":"basicOperation","class":"OC\\Files\\View","type":"->","args":["file_get_contents","/appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png",["read"]]},{"file":"/var/www/html/lib/private/Files/Node/File.php","line":56,"function":"file_get_contents","class":"OC\\Files\\View","type":"->","args":["/appdata_ocur2parbq4r/avatar/DaemonSlayer2048/avatar-dark.64.png"]},{"file":"/var/www/html/lib/private/Files/SimpleFS/SimpleFile.php","line":74,"function":"getContent","class":"OC\\Files\\Node\\File","type":"->","args":[]},{"file":"/var/www/html/lib/public/AppFramework/Http/FileDisplayResponse.php","line":68,"function":"getContent","class":"OC\\Files\\SimpleFS\\SimpleFile","type":"->","args":[]},{"file":"/var/www/html/lib/private/AppFramework/App.php","line":229,"function":"callback","class":"OCP\\AppFramework\\Http\\FileDisplayResponse","type":"->","args":[{"__class__":"OC\\AppFramework\\Http\\Output"}]},{"file":"/var/www/html/lib/private/Route/Router.php","line":298,"function":"main","class":"OC\\AppFramework\\App","type":"::","args":["OC\\Core\\Controller\\AvatarController","getAvatarDark",{"__class__":"OC\\AppFramework\\DependencyInjection\\DIContainer"},["DaemonSlayer2048","64","core.avatar.getAvatarDark"]]},{"file":"/var/www/html/lib/base.php","line":1047,"function":"match","class":"OC\\Route\\Router","type":"->","args":["/avatar/DaemonSlayer2048/64/dark"]},{"file":"/var/www/html/index.php","line":36,"function":"handleRequest","class":"OC","type":"::","args":[]}],"File":"/var/www/html/lib/private/Log/ErrorHandler.php","Line":92,"CustomMessage":"--"},"id":"6352c57d9b62e"}

Additional info

No response

jgillich commented 2 years ago

Seeing the same issue on v25:

Return type of Aws\Endpoint\Partition::offsetUnset($offset) should either be compatible with ArrayAccess::offsetUnset(mixed $offset): void, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice at /var/www/html/3rdparty/aws/aws-sdk-php/src/HasDataTrait.php#46

Literally thousands of entries in the log file, reaching hundreds of megabytes within hours after installation

josephsellers commented 2 years ago

It looks to me as though there are compatibilty issues with aws-sdk-php and php 8.1. Nextcloud is running a pretty out of date version of aws-sdk-php (version 3.184.6). This version is from June 2021 which considering php 8.1 is reasonably new is quite a way out of date.

Work has been done on aws-sdk-php since to make it better compatible with php 8.1. Is there any chance this could be bumped to a more recent version?

Seems to me it could solve quite a few S3 storage related issues.

PVince81 commented 2 years ago

closing in favor of https://github.com/nextcloud/server/issues/34787 (which is already assigned for resolution)