Errors Count per Group isn't correctly incremented

What is the problem you are having with rclone?

I'm using RClone through the API (Remote Control).
When a job is finished I wish to know how many errors occurred during that job.
I'm using the core/stats with group= filter to retrieve the information of the job.

The error counter for that particular job isn't incremented. Only the global stats error counter is correctly incremented.

The core/transferred with group= filter correctly shows the error.

From looking at the code, this happens because fs.CountError (which increments the GlobalStats()) is called before handling the stats for the particular job.

What is your rclone version (output from rclone version)

rclone v1.58.0-DEV

Which OS you are using and how many bits (eg Windows 7, 64 bit)

Linux, 64 Bit

Which cloud storage system are you using? (eg Google Drive)

S3 Minio, S3 AWS

The rclone config contents with secrets removed.

[local]
type = local

[Minio]
type = s3
access_key_id = XXXXXXX
endpoint = https://minio.com
provider = Minio
secret_access_key = XXXXXXXX

The command you were trying to run (eg rclone copy /tmp remote:tmp)

# Rclone is started with
/usr/bin/rclone rcd --rc-no-auth --config=/etc/rclone/rclone.conf
# Api call to get stats for that particular job
rclone rc core/stats group=job/3
{
        "bytes": 0,
        "checks": 0,
        "deletedDirs": 0,
        "deletes": 0,
        "elapsedTime": 25.196590579,
        "errors": 0,
        "eta": null,
        "fatalError": false,
        "renames": 0,
        "retryError": false,
        "speed": 0,
        "totalBytes": 0,
        "totalChecks": 0,
        "totalTransfers": 0,
        "transferTime": 0,
        "transfers": 0
}
# Api call to get information about job transferred files
 rclone rc core/transferred group=job/3
{
        "transferred": [
                {
                        "bytes": 0,
                        "checked": false,
                        "completed_at": "2021-12-07T10:16:52.319589024Z",
                        "error": "s3 upload: 400 Bad Request: \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cError\u003e\u003cCode\u003eXMinioInvalidObjectName\u003c/Code\u003e\u003cMessage\u003eObject name contains unsupported characters.\u003c/Message\u003e\u003cResource\u003e/ben/rclone_error/Hello \\\\ World\u003c/Resource\u003e\u003cRequestId\u003e16BE71980F79AEFF\u003c/RequestId\u003e\u003cHostId\u003e3L137\u003c/HostId\u003e\u003c/Error\u003e",
                        "group": "job/3",
                        "name": "Hello \\\\ World",
                        "size": 0,
                        "started_at": "2021-12-07T10:16:52.316523254Z"
                }
        ]
}
# API call to get global stats
rclone rc core/stats
{
        "bytes": 0,
        "checks": 0,
        "deletedDirs": 0,
        "deletes": 0,
        "elapsedTime": 17.486113051,
        "errors": 1,
        "eta": null,
        "fatalError": false,
        "lastError": "s3 upload: 400 Bad Request: \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cError\u003e\u003cCode\u003eXMinioInvalidObjectName\u003c/Code\u003e\u003cMessage\u003eObject name contains unsupported characters.\u003c/Message\u003e\u003cResource\u003e/ben/rclone_error/Hello \\\\ World\u003c/Resource\u003e\u003cRequestId\u003e16BE71980F79AEFF\u003c/RequestId\u003e\u003cHostId\u003e3L137\u003c/HostId\u003e\u003c/Error\u003e",
        "renames": 0,
        "retryError": true,
        "speed": 0,
        "totalBytes": 0,
        "totalChecks": 0,
        "totalTransfers": 0,
        "transferTime": 0,
        "transfers": 0
}
# API call job/status
 rclone rc job/status jobid=3
{
        "duration": 0.116039952,
        "endTime": "2021-12-07T10:16:52.319599191Z",
        "error": "s3 upload: 400 Bad Request: \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n\u003cError\u003e\u003cCode\u003eXMinioInvalidObjectName\u003c/Code\u003e\u003cMessage\u003eObject name contains unsupported characters.\u003c/Message\u003e\u003cResource\u003e/ben/rclone_error/Hello \\\\ World\u003c/Resource\u003e\u003cRequestId\u003e16BE71980F79AEFF\u003c/RequestId\u003e\u003cHostId\u003e3L137\u003c/HostId\u003e\u003c/Error\u003e",
        "finished": true,
        "group": "job/3",
        "id": 3,
        "output": {},
        "startTime": "2021-12-07T10:16:52.20355921Z",
        "success": false
}

A log from the command with the -vv flag

Nothing special there

If you want to log a bug report or submit a PR for that item, it seems like you did most the work already.

I can go for a bug report in the github repository, regarding the PR I have looked only for the Copy method. When I search for fs.CountError I see that it's used everywhere.
A correct PR requires to change the error handling/count mechanism nearly everywhere.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.