nextcloud / files_antivirus

👾 Antivirus app for Nextcloud Files
https://apps.nextcloud.com/apps/files_antivirus
GNU Affero General Public License v3.0
81 stars 33 forks source link

Background cron job for files_antivirus emits fatal (=level 4) exception: "etag is not a valid attribute" #222

Open ToonvdPas opened 2 years ago

ToonvdPas commented 2 years ago

Steps to reproduce

  1. Just run Nextcloud, with the files_antivirus app installed and active.
  2. We use a cron job: /15 * cd /var/www/html/nextcloud; /opt/rh/rh-php73/root/bin/php -f /var/www/html/nextcloud/cron.php
  3. Notice the error messages (level 4) in the nextcloud log, every time the cron job runs.

Expected behaviour

Expected behaviour would be that files are scanned successfully, and that the scanned files are registered in the table oc_files_antivirus.

Actual behaviour

The files are scanned successfully, but then the function updateCheckTime() fails to insert a record into oc_files_antivirus for every file. An error message "message":"OCA\Files_Antivirus\Item::updateCheckTime, exception: etag is not a valid attribute" is logged (the fragment below is logged in debug level):

Jan 27 10:45:03 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:03+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Start background scan","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scanning file with fileid: 351042","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scan started File: 351042 Account: pat Path: /pat/files/Juridische Hulp/Juridisch Loket Utrecht.txt","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scan is done File: 351042 Account: pat Path: /pat/files/Juridische Hulp/Juridisch Loket Utrecht.txt","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Response :: stream: OK\n","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":4,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"OCA\Files_Antivirus\Item::updateCheckTime, exception: etag is not a valid attribute","userAgent":"--","version":"22.2.3.0"} Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scanning file with fileid: 518892","userAgent":"--","version":"22.2.3.0"}

It appears that synced files are scanned and a record is inserted wit a NULL etag:

MariaDB [clouddb]> select fileid, FROM_UNIXTIME(check_time) as check_time, etag from oc_files_antivirus where etag is NULL order by check_time desc limit 10;
+---------+---------------------+------+
| fileid  | check_time          | etag |
+---------+---------------------+------+
| 1028835 | 2022-01-27 13:00:10 | NULL |
| 1028834 | 2022-01-27 12:30:10 | NULL |
| 1028833 | 2022-01-27 12:30:10 | NULL |
| 1028831 | 2022-01-27 11:15:09 | NULL |
| 1028806 | 2022-01-26 19:15:09 | NULL |
| 1028816 | 2022-01-26 19:15:09 | NULL |
| 1028803 | 2022-01-26 18:15:10 | NULL |
| 1028802 | 2022-01-26 17:45:10 | NULL |
| 1028800 | 2022-01-26 10:45:10 | NULL |
| 1028788 | 2022-01-26 02:45:08 | NULL |
+---------+---------------------+------+

The relevant table definitions are as follows:

MariaDB [clouddb]> show create table oc_files_antivirus;
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table              | Create Table                                                                                                                                                                                                                                                                                       |
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| oc_files_antivirus | CREATE TABLE `oc_files_antivirus` (
  `fileid` bigint(20) unsigned NOT NULL,
  `check_time` int(10) unsigned NOT NULL DEFAULT 0,
  `etag` varchar(40) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`fileid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED |
+--------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

MariaDB [clouddb]> show create table oc_filecache;
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Table        | Create Table                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     |
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| oc_filecache | CREATE TABLE `oc_filecache` (
  `fileid` bigint(20) NOT NULL AUTO_INCREMENT,
  `storage` bigint(20) NOT NULL DEFAULT 0,
  `path` varchar(4000) COLLATE utf8mb4_bin DEFAULT NULL,
  `path_hash` varchar(32) COLLATE utf8mb4_bin NOT NULL DEFAULT '',
  `parent` bigint(20) NOT NULL DEFAULT 0,
  `name` varchar(250) COLLATE utf8mb4_bin DEFAULT NULL,
  `mimetype` bigint(20) NOT NULL DEFAULT 0,
  `mimepart` bigint(20) NOT NULL DEFAULT 0,
  `size` bigint(20) NOT NULL DEFAULT 0,
  `mtime` bigint(20) NOT NULL DEFAULT 0,
  `storage_mtime` bigint(20) NOT NULL DEFAULT 0,
  `encrypted` int(11) NOT NULL DEFAULT 0,
  `unencrypted_size` bigint(20) NOT NULL DEFAULT 0,
  `etag` varchar(40) COLLATE utf8mb4_bin DEFAULT NULL,
  `permissions` int(11) DEFAULT 0,
  `checksum` varchar(255) COLLATE utf8mb4_bin DEFAULT NULL,
  PRIMARY KEY (`fileid`),
  UNIQUE KEY `fs_storage_path_hash` (`storage`,`path_hash`),
  KEY `fs_parent_name_hash` (`parent`,`name`(191)),
  KEY `fs_storage_mimetype` (`storage`,`mimetype`),
  KEY `fs_storage_mimepart` (`storage`,`mimepart`),
  KEY `fs_storage_size` (`storage`,`size`,`fileid`),
  KEY `fs_mtime` (`mtime`),
  KEY `fs_size` (`size`)
) ENGINE=InnoDB AUTO_INCREMENT=1028836 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=COMPRESSED |
+--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+

Server configuration

Operating system: CentOS Linux release 7.9.2009

Web server: httpd (Apache) 2.4.6-97.el7.centos.2

Database: MariaDB 10.6.5-1.el7.centos

PHP version: 7.3.29

Nextcloud version: 22.2.3

Where did you install Nextcloud from: nextcloud.com

List of activated apps:

Enabled:
  - accessibility: 1.8.0
  - activity: 2.15.0
  - bruteforcesettings: 2.3.0
  - circles: 22.1.1
  - cloud_federation_api: 1.5.0
  - comments: 1.12.0
  - contactsinteraction: 1.3.0
  - dashboard: 7.2.0
  - dav: 1.19.0
  - federatedfilesharing: 1.12.0
  - federation: 1.12.0
  - files: 1.17.0
  - files_antivirus: 3.2.2
  - files_external: 1.13.0
  - files_pdfviewer: 2.3.1
  - files_rightclick: 1.1.0
  - files_sharing: 1.14.0
  - files_trashbin: 1.12.0
  - files_versions: 1.15.0
  - firstrunwizard: 2.11.0
  - logreader: 2.7.0
  - lookup_server_connector: 1.10.0
  - nextcloud_announcements: 1.11.0
  - notifications: 2.10.1
  - oauth2: 1.10.0
  - password_policy: 1.12.0
  - photos: 1.4.0
  - privacy: 1.6.0
  - provisioning_api: 1.12.0
  - recommendations: 1.1.0
  - serverinfo: 1.12.0
  - settings: 1.4.0
  - sharebymail: 1.12.0
  - support: 1.5.0
  - survey_client: 1.10.0
  - systemtags: 1.12.0
  - text: 3.3.0
  - theming: 1.13.0
  - twofactor_backupcodes: 1.11.0
  - updatenotification: 1.12.0
  - user_status: 1.2.0
  - viewer: 1.6.0
  - weather_status: 1.2.0
  - workflowengine: 2.4.0
Disabled:
  - admin_audit
  - encryption
  - files_texteditor
  - files_videoplayer
  - user_ldap

Nextcloud configuration:

{
    "system": {
        "instanceid": "***REMOVED SENSITIVE VALUE***",
        "passwordsalt": "***REMOVED SENSITIVE VALUE***",
        "secret": "***REMOVED SENSITIVE VALUE***",
        "trusted_domains": [
            "owncloud",
            "owncloud.vanvergehaald.nl"
        ],
        "default_language": "en",
        "default_phone_region": "NL",
        "datadirectory": "***REMOVED SENSITIVE VALUE***",
        "overwrite.cli.url": "https:\/\/owncloud.vanvergehaald.nl",
        "dbtype": "mysql",
        "version": "22.2.3.0",
        "installed": true,
        "maintenance": false,
        "appstoreenabled": true,
        "dbname": "***REMOVED SENSITIVE VALUE***",
        "dbhost": "***REMOVED SENSITIVE VALUE***",
        "dbuser": "***REMOVED SENSITIVE VALUE***",
        "dbpassword": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpmode": "smtp",
        "mail_smtpsecure": "ssl",
        "mail_from_address": "***REMOVED SENSITIVE VALUE***",
        "mail_domain": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpauthtype": "PLAIN",
        "mail_smtpauth": 1,
        "mail_smtphost": "***REMOVED SENSITIVE VALUE***",
        "mail_smtpport": "465",
        "mail_smtpname": "***REMOVED SENSITIVE VALUE***",
        "mail_smtppassword": "***REMOVED SENSITIVE VALUE***",
        "log_type": "syslog",
        "logtimezone": "Europe\/Amsterdam",
        "loglevel": 2,
        "forcessl": true,
        "forceSSLforSubdomains": true,
        "trashbin_retention_obligation": "auto,14",
        "theme": "",
        "updatechecker": false,
        "htaccess.RewriteBase": "\/",
        "memcache.local": "\\OC\\Memcache\\Redis",
        "redis": {
            "host": "***REMOVED SENSITIVE VALUE***",
            "port": 6379
        },
        "memcache.locking": "\\OC\\Memcache\\Redis",
        "preview_max_scale_factor": 1,
        "enabledPreviewProviders": {
            "0": "OC\\Preview\\PNG",
            "1": "OC\\Preview\\JPEG",
            "2": "OC\\Preview\\GIF",
            "11": "OC\\Preview\\Illustrator",
            "12": "OC\\Preview\\Postscript",
            "13": "OC\\Preview\\Photoshop",
            "14": "OC\\Preview\\TIFF"
        },
        "mysql.utf8mb4": true,
        "data-fingerprint": "e0418c936519e9aec4dadfc5d2be50ae"
    },
    "apps": {
        "accessibility": {
            "enabled": "yes",
            "installed_version": "1.8.0",
            "types": ""
        },
        "activity": {
            "enabled": "yes",
            "installed_version": "2.15.0",
            "signed": "true",
            "types": "filesystem"
        },
        "announcementcenter": {
            "enabled": "no",
            "installed_version": "1.1.2",
            "ocsid": "173921",
            "signed": "true",
            "types": ""
        },
        "backgroundjob": {
            "lastjob": "7666"
        },
        "bruteforcesettings": {
            "enabled": "yes",
            "installed_version": "2.3.0",
            "types": ""
        },
        "circles": {
            "enabled": "yes",
            "installed_version": "22.1.1",
            "loopback_tmp_scheme": "https",
            "maintenance_run": "0",
            "maintenance_update": "{\"maximum\":3,\"3\":1643286606,\"2\":1643289302,\"1\":1643289302,\"4\":1643248805,\"5\":1642820405}",
            "types": "filesystem,dav"
        },
        "cloud_federation_api": {
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": "filesystem"
        },
        "comments": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "logging"
        },
        "configreport": {
            "enabled": "no",
            "installed_version": "0.2.0",
            "types": "filesystem"
        },
        "contactsinteraction": {
            "enabled": "yes",
            "installed_version": "1.3.0",
            "types": "dav"
        },
        "core": {
            "backgroundjobs_mode": "cron",
            "global_cache_gc_lastrun": "1436722767",
            "installed.bundles": "[\"CoreBundle\"]",
            "installedat": "1427884921.7791",
            "lastcron": "1643289303",
            "lastupdateResult": "[]",
            "lastupdatedat": "1643289721",
            "moveavatarsdone": "yes",
            "oc.integritycheck.checker": "[]",
            "previewsCleanedUp": "1",
            "public_files": "files_sharing\/public.php",
            "public_gallery": "gallery\/public.php",
            "public_webdav": "dav\/appinfo\/v1\/publicwebdav.php",
            "remote_caldav": "dav\/appinfo\/v1\/caldav.php",
            "remote_calendar": "dav\/appinfo\/v1\/caldav.php",
            "remote_carddav": "dav\/appinfo\/v1\/carddav.php",
            "remote_contacts": "dav\/appinfo\/v1\/carddav.php",
            "remote_dav": "dav\/appinfo\/v2\/remote.php",
            "remote_files": "dav\/appinfo\/v1\/webdav.php",
            "remote_webdav": "dav\/appinfo\/v1\/webdav.php",
            "repairlegacystoragesdone": "yes",
            "shareapi_allow_mail_notification": "yes",
            "shareapi_allow_public_notification": "yes",
            "shareapi_allow_public_upload": "no",
            "shareapi_default_expire_date": "yes",
            "shareapi_expire_after_n_days": "30",
            "shareapi_only_share_with_group_members": "no",
            "shareapi_only_share_with_membership_groups": "no",
            "theming.variables": "b92d206521717ac032f8aa58d3c7ff2f",
            "umgmt_send_email": "true",
            "umgmt_show_email": "true",
            "umgmt_show_is_enabled": "true",
            "umgmt_show_last_login": "true",
            "umgmt_show_storage_location": "true",
            "updater.secret.created": "1641297355",
            "vendor": "nextcloud"
        },
        "dashboard": {
            "enabled": "yes",
            "installed_version": "7.2.0",
            "types": ""
        },
        "dav": {
            "buildCalendarReminderIndex": "yes",
            "buildCalendarSearchIndex": "yes",
            "chunks_migrated": "1",
            "enabled": "yes",
            "installed_version": "1.19.0",
            "regeneratedBirthdayCalendarsForYearFix": "yes",
            "types": "filesystem"
        },
        "federatedfilesharing": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": ""
        },
        "federation": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "authentication"
        },
        "files": {
            "cronjob_scan_files": "500",
            "enabled": "yes",
            "installed_version": "1.17.0",
            "types": "filesystem"
        },
        "files_antivirus": {
            "av_cmd_options": "",
            "av_host": "127.0.0.1",
            "av_infected_action": "delete",
            "av_max_file_size": "-1",
            "av_mode": "socket",
            "av_path": "\/usr\/bin\/clamscan",
            "av_port": "3310",
            "av_socket": "\/var\/run\/clamd.scan\/clamd.sock",
            "av_stream_max_length": "10485760",
            "enabled": "yes",
            "installed_version": "3.2.2",
            "signed": "true",
            "types": "filesystem,dav"
        },
        "files_external": {
            "enabled": "yes",
            "installed_version": "1.13.0",
            "types": "filesystem",
            "user_certificate_scan": ""
        },
        "files_locking": {
            "enabled": "no",
            "installed_version": "",
            "types": "filesystem"
        },
        "files_mediaviewer": {
            "enabled": "no",
            "installed_version": "1.0.3",
            "signed": "true",
            "types": ""
        },
        "files_pdfviewer": {
            "enabled": "yes",
            "installed_version": "2.3.1",
            "signed": "true",
            "types": ""
        },
        "files_rightclick": {
            "enabled": "yes",
            "installed_version": "1.1.0",
            "types": ""
        },
        "files_sharing": {
            "enabled": "yes",
            "incoming_server2server_share_enabled": "no",
            "installed_version": "1.14.0",
            "outgoing_server2server_share_enabled": "no",
            "types": "filesystem"
        },
        "files_texteditor": {
            "enabled": "no",
            "installed_version": "2.14.0",
            "signed": "true",
            "types": ""
        },
        "files_trashbin": {
            "cronjob_trash_expiry_offset": "0",
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "filesystem,dav"
        },
        "files_versions": {
            "enabled": "yes",
            "installed_version": "1.15.0",
            "types": "filesystem,dav"
        },
        "files_videoplayer": {
            "enabled": "no",
            "installed_version": "0.10.1",
            "types": ""
        },
        "files_videoviewer": {
            "enabled": "no",
            "installed_version": "0.1.3",
            "ocsid": "166054",
            "types": ""
        },
        "firstrunwizard": {
            "enabled": "yes",
            "installed_version": "2.11.0",
            "types": "logging"
        },
        "gallery": {
            "enabled": "no",
            "installed_version": "16.1.1",
            "signed": "true",
            "types": ""
        },
        "logreader": {
            "enabled": "yes",
            "installed_version": "2.7.0",
            "types": ""
        },
        "lookup_server_connector": {
            "enabled": "yes",
            "installed_version": "1.10.0",
            "types": "authentication"
        },
        "market": {
            "activity": "2.6.0",
            "enabled": "no",
            "files_mediaviewer": "1.0.4",
            "files_pdfviewer": "0.11.2",
            "files_texteditor": "2.3.0",
            "gallery": "16.1.1",
            "installed_version": "0.6.0",
            "key": "",
            "market": "0.5.1",
            "signed": "true",
            "templateeditor": "0.4.0",
            "types": ""
        },
        "nextcloud_announcements": {
            "enabled": "yes",
            "installed_version": "1.11.0",
            "pub_date": "Thu, 24 Oct 2019 00:00:00 +0200",
            "types": "logging"
        },
        "notifications": {
            "enabled": "yes",
            "installed_version": "2.10.1",
            "types": "logging"
        },
        "oauth2": {
            "enabled": "yes",
            "installed_version": "1.10.0",
            "types": "authentication"
        },
        "password_policy": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "maximumLoginAttempts": "5",
            "types": "authentication"
        },
        "photos": {
            "enabled": "yes",
            "installed_version": "1.4.0",
            "types": ""
        },
        "privacy": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "types": ""
        },
        "provisioning_api": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "prevent_group_restriction"
        },
        "recommendations": {
            "enabled": "yes",
            "installed_version": "1.1.0",
            "types": ""
        },
        "serverinfo": {
            "cached_count_filecache": "576271",
            "cached_count_storages": "30",
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": ""
        },
        "settings": {
            "enabled": "yes",
            "installed_version": "1.4.0",
            "types": ""
        },
        "sharebymail": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "filesystem"
        },
        "support": {
            "SwitchUpdaterServerHasRun": "yes",
            "enabled": "yes",
            "installed_version": "1.5.0",
            "types": "session"
        },
        "survey_client": {
            "enabled": "yes",
            "installed_version": "1.10.0",
            "types": ""
        },
        "systemtags": {
            "enabled": "yes",
            "installed_version": "1.12.0",
            "types": "logging"
        },
        "templateeditor": {
            "enabled": "no",
            "installed_version": "0.4.0",
            "signed": "true",
            "types": ""
        },
        "text": {
            "enabled": "yes",
            "installed_version": "3.3.0",
            "types": "dav"
        },
        "theming": {
            "enabled": "yes",
            "installed_version": "1.13.0",
            "types": "logging"
        },
        "twofactor_backupcodes": {
            "enabled": "yes",
            "installed_version": "1.11.0",
            "types": ""
        },
        "updatenotification": {
            "bruteforcesettings": "2.2.0",
            "core": "22.2.3.0",
            "enabled": "yes",
            "files_antivirus": "3.2.2",
            "installed_version": "1.12.0",
            "types": "",
            "update_check_errors": "0"
        },
        "user_status": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": ""
        },
        "viewer": {
            "enabled": "yes",
            "installed_version": "1.6.0",
            "types": ""
        },
        "weather_status": {
            "enabled": "yes",
            "installed_version": "1.2.0",
            "types": ""
        },
        "workflowengine": {
            "enabled": "yes",
            "installed_version": "2.4.0",
            "types": "filesystem"
        }
    }
}

Client configuration

Browser: Firefox on Linux and Windows

Operating system: Linux and Windows

Logs

Nextcloud log (data/owncloud.log)

Jan 27 10:45:03 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:03+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Start background scan","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:08 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:08+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Batch size is: 100","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scanning file with fileid: 351042","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scan started File: 351042 Account: pat Path: /pat/files/Juridische Hulp/Juridisch Loket Utrecht.txt","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scan is done File: 351042 Account: pat Path: /pat/files/Juridische Hulp/Juridisch Loket Utrecht.txt","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Response :: stream: OK\n","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":4,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"OCA\\Files_Antivirus\\Item::updateCheckTime, exception: etag is not a valid attribute","userAgent":"--","version":"22.2.3.0"}
Jan 27 10:45:09 owncloud Nextcloud[14336]: {"reqId":"u9jWTcrkAUTtrOqYbAJa","level":0,"time":"2022-01-27T10:45:09+01:00","remoteAddr":"","user":"--","app":"files_antivirus","method":"","url":"--","message":"Scanning file with fileid: 518892","userAgent":"--","version":"22.2.3.0"}

Browser log

Not applicable.  (the errors are issued from the background job)
AlphaDE commented 7 months ago

Same issue here since Nextcloud 28.0.0

roberto-thy commented 6 months ago

Same for me (28.0.1 also 28.0.2)

MalteP commented 4 months ago

Did you migrate your installation from ownCloud to Nextcloud? I had 32k "etag is not a valid attribute" errors in my log and started to debug what's happening.

When searching through the current codebase, I did not find "etag" anywhere. Even in the migration scripts (lib/Migration/Version10400Date20180929132835.php#L42) where the tables are created, there is no etag colum.

When comparing the dumped database scheme, the old one looks like this:

--
-- Table structure for table `oc_files_antivirus`
--

DROP TABLE IF EXISTS `oc_files_antivirus`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oc_files_antivirus` (
  `fileid` bigint(20) unsigned NOT NULL,
  `check_time` int(10) unsigned NOT NULL DEFAULT 0,
  `etag` varchar(40) DEFAULT NULL,
  PRIMARY KEY (`fileid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin ROW_FORMAT=DYNAMIC;
/*!40101 SET character_set_client = @saved_cs_client */;

While the fresh installation does not have the etag column:

--
-- Table structure for table `oc_files_antivirus`
--

DROP TABLE IF EXISTS `oc_files_antivirus`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `oc_files_antivirus` (
  `fileid` int(10) unsigned NOT NULL,
  `check_time` int(10) unsigned NOT NULL DEFAULT 0,
  PRIMARY KEY (`fileid`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
/*!40101 SET character_set_client = @saved_cs_client */;

So I ended up to put the Nextcloud into maintenance mode, dropped the current table and recreated it using the new scheme. This will cause the files_antivirus plugin to rescan all files, but for now the error is gone.

Maybe this should be handled by the migration script if an old database is detected.