Repository navigation
Description
While testing another issue (#3988) I have discovered that the Mail.ru cloud has a certain limit of how many bytes in total you can transfer within a period of time. Or maybe this is a protection from a DDoS attack I don't know. But anyway, after I had uploaded a huge amount of data into the cloud (I would say, about 1 terabyte within a couple of days), I am having the following situation.
when I run rclone sync I can see the following:
- the authentication passes successfully
- further initial data exchange passess successfully, including checking of the files etc.
- if I use some reading command, like 'lsd' it operates correctly and returns the expected result
- but when files upload starts, it is simply not uploading anything, and in the log there is a series of lines like this:
2020/12/15 15:16:59 INFO :
Transferred: 0 / 50.704 GBytes, 0%, 0 Bytes/s, ETA -
Checks: 12 / 44, 27%
Transferred: 0 / 26, 0%
Elapsed time: 3m3.3s
Checking:
- my-file.z01: checking
- my-file.z02: checking
- my-file.z03: checking
- my-file.z04: checking
- my-file.z05: checking
- my-file.z06: checking
- my-file.z07: checking
- my-file.z08: checking
Transferring: - my-file.z01: 0% /1.993G, 0/s, -
- my-file.z02: 0% /1.993G, 0/s, -
- my-file.z03: 0% /1.993G, 0/s, -
- my-file.z04: 0% /1.993G, 0/s, -
The log fragment above is repeating in cycles for a while (for a big file this can take several minutes or even half an hour or maybe even longer), and then rclone proceeds to the next four files, not uploading anything again. This continues until rclone goes through all files (which may take hours), and finally rclone returns with error level 1.
I can remember I had such problem in the past, using _another_tool, not rclone. And I had to wait for a month or so, until it was workable again.
Interestingly, when I try to upload a file to the same mail.ru cloud through the web, through their own website cloud.mail.ru, the file is uploaded successfully. But not with rclone. And when I try to upload the file with another rclone-like tool, it does not work just like rclone does not work.
So, on the one hand it could be great to know what is the difference between how rclone works with the cloud backend and how the original webapp does, and why the original webapp is not banned - i.e. it is probably using the same server API, but somehow the server differentiates it's calls from the rclone's calls.
On the other hand, it is at least important to make rclone detect that the uploading is not really happening, and quickly return with an understandable error. Because now for a 200-gigabyte archive (split, say, into 100 files) rclone is working for about half a day without actually doing anything.
Activity
lxnglz commentedon Dec 15, 2020
Now, as I have done some more testing, this looks even more weird to me.
When I run "rclone sync" for a single file, the file uploads successfully.
But when I run "rclone sync" for the whole folder, nothing gets uploaded.
In other words:
When I run this:
rclone.exe sync "X:\my-archive\file.z01" "wdcmr-admin:\my-archive" --no-update-modtime -vvv
I get in the log a series of lines like this (with gradually increasing percentage value):
Transferred: 1019.027M / 1.993 GBytes, 49%, 17.024 MBytes/s, ETA 1m
And finally I get this file in the cloud.
But when I run this:
rclone.exe sync "X:\my-archive" "wdcmr-admin:\my-archive" --no-update-modtime -vvv --transfers 1
I get in the log (for the same file "file.z01") a virtually unending series of lines like this:
Transferred: 0 / 1.993 GBytes, 0%, 0/s, ETA -
And the file never gets to the cloud.
And this began last night somewhere in the middle of a long sync procedure. Some files had been uploaded correctly but at some point all further files could no longer be uploaded and I found in the morning a lot of 0% lines in the log.
And the same thing happens to the "rclone copy" command. A single file successfully finds its way to the cloud, but a folder with files does not.
.....And, damn, while I was writing this, everything began to work again. After several hours it is back to work. This really looks like a feature of Mail.ru :(
Thus, it will be really helpful to detect this situation and stop trying to upload anything immediately, and then resume after a given amount of time.
ivandeex commentedon Dec 16, 2020
It would be nice to catch HTTP response status/headers returned by mail.ru while that happens. It might be a status like 429 or a quota message, probably in ru_RU. Please use
-vvv --dump headers --log-file out.log, save output in a file (it's gonna be huge), put it or the relevant snippet in a gist and link here. Do not forget to redact secrets. If we identify the error indicator, we can make it non-retriable.ivandeex commentedon Dec 16, 2020
May the remote name wdcmr mean that you use mail.ru via webdav protocol available on business plans?
Or are you using the WebDavMRC external tool in between to translate mail.ru API to webdav?
If yes, does the problem persist if you use rclone with mail.ru directly (i.e. backend
type=mailruin rclone.conf)?I'd like to isolate moving parts to be sure what we are fixing here. Disclaimer: rclone is not affiliated with WDMRC.
lxnglz commentedon Dec 16, 2020
I had used WebDavMailRuCloud before I switched to the built-in rclone's mailru support, and in order to not to update my script files I kept the same remote name starting with "wdcmr". So now it has nothing to do with WebDavMRC.
However, I tested WDMRC yesterday as well, and I would say, the issues with the cloud are reproduced synchronously with both WDMRC and the built-in rclone mailru support.
I am getting more and more sure that this is something at the cloud provider side. Yesterday night I set the bandwidth limit to 80M/s and restarted my archive upload, and so far it is being uploaded (fingers crossed) successfully.
ivandeex commentedon Dec 16, 2020
When a client wants to upload a file, mail.ru internally allocates one of upload servers for them. Those servers sometimes get stuck and unilaterally drop connection. If rclone detects the case, it retries the upload, gets another server and moves on.
However, if the selected upload server gets bogged by numerous clients but doesn't drop the connection, rclone will continue the sluggish upload.
That scenario could be true if you reported a single file stalling. In such a case implementing a low-bandwidth trigger requested by #887 (and #2122) would help.
But according to your report from #4872 (comment) a series of uploads (z01,z02,...) got stalled in parallel. Having all of them bound to a single upload server is barely probable. Moreover, mail.ru is a nation-wide provider so 4+ simultaneously bogged upload servers is improbable either.
So I'm in favor of quota theory. Hopefully you've done what I asked in #4872 (comment) to reveal their over-quota indications.
lxnglz commentedon Dec 16, 2020
Yes, I will work more to reproduce this issue again and will collect the logs.
And yes, I confirm, that there was a period of time when syncing or uploading a singe file worked just fine, but when syncing or uploading a folder - none of the files were uploaded.
On the other hand, during the period when I was having this issue, I witnessed a very unstable upload speed for a single file. And when, after a couple of hours, the upload speed stabilized, then multiple upload began to work as well.
So, even if this is related to a data transfer quota, the behavior is weird :(
And I suspect that the authentication issue (#3988) could also be somehow related to this...
ivandeex commentedon Dec 16, 2020
A fair bandwidth scheduler aggressively shaping traffic of a greedy user identified by their oauth token? Well, depending on the SLA of your plan. Hypothetically.
lxnglz commentedon Dec 16, 2020
I will be able to do more testing in a couple of days because right now my real archive upload is still in progress.
I have set this morning the bandwidth limit to 8M/s and resumed the upload. And so far I can see in the log (for which unfortunately I forgot to turn on more details) that sometimes the upload process slows down to zero, but after 30 minutes or so it returns to the normal speed. I set up 2 parallel transfer threads (--transfers 2 switch), and I can see that sometimes one of the parallel files is being uploaded with a reasonable speed, while the other is "paused".
Another thing, that I have noticed, that the situation depends on a particular mail.ru account. I am using 3 accounts, each having a 1 terabyte cloud disk (I am not using them 100% but each contains around 400 gigabytes of data). The archive files are split into folders, and these folders are sequentially uploaded into the cloud as a series of three invocations of rclone (sequential, not parallel). And I can see, that the files were successfully loaded into the first account, then for the second account there is only this one piece of text in the log (hello to issue #3988):
2020/12/16 12:09:47 INFO : Starting bandwidth limiter at 8MBytes/s
2020/12/16 12:09:47 INFO : [XXXXXXX(local folder path)XXXXXXXX]: Valid token not found, authorizing.
2020/12/16 12:09:47 Failed to create file system for "wdcmr-lxng:XXXXXXX(remote folder path)XXXXXXX": Failed to authorize: oauth2: server response missing access_token
And then for the third account the upload started successfully and is now progressing with some periods of zero speed.
lxnglz commentedon Dec 20, 2020
I have got an error again, and this is the link to the truncated rclone log: https://gist.github.com/lxnglz/829a0df20b167aa13aeb37ce171e0664
I had intentionally removed any bandwidth limits, and so I made the sync process break down quite quickly.
However, this time the error looks differently.
From line 277 in the log you can see that the upload starts for two files ("...xpeditions-rwvideo.z01" and "...xpeditions-rwvideo.z02").
In line 295 the upload speed begins to degrade.
In line 327 the speed temporarily increases.
in line 335 the file .z02 shows 100%, but the file ".z01" is still being uploaded.
in line 375 both files show 100%, but there is still some non-zero upload speed indicated for ".z01".
in line 399 the speed is zero for both files. Both of them seem 100% uploaded, the time passed from the upload start is around 15 min.
And then the log repeats showing both files at 100% for about 30 minutes.
Finally, in line 617 there is out-of-memory error.
And then, because rclone is called from a batchfiles for several different folders and for several different mail.ru accounts, the process continues seemingly successfully for other folders (but actually not uploading anything because there are no changed files).
I don't know if this is the same issue I have had before, but it is an issue anyway, because the sync did not succeed for the given folder.
Also, you might have noticed some garbage text in the log in line 213. Similar garbage is present in other places in this log (I have cut the beginning of the log, because it was 11M in total). And in some places in the log there was much more garbage right after the line "Accept-encoding: gzip", and apparently that garbage was actually the dump of a zip file (the way a zip file looks if you rename it to .txt and open in a notepad). Don't know, whether this is relevant or not.
ivandeex commentedon Jan 9, 2021
This part is the simplest to answer.
At 09:54:01 rclone starts to calculate hashsum of files to upload.
After a minute at 09:55:11 it sends a POST request with binary body where "g" encodes the AddFile operation (the protocol was rev engineered from disk-o) to mailru. It says "please add or find me a file given its hash" in fact asking whether a file with such hash is already present: https://github.com/rclone/rclone/blob/v1.53.3/backend/mailru/mailru.go#L2030
Having received a negative reply, it proceeds to the actual upload.
The jumping transfer rate is harder to tackle. Maybe the shape traffic per-user, but I have not yet seen any mention of bandwidth SLA for various tariff tiers on mailru site. I had seen myself rate fluctuations in practice, both with rclone and with disk-o. I could not compare upload behavior for large files with uploader in their web ui as it has a file size limit. When files are chunked or sent in groups, the fluctuations become less visible. Since the protocol is closed, we can only try and guess.
What is worse, your logs show that their servers don't send back any indications of hitting bandwidth or transfer limits, like in http headers or in bodies. This leaves the question open: is there a limit from the ticket heading? what do we overcome?
If they did, I could control --bandwidth automatically. From what I see they either shape quietly or just work on best-effort basis.
In case they shape traffic from foreign clients, you can try changing user-agent from "rclone/VER" to something more native e.g. add the line
user_agent = CloudDiskOWindows 19.05.0047 beta WC6njVyiWqto mailru config section in rclone.conf and see if it helps. If you have more energy to investigate, install disk-o, continuously add large files in pairs to its shared directory and watch the network bandwith plot in the windows task manager. When I did this a couple years ago, I could see disk-o fluctuations as well. I don't use disk-o now, maybe something has changed.I am more worried about out-of-memory panic. This means there is a leak either in my code or my code triggers leak in golang http client. This needs a further investigation on my side.
lxnglz commentedon Jan 11, 2021
I have tried to change the user-agent, but it didn't make any difference.
Unfortunately, I cannot test with Disk-O, because strangely Disk-O does not want to work on a computer where winfsp driver is installed (which I am using for other purposes). I assume Disk-O internally used its own modification of the winfsp source code, and so there is a guid confilct in the system or whatever.
The next step for me will be not to bother mail.ru completely for a few days, so that they sort of forget me, and then try to start the sync with the same settings once again. If I succeed, then we can probably say that this is how they protect from users who consume too much traffic.