You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix Bug #3355: Fix that long running big upload (250GB+) fails because of an expired access token (#3361)
* Revert back to v2.5.5 performSessionFileUpload() and apply minimal change for upload session offset handling to prevent desynchronisation on large files
* Add specific 403 handler for when the upload session URL itself expires
* Add 'file_fragment_size'
* Clean up debug logging output
* Add 'tempauth' to spelling words
* Update documentation URL's
* Ensure that on each fragment upload, whilst the application is using the 'tempauth' for session upload, the global OAuth2 token needs to be checked for validity and refreshed if required
* Add limit check for 'file_fragment_size' option
* Add to default 'config' file
* Update documentation for 'file_fragment_size'
* Add 'file_fragment_size' to --display-config output
* Add --file-fragment-size option to enable use via Docker option
* Add to manpage
* Update Docker entrypoint
* Update Docker | Podman documentation
* Update logging output to include connection method to URL
* Update Upload Session URL expiry update to include UTC and LocalTime values
* Update comment which was dropped / missed
* Clarify that this is the OAuth2 Access Token
* Clarify that the expiry timestamp is localTime
* Update PR with dynamic use of fragment size if fileSize > 100MiB
* Enforce multiple 320KiB for fragment size to align to Microsoft documentation
* Fix Docker entrypoint and confirm working for ONEDRIVE_FILE_FRAGMENT_SIZE
* Change 'defaultMaxFileFragmentSize' to 60
* Revise fragmentSize calculation to be as close to 60 MiB as possible without breaching Microsoft documented threshold
> Additional configuration is potentially required to configure the default log directory. Refer to the [Enabling the Client Activity Log](./usage.md#enabling-the-client-activity-log) section in usage.md for details
414
415
416
+
### file_fragment_size
417
+
_**Description:**_ This option controls the fragment size when uploading large files to Microsoft OneDrive. The value specified is in MB.
_**Description:**_ This setting controls the application HTTP protocol version. By default, the application will use libcurl defaults for which HTTP protocol version will be used to interact with Microsoft OneDrive. Use this setting to downgrade libcurl to only use HTTP/1.1.
> This option is considered a 'Client Side Filtering Rule' and if configured, is utilised for all sync operations. After changing this option, you will be required to perform a resync.
891
+
892
+
874
893
### skip_symlinks
875
894
_**Description:**_ This configuration option controls whether the application will skip all symbolic links when performing sync operations. Microsoft OneDrive has no concept or understanding of symbolic links, and attempting to upload a symbolic link to Microsoft OneDrive generates a platform API error. All data (files and folders) that are uploaded to OneDrive must be whole files or actual directories.
| <B>ONEDRIVE_RUNAS_ROOT</B> | Controls if the Docker container should be run as the 'root' user instead of 'onedrive' user. Default is 0 | 1 |
292
292
| <B>ONEDRIVE_SYNC_ONCE</B> | Controls if the Docker container should be run in Standalone Mode. It will use Monitor Mode otherwise. Default is 0 | 1 |
293
+
| <B>ONEDRIVE_FILE_FRAGMENT_SIZE</B> | Controls the fragment size when uploading large files to Microsoft OneDrive. The value specified is in MB. Default is 10, Limit is 60 | 25 |
| <B>ONEDRIVE_RUNAS_ROOT</B> | Controls if the Docker container should be run as the 'root' user instead of 'onedrive' user. Default is 0 | 1 |
307
307
| <B>ONEDRIVE_SYNC_ONCE</B> | Controls if the Docker container should be run in Standalone Mode. It will use Monitor Mode otherwise. Default is 0 | 1 |
308
+
| <B>ONEDRIVE_FILE_FRAGMENT_SIZE</B> | Controls the fragment size when uploading large files to Microsoft OneDrive. The value specified is in MB. Default is 10, Limit is 60 | 25 |
// - Default 'OneDrive Business Shared Files' Folder Name
48
48
immutablestring defaultBusinessSharedFilesDirectoryName = "Files Shared With Me";
49
+
// - Default file fragment size for uploads
50
+
immutablelong defaultFileFragmentSize = 10;
51
+
immutablelong defaultMaxFileFragmentSize = 60;
49
52
50
53
// Microsoft Requirements
51
54
// - Default Application ID (abraunegg)
@@ -288,6 +291,8 @@ class ApplicationConfig {
288
291
longValues["rate_limit"] = 0;
289
292
// - To ensure we do not fill up the load disk, how much disk space should be reserved by default
290
293
longValues["space_reservation"] = 50*2^^20; // 50 MB as Bytes
294
+
// - How large should our file fragments be when uploading as an 'upload session' ?
295
+
longValues["file_fragment_size"] = defaultFileFragmentSize; // whole number, treated as MB, will be converted to bytes within performSessionFileUpload(). Default is 10.
291
296
292
297
// HTTPS & CURL Operation Settings
293
298
// - Maximum time an operation is allowed to take
@@ -1040,6 +1045,20 @@ class ApplicationConfig {
1040
1045
tempValue = 0;
1041
1046
}
1042
1047
setValueLong("skip_size", tempValue);
1048
+
} elseif (key =="file_fragment_size") {
1049
+
ulong tempValue = thisConfigValue;
1050
+
// If set, this must be greater than the default, but also aligning to Microsoft upper limit of 60 MiB
1051
+
// Enforce lower bound (must be greater than default)
1052
+
if (tempValue < defaultFileFragmentSize) {
1053
+
addLogEntry("Invalid value for key in config file (too low) - using default value: "~ key);
1054
+
tempValue = defaultFileFragmentSize;
1055
+
}
1056
+
// Enforce upper bound (safe maximum)
1057
+
elseif (tempValue > defaultMaxFileFragmentSize) {
1058
+
addLogEntry("Invalid value for key in config file (too high) - using maximum safe value: "~ key);
1059
+
tempValue = defaultMaxFileFragmentSize;
1060
+
}
1061
+
setValueLong("file_fragment_size", tempValue);
1043
1062
}
1044
1063
} else {
1045
1064
addLogEntry("Unknown key in config file: "~ key);
@@ -1138,25 +1157,25 @@ class ApplicationConfig {
1138
1157
std.getopt.config.bundling,
1139
1158
std.getopt.config.caseSensitive,
1140
1159
"auth-files",
1141
-
"Perform authentication not via interactive dialog but via files read/writes to these files.",
1160
+
"Perform authentication not via interactive dialog but via files read/writes to these files",
1142
1161
&stringValues["auth_files"],
1143
1162
"auth-response",
1144
-
"Perform authentication not via interactive dialog but via providing the response url directly.",
1163
+
"Perform authentication not via interactive dialog but via providing the response url directly",
1145
1164
&stringValues["auth_response"],
1146
1165
"check-for-nomount",
1147
-
"Check for the presence of .nosync in the syncdir root. If found, do not perform sync.",
1166
+
"Check for the presence of .nosync in the syncdir root. If found, do not perform sync",
1148
1167
&boolValues["check_nomount"],
1149
1168
"check-for-nosync",
1150
-
"Check for the presence of .nosync in each directory. If found, skip directory from sync.",
1169
+
"Check for the presence of .nosync in each directory. If found, skip directory from sync",
1151
1170
&boolValues["check_nosync"],
1152
1171
"classify-as-big-delete",
1153
1172
"Number of children in a path that is locally removed which will be classified as a 'big data delete'",
1154
1173
&longValues["classify_as_big_delete"],
1155
1174
"cleanup-local-files",
1156
-
"Cleanup additional local files when using --download-only. This will remove local data.",
1175
+
"Cleanup additional local files when using --download-only. This will remove local data",
1157
1176
&boolValues["cleanup_local_files"],
1158
1177
"create-directory",
1159
-
"Create a directory on OneDrive - no sync will be performed.",
1178
+
"Create a directory on OneDrive - no sync will be performed",
1160
1179
&stringValues["create_directory"],
1161
1180
"create-share-link",
1162
1181
"Create a shareable link for an existing file on OneDrive",
@@ -1165,10 +1184,10 @@ class ApplicationConfig {
1165
1184
"Debug OneDrive HTTPS communication.",
1166
1185
&boolValues["debug_https"],
1167
1186
"destination-directory",
1168
-
"Destination directory for renamed or move on OneDrive - no sync will be performed.",
1187
+
"Destination directory for renamed or move on OneDrive - no sync will be performed",
1169
1188
&stringValues["destination_directory"],
1170
1189
"disable-notifications",
1171
-
"Do not use desktop notifications in monitor mode.",
1190
+
"Do not use desktop notifications in monitor mode",
1172
1191
&boolValues["disable_notifications"],
1173
1192
"disable-download-validation",
1174
1193
"Disable download validation when downloading from OneDrive",
@@ -1177,26 +1196,29 @@ class ApplicationConfig {
1177
1196
"Disable upload validation when uploading to OneDrive",
1178
1197
&boolValues["disable_upload_validation"],
1179
1198
"display-config",
1180
-
"Display what options the client will use as currently configured - no sync will be performed.",
1199
+
"Display what options the client will use as currently configured - no sync will be performed",
1181
1200
&boolValues["display_config"],
1182
1201
"display-running-config",
1183
-
"Display what options the client has been configured to use on application startup.",
1202
+
"Display what options the client has been configured to use on application startup",
1184
1203
&boolValues["display_running_config"],
1185
1204
"display-sync-status",
1186
-
"Display the sync status of the client - no sync will be performed.",
1205
+
"Display the sync status of the client - no sync will be performed",
1187
1206
&boolValues["display_sync_status"],
1188
1207
"display-quota",
1189
-
"Display the quota status of the client - no sync will be performed.",
1208
+
"Display the quota status of the client - no sync will be performed",
1190
1209
&boolValues["display_quota"],
1191
1210
"download-only",
1192
-
"Replicate the OneDrive online state locally, by only downloading changes from OneDrive. Do not upload local changes to OneDrive.",
1211
+
"Replicate the OneDrive online state locally, by only downloading changes from OneDrive. Do not upload local changes to OneDrive",
1193
1212
&boolValues["download_only"],
1194
1213
"dry-run",
1195
1214
"Perform a trial sync with no changes made",
1196
1215
&boolValues["dry_run"],
1197
1216
"enable-logging",
1198
1217
"Enable client activity to a separate log file",
1199
1218
&boolValues["enable_logging"],
1219
+
"file-fragment-size",
1220
+
"Specify the file fragment size for large file uploads (in MB)",
1221
+
&longValues["file_fragment_size"],
1200
1222
"force-http-11",
1201
1223
"Force the use of HTTP 1.1 for all operations",
1202
1224
&boolValues["force_http_11"],
@@ -1222,10 +1244,10 @@ class ApplicationConfig {
1222
1244
"Sync OneDrive Business Shared Files to the local filesystem",
1223
1245
&boolValues["sync_business_shared_files"],
1224
1246
"local-first",
1225
-
"Synchronize from the local directory source first, before downloading changes from OneDrive.",
1247
+
"Synchronize from the local directory source first, before downloading changes from OneDrive",
1226
1248
&boolValues["local_first"],
1227
1249
"log-dir",
1228
-
"Directory where logging output is saved to, needs to end with a slash.",
1250
+
"Directory where logging output is saved to, needs to end with a slash",
1229
1251
&stringValues["log_dir"],
1230
1252
"logout",
1231
1253
"Logout the current user",
@@ -1237,7 +1259,7 @@ class ApplicationConfig {
1237
1259
"Keep monitoring for local and remote changes",
1238
1260
&boolValues["monitor"],
1239
1261
"monitor-interval",
1240
-
"Number of seconds by which each sync operation is undertaken when idle under monitor mode.",
1262
+
"Number of seconds by which each sync operation is undertaken when idle under monitor mode",
1241
1263
&longValues["monitor_interval"],
1242
1264
"monitor-fullscan-frequency",
1243
1265
"Number of sync runs before performing a full local scan of the synced directory",
@@ -1261,13 +1283,13 @@ class ApplicationConfig {
1261
1283
"Approve the use of performing a --resync action",
1262
1284
&boolValues["resync_auth"],
1263
1285
"remove-directory",
1264
-
"Remove a directory on OneDrive - no sync will be performed.",
1286
+
"Remove a directory on OneDrive - no sync will be performed",
1265
1287
&stringValues["remove_directory"],
1266
1288
"remove-source-files",
1267
1289
"Remove source file after successful transfer to OneDrive when using --upload-only",
1268
1290
&boolValues["remove_source_files"],
1269
1291
"single-directory",
1270
-
"Specify a single local directory within the OneDrive root to sync.",
1292
+
"Specify a single local directory within the OneDrive root to sync",
1271
1293
&stringValues["single_directory"],
1272
1294
"skip-dot-files",
1273
1295
"Skip dot files and folders from syncing",
@@ -1288,7 +1310,7 @@ class ApplicationConfig {
1288
1310
"Skip syncing of symlinks",
1289
1311
&boolValues["skip_symlinks"],
1290
1312
"source-directory",
1291
-
"Source directory to rename or move on OneDrive - no sync will be performed.",
1313
+
"Source directory to rename or move on OneDrive - no sync will be performed",
1292
1314
&stringValues["source_directory"],
1293
1315
"space-reservation",
1294
1316
"The amount of disk space to reserve (in MB) to avoid 100% disk space utilisation",
@@ -1306,10 +1328,10 @@ class ApplicationConfig {
1306
1328
"Perform a synchronisation with Microsoft OneDrive (DEPRECATED)",
1307
1329
&boolValues["synchronize"],
1308
1330
"sync-root-files",
1309
-
"Sync all files in sync_dir root when using sync_list.",
1331
+
"Sync all files in sync_dir root when using sync_list",
1310
1332
&boolValues["sync_root_files"],
1311
1333
"upload-only",
1312
-
"Replicate the locally configured sync_dir state to OneDrive, by only uploading local changes to OneDrive. Do not download changes from OneDrive.",
1334
+
"Replicate the locally configured sync_dir state to OneDrive, by only uploading local changes to OneDrive. Do not download changes from OneDrive",
1313
1335
&boolValues["upload_only"],
1314
1336
"confdir",
1315
1337
"Set the directory used to store the configuration files",
@@ -1325,7 +1347,7 @@ class ApplicationConfig {
1325
1347
&boolValues["with_editing_perms"]
1326
1348
);
1327
1349
1328
-
// Was --syncdir used?
1350
+
// Was --syncdir specified?
1329
1351
if (!getValueString("sync_dir_cli").empty) {
1330
1352
// Build the line we need to update and/or write out
0 commit comments