Repository navigation
Description
What is the problem you are having with rclone?
Recently, while using PIKPAK to upload a large amount of data, I discovered several issues (rclone shows 100% upload complete with no error messages):
Because these error will cause the uploaded files to be damaged and data to be lost, please consider repairing them as a priority if possible.
1.Duplicate Files: I found numerous duplicate files within individual directories. For instance, an original file named "file.jpg" might have duplicates named "file(1).jpg", "file(2).jpg", and so on. These duplicate files have identical sizes and almost identical hash codes (due to some being corrupted).
2.Unreadable Files: Some files uploaded cannot be read.
3.Missing Original Files: Occasionally, only derivative files like "file(1).jpg" are present without the original file. When attempting to manually rename these files back to their original names, an error occurs stating that the file already exists!
4.Files Sent to Trash: Some uploaded files end up in the trash.
Moreover, it's highly probable for issues 1, 2, 3, and 4 to coexist within the same folder simultaneously, without rclone displaying any upload errors! However, reproducing the issue is straightforward: by uploading a large number of files (regardless of file size), there's roughly a 1/50 chance of encountering an error!
As I've already uploaded a significant amount of data and cannot wait for rclone to be fixed, I've taken it upon myself to write a repair program in Python (apologies for not being proficient in Go and unable to assist in modifying rclone source code).
Below are detailed observations and some of the source code used in my repair program:
1.Identifying Unreadable Files:
I observed and compared file attributes to distinguish unreadable files from those that can be read. After uploading, files with reading issues have attributes where the "platform" parameter within the "params" section equals "Upload". Normally, there should be a "task_id" parameter, but unreadable files lack this parameter. However, there's one exception: files with a size of zero, even if they are readable, won't have the "task_id" parameter.
# List files in a folder
for f in files:
if "task_id" not in params and "platform" in params and params["platform"] == "Upload":
if int(size) > 0:
# Code to delete unreadable files here ...2.Identifying Hidden Files:
As some duplicated files couldn't be renamed back to their original names, I suspected that some files might be hidden. Even official software or websites couldn't detect these hidden files; I had to compare file attributes to find them. After completion of some uploads, the processing status of these files would forever remain at "PHASE_TYPE_PENDING," resulting in them becoming hidden and unreadable.
# List files in a folder
for f in files:
if phase == "PHASE_TYPE_PENDING":
# Code to delete hidden files here ...3.Identifying Duplicate Files:
Identifying duplicate files is straightforward; if their hash codes are the same, they are duplicates.
grouped_data = {}
# List files in a folder
for f in files:
if hash not in grouped_data:
grouped_data[hash] = []
grouped_data[hash].append(f)
for duplicate_list in grouped_data.values():
# Code to delete duplicate files here ...The parts that need to be fixed in rclone aren't complex; it just needs to check the attributes mentioned above during the upload process, identify upload failures (unreadable files), and abnormal statuses (hidden files). Only files with correct attributes should be counted as successfully uploaded; otherwise, retry the upload. As for the remaining issues (where files are duplicated or sent to the trash) , they may be caused by repeated attempts to upload failed files! Additionally, it might be worth considering adding a "dedupe" parameter to handle previously failed uploads (currently ineffective).
Since my repair code is written in Chinese, I won't provide it here as it might appear as gibberish to non-Chinese language systems.
I'm Taiwanese, and English is not my native language. This is my first time report here, so please forgive any mistakes I might make.
I would like to express my gratitude for everyone's assistance. If more information is needed, please let me know.
What is your rclone version (output from rclone version)
1.66
Which OS you are using and how many bits (e.g. Windows 7, 64 bit)
Ubuntu 22.04, 64 bit
Which cloud storage system are you using? (e.g. Google Drive)
local or google drive upload to pikpak
The command you were trying to run (e.g. rclone copy /tmp remote:tmp)
rclone copy & sync
A log from the command with the -vv flag (e.g. output from rclone -vv copy /tmp remote:tmp)
no error message
How to use GitHub
- Please use the 👍 reaction to show that you are affected by the same issue.
- Please don't comment if you have no relevant information to add. It's just extra noise for everyone subscribed to this issue.
- Subscribe to receive notifications on status change and new comments.
Activity
ncw commentedon Apr 22, 2024
If you can work out why these problems are happening, preferably with an rclone log showing the problem we can work on fixing them.
Ideally we'd have a reliable way of reproducing the problem too. With that most bugs become easy to fix.
cj-neo commentedon Apr 23, 2024
Thank you for your response. I actually wanted to include the log files, but there are a few issues:
1.Due to the large number of uploaded files, the log files are too extensive to include. There are no obvious error messages, and I'm not sure how to extract them.
2.There are concerns about personal privacy, and I prefer not to disclose what I have uploaded to others.
However, it's not a problem. Later, I'll try uploading some unrelated items to see if I can reproduce these errors. Then, I'll include the log files. Please feel free to attend to other matters in the meantime, as I've already written a repair program myself, and it's not urgent for me.
cj-neo commentedon Apr 23, 2024
I generated a thousand test text files using the following Python
I generated log files using the following command.
log files here
rclone_log.txt
This time, I found 28 files that couldn't be read properly, along with many additional main files with names ending in (1). Unfortunately, I didn't find the hidden files mentioned before (even after retrying uploads several times, perhaps the sample size is still too small or it may be related to file size). If you're interested, you can also run the Python program I mentioned above to generate more test files. Perhaps you'll encounter issues with the incorrect status or unreadable files. It's possible that fixing the issue with unreadable files could also resolve the status error problem!
Here, you can see many files ending with (1), which shouldn't exist. Moreover, some original files were successfully uploaded but still generated another file with (1) at the end. What's even stranger is that many files with (1) at the end are still unreadable corrupted files.
In addition to these 28 files that couldn't be read, there are even more files without original files, only derivative files ending in (1), additionally, some files were directly uploaded to the recycle bin.
Below are the 28 corrupted files that couldn't be read:
/test_folder/file_945.txt
/test_folder/file_962.txt
/test_folder/file_995.txt
/test_folder/file_593(1).txt
/test_folder/file_642(1).txt
/test_folder/file_666(1).txt
/test_folder/file_667(1).txt
/test_folder/file_673(1).txt
/test_folder/file_683(1).txt
/test_folder/file_686(1).txt
/test_folder/file_70(1).txt
/test_folder/file_744(1).txt
/test_folder/file_76(1).txt
/test_folder/file_762(1).txt
/test_folder/file_768(1).txt
/test_folder/file_786(1).txt
/test_folder/file_822(1).txt
/test_folder/file_824(1).txt
/test_folder/file_827(1).txt
/test_folder/file_838(1).txt
/test_folder/file_84(1).txt
/test_folder/file_841(1).txt
/test_folder/file_847(1).txt
/test_folder/file_850(1).txt
/test_folder/file_891(1).txt
/test_folder/file_896(1).txt
/test_folder/file_908(1).txt
/test_folder/file_922(1).txt
If you need more information or assistance, please let me know. Thank you very much for your help.
cj-neo commentedon Apr 24, 2024
To provide more observation data, I re-uploaded three thousand test files. Unfortunately, the status error issue still did not occur.
I suspect that the files hidden due to status errors mentioned earlier are likely related to the file size or whether they are media files (because I know some platforms convert media files, and this process may fail, leading to incomplete status). In the past, I often encountered status errors when uploading large files, but this time, despite uploading thousands of small files, I haven't encountered any, which is very abnormal.
Rclone log file
rclone_log.txt
In total there are:
10 files that cannot be read.
13 duplicate files (excluding originals)
40 files that were uploaded directly to the trash bin after uploading.
The following files cannot be read
file_647.txt
file_665.txt
file_703.txt
file_733.txt
file_786.txt
file_826.txt
file_828.txt
file_834.txt
file_863.txt
file_864.txt
The following files are duplicated.
file_61(1).txt
file_697(1).txt
file_717(1).txt
file_735(1).txt
file_775(1).txt
file_787(1).txt
file_802(1).txt
file_818(1).txt
file_840(1).txt
file_844(1).txt
file_860(1).txt
file_927(1).txt
file_991(1).txt
The following files were uploaded directly to the trash/bin.
file_1433.txt
file_1641.txt
file_175.txt
file_1752.txt
file_1755.txt
file_1813.txt
file_1859.txt
file_221.txt
file_2364.txt
file_2502.txt
file_2522.txt
file_2627.txt
file_2702.txt
file_2709.txt
file_2727.txt
file_2777.txt
file_2831.txt
file_2897.txt
file_2921.txt
file_2925.txt
file_2926.txt
file_2931.txt
file_317.txt
file_328.txt
file_381.txt
file_399.txt
file_465.txt
file_502.txt
file_533.txt
file_532.txt
file_647.txt
file_665.txt
file_703.txt
file_733.txt
file_786.txt
file_828.txt
file_826.txt
file_834.txt
file_863.txt
file_864.txt
If you need more information or assistance, please let me know. Thank you very much for your help.
wiserain commentedon May 7, 2024
I have started looking into this. Thanks for the detailed report.
wiserain commentedon May 7, 2024
Did you successfully handle those invalid files? In my drive, there are two types of invalids:
For unreadable files, it is actually readable after manually untrash(making
"trahsed": false) them. I haven't tested all but at least one of them is. I couldn't delete these invalids from server.cj-neo commentedon May 7, 2024
First of all, thank you for your help. Regarding what you mentioned about unreadable files, they are probably the files I mentioned before that were directly uploaded to the trash, rather than being truly unreadable. Truly unreadable files can only be deleted and cannot be repaired! However, often when unreadable files are generated, duplicate files are also generated at the same time (I speculate this may be due to rclone's inability to write during retries). I simply replace the original file with the duplicate file. If there are no duplicate files, I can only re-upload through rclone.
Let me summarize the issues I've encountered:
1.Files may be directly uploaded to the trash, as you mentioned, and the only difference between them and normal files is a file parameter difference, trashed:true.
2.Unreadable files, these files can also be filtered by parameters to search for, first by platform: Upload and there is no task_id. Normally, files uploaded through the platform will be marked as Upload and will always have a task_id.
3.Hidden files, can also be found through the file parameter phase: PHASE_TYPE_PENDING.
4.Duplicate files, I directly use the hash code to search, but may also need to compare files, because sometimes there are duplicate files in the same folder with different filenames, which may need to be handled specially.
These are roughly the situations I've encountered. If there's anything else you need help with, please let me know. Gratitude.
cj-neo commentedon May 7, 2024
Additional notes:
In fact, many of these issues were discovered through comparing file parameters, and I'm not sure of the exact cause of the problems. These are just personal observations, so they may not always be accurate. If there's anything else you need help with, please let me know.
pikpak: fix upload conflict
wiserain commentedon May 9, 2024
Can you please try using v1.67.0-beta.7928.2e582d73f.fix-7787-pikpak-upload-conflict?
cj-neo commentedon May 9, 2024
Sure, I'll give it a try later, but it might take some time. Thank you for your help.
cj-neo commentedon May 9, 2024
I used the same approach to upload one thousand files for testing before, but shortly after starting, I encountered the error:
panic: runtime error: invalid memory address or nil pointer dereference
Then it was forcibly terminated.
However, when I used rclone version 1.66 or 1.65 with the same command to upload the same files, this error did not occur.
Command:
Log file:
rclone_log.txt
my operating system is Win10. I haven't tested on other platforms yet, so I'm not sure if the same error will occur.
wiserain commentedon May 9, 2024
Thanks for the test. I will fix it soon.
wiserain commentedon May 14, 2024
Can you try with v1.67.0-beta.7930.223ba8626.fix-7787-pikpak-upload-conflict?
We've made some adjustments in this version to make uploads more reliable.
Checking upload status
By implementing
getTask()API call and usingtask_idassigned for each upload, we ensure uploads are completed successfully on the server-side.Cancel uploads
If an upload encounters an error, we cancel it to remove residual files (hidden or unreadable).
Force sleep and min sleep
Based on experiment using 1000 small files as @cj-neo described and following commands to upload and check them,
the number of first three retries of low level retry for 1000 files are
meaning that 5% (~50 of 1000) files require at least three retries which is +150 ms. Therefore, introducing a forced delay (or sleep) after uploading can be a reasonable approach to ensure server-side updates take effect. Note that this doesn't impact total execution time much.
Moreover, minimum sleep for pacer is increased from 10 to 100ms to resolve following server error.
Stop using
uploadByForm()We stop using
uploadByForm()cause it is not as reliable asuploadByResumable()for a large number of small files.12 remaining items
cj-neo commentedon May 19, 2024
Not all of them are small files. As mentioned before, I tested uploading a thousand small files without any issues, and initially, I thought the problem was resolved.
However, I later continued with the original upload tasks. I am transferring a large amount of data previously stored on Google Drive to PIKPAK, and the file sizes and types vary.
The problems are exactly the same as at the beginning, including the issue where files cannot be uploaded using RCLONE. There are two differences:
1.Deleting the problematic files and re-uploading them has a high chance of success.
2.The other type of issue is that even deleting and re-uploading won't work, there is no transfer process at all.
As for the current --transfers parameter, I have set it to 8 and the problem still occurs. If set lower, the file transfer speed becomes much slower. However, if needed, I can help test with a lower setting.
cj-neo commentedon May 19, 2024
By the way, if you need to test uploading a large amount of data, you can use Google Colab. It doesn't use up your server or VPS bandwidth and is very convenient. The only limitation is that it disconnects after a period of inactivity, but this doesn't significantly affect RCLONE.
cj-neo commentedon May 19, 2024
I am currently using a detection program I previously wrote in Python. It logs problematic files and deletes them. After the detection is complete, it calls RCLONE to re-upload those files, then re-runs the detection... repeating this process several times until only the files that cannot be uploaded with RCLONE remain, which are then uploaded manually.
I have noticed that issues tend to be continuous. If no errors occur, they tend to stay that way, but once an error appears, it often happens in the same directory, and even several consecutive files can fail. Therefore, I believe these issues are likely due to network or server overload.
Since a lot of issues have accumulated, I am concerned about wasting too much of your time. We already know which files have abnormal attributes, I am wondering if, you could consider a temporary workaround. Specifically, we could recheck the files once more before RCLONE finishes the transfer, similar to my initial approach, but handled internally rather than by an external program. Later, when more time is available, we can address the root cause of the problem. Please evaluate this suggestion.
pikpak: improve upload reliability and resolve potential file conflicts
cj-neo commentedon Jun 10, 2024
@ncw Sorry, these issues might not be fully resolved yet! Thank you!
wiserain commentedon Jun 11, 2024
@cj-neo Let me know detailed how to identify faulty uploads.
cj-neo commentedon Jun 11, 2024
phaseasPHASE_TYPE_PENDING. Normally, after uploading is complete, thephaseshould bePHASE_TYPE_COMPLETE.platformisUploadand thetask_idattribute does not exist. However, you later mentioned that this happens because the system detects that the file already exists on the server and thus skips the upload. I have noticed that most files that skip the upload cannot be read correctly!In the last tested version,
v1.67.0-beta.7930.223ba8626.fix-7787-pikpak-upload-conflict, these issues still exist.The main cause might be due to the hash code not matching. By the way, can we directly assign an empty or specific hash code so that the files are always uploaded and not skipped to solve this issue?
Thank you for your assistance.
wiserain commentedon Jun 22, 2024
With recent beta we are strictly checking
phaseuntil it isPHASE_TYPE_COMPLETEafter most of file operations including uploads. We hope the issue should be somewhat resolved. Regarding 3. Unuploadable Files, confirmed that the sample files you provided are uploadable.cj-neo commentedon Jun 22, 2024
@wiserain
Thank you for your hard work. I will test the new beta version later and report the results to you after testing.
But to ensure the issue is resolved, I will upload a large amount of data and conduct a thorough check afterward, so this may take a few days.
wiserain commentedon Jun 22, 2024
If you find any further issues, let us know with a new issue thread. Thanks!
cj-neo commentedon Jun 22, 2024
I found that it is not possible to upload slightly larger files. #7922
cj-neo commentedon Jul 28, 2024
Hello: I must tell you some unfortunate news. Today, I found that after rclone completes an upload 100%, if I re-upload, there are still a few files that get uploaded again. So, I checked the properties of those repeatedly uploaded files and found that the issue with incorrect status persists. (The phase attribute of the file is PHASE_TYPE_PENDING)
Additionally, I rechecked using rclone sync mode and discovered that some files were repeatedly uploaded, including those with the incorrect status I mentioned, as well as some others without any status errors.
In other words, even though the hash code issue has been resolved, the problems of file status errors and repeated uploads still exist. It's because I didn't check thoroughly enough before.
pikpak: improve upload reliability and resolve potential file conflicts