Open ToonvdPas opened 2 years ago
Same issue here since Nextcloud 28.0.0
Same for me (28.0.1 also 28.0.2)
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.
Steps to reproduce
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:
The relevant table definitions are as follows:
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:
Nextcloud configuration:
Client configuration
Browser: Firefox on Linux and Windows
Operating system: Linux and Windows
Logs
Nextcloud log (data/owncloud.log)
Browser log