Fails to upload large world and plugin files to Dropbox
JoshuaO22 opened this issue ยท 2 comments
Describe the bug
When doing a backup to Dropbox, my nether and end worlds would usually upload just fine but when it gets to the overworld and plugins folder, it cannot upload successfully and return an error (java.lang.NegativeArraySizeException: -239833609). Can you please fix this since I would like to regularily upload backups as I am using Oracle Cloud Infrastructure free tier as my hosting provider which is rumored to delete entire servers at anytime for any reason whatsoever.
Console:
[00:35:08 INFO]: [DriveBackupV2] Forcing a backup
[00:35:08 INFO]: [DriveBackupV2] Creating backups, the server may lag for a little while...
[00:35:10 INFO]: [DriveBackupV2] Doing backups for "./world_nether"
[00:35:13 INFO]: [DriveBackupV2] Uploading file to Dropbox
[00:35:16 INFO]: [DriveBackupV2] File uploaded in 2.9 seconds (24694.93KB/s)
[00:35:16 INFO]: [DriveBackupV2] There are 3 file(s) which exceeds the local limit of 2, deleting oldest
[00:35:16 INFO]: [DriveBackupV2] Doing backups for "./world_the_end"
[00:35:20 INFO]: [DriveBackupV2] Uploading file to Dropbox
[00:35:23 INFO]: [DriveBackupV2] File uploaded in 2.64 seconds (22064.02KB/s)
[00:35:23 INFO]: [DriveBackupV2] There are 3 file(s) which exceeds the local limit of 2, deleting oldest
[00:35:23 INFO]: [DriveBackupV2] Doing backups for "./world"
[00:41:40 INFO]: [DriveBackupV2] Uploading file to Dropbox
[00:41:40 WARN]: java.lang.NegativeArraySizeException: -239833609
[00:41:40 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.uploaders.dropbox.DropboxUploader.uploadFile(DropboxUploader.java:200)
[00:41:40 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.UploadThread.doSingleBackup(UploadThread.java:379)
[00:41:40 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.UploadThread.run(UploadThread.java:238)
[00:41:40 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[00:41:40 INFO]: [DriveBackupV2] Failed to upload
[00:41:40 INFO]: [DriveBackupV2] There are 3 file(s) which exceeds the local limit of 2, deleting oldest
[00:41:40 INFO]: [DriveBackupV2] Doing backups for "plugins"
[00:46:02 INFO]: [DriveBackupV2] Uploading file to Dropbox
[00:46:02 WARN]: java.lang.NegativeArraySizeException: -1900462495
[00:46:02 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.uploaders.dropbox.DropboxUploader.uploadFile(DropboxUploader.java:200)
[00:46:02 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.UploadThread.doSingleBackup(UploadThread.java:379)
[00:46:02 WARN]: at DriveBackupV2.jar//ratismal.drivebackup.UploadThread.run(UploadThread.java:238)
[00:46:02 WARN]: at java.base/java.lang.Thread.run(Thread.java:833)
[00:46:02 INFO]: [DriveBackupV2] Failed to upload
[00:46:02 INFO]: [DriveBackupV2] There are 3 file(s) which exceeds the local limit of 2, deleting oldest
[00:46:02 INFO]: [DriveBackupV2] Failed to backup to Dropbox, verify all credentials are correct or diagnose the problem with /drivebackup test dropbox
[00:46:02 INFO]: [DriveBackupV2] Backup complete
To Reproduce
Have a large world or large plugin folder and the plugin is set to upload to Dropbox with an account that has a large storage size. Currently my world is around 8 GBs and my plugins are at 2 GBs that are getting this issue.
- Forcibly start a back up or wait for a scheduled one to start.
- Wait till it attempts to upload the large file.
- Bug occurs
Screenshots / Videos
No response
Server and Plugin Versions
[00:44:39 INFO]: This server is running Paper version git-Paper-545 (MC: 1.19.4) (Implementing API version 1.19.4-R0.1-SNAPSHOT) (Git: bacbf86)
[00:45:08 INFO]: |====== DriveBackupV2 ======|
Plugin version: 1.6.1
Java version: 17.0.7
Server software: Paper
Server software version: git-Paper-545 (MC: 1.19.4)
Additional Context
No response
I seem to have found the issue. The exception is occurring at line 200 of DropboxUploader.java meaning that the files are not getting split into chunks. Because Dropbox has problems uploading large files, this is causing the error. I tried doing a backup of a folder where the compressed zip equals 8 GiB, and it looks like it did not split the backup into chunks causing this exception. I have the Dropbox Plus plan which has 2 TB, so it's not a problem of available space.
It looks like it might have overflowed the value, causing it to be negative. Changing the variable type from int to long should fix the issue as file.length()
returns a long value. Given that file.length()
is returning the size in bytes, then a size bigger than 2,147,483,647 bytes (2.1 GB) would cause it to overflow.