panel icon indicating copy to clipboard operation
panel copied to clipboard

ValidationException: "the successful field must be present" when reporting backups

Open ohaitrans opened this issue 5 years ago • 10 comments

Background (please complete the following information):

  • Panel or Wings: Wings
  • Version of Panel/Wings: Wings 1.4.2, Panel 1.4.1
  • Server's OS: Centos 7.9.2009

Describe the bug When creating a backup above 50GB or so using S3, the backup fails. For sizes smaller, the backup works fine. When the backup fails, the parts seem to all be uploaded to the storage server, but the backup appears as failed in the panel. Deleting the failed backup in the panel does not delete the objects on the storage server, wings.log:

...
 INFO: [May  6 10:35:47.090] successfully uploaded backup part adapter=s3 backup=fecbaf9d-e99c-418e-adbf-f2fea882bd2f part_id=13 request_id=8302f873-f186-4015-a15a-ceb21a403866 server=66d203b4-7e2b-404f-9648-04f7e4d9a52a
 INFO: [May  6 10:35:47.090] backup has been successfully uploaded adapter=s3 backup=fecbaf9d-e99c-418e-adbf-f2fea882bd2f parts=13 request_id=8302f873-f186-4015-a15a-ceb21a403866 server=66d203b4-7e2b-404f-9648-04f7e4d9a52a
 INFO: [May  6 10:37:31.858] failed to notify panel of successful backup state error=Error response from Panel: ValidationException: The successful field must be present. (HTTP/422) server=66d203b4-7e2b-404f-9648-04f7e4d9a52a

Stacktrace:
Error response from Panel: ValidationException: The successful field must be present. (HTTP/422)
github.com/pterodactyl/wings/server.(*Server).notifyPanelOfBackup
	/home/runner/work/wings/wings/server/backup.go:29
github.com/pterodactyl/wings/server.(*Server).Backup
	/home/runner/work/wings/wings/server/backup.go:93
github.com/pterodactyl/wings/router.postServerBackup.func1
	/home/runner/work/wings/wings/router/router_server_backup.go:50
runtime.goexit
	/opt/hostedtoolcache/go/1.16.3/x64/src/runtime/asm_amd64.s:1371

To Reproduce Steps to reproduce this behavior:

Create a backup manually or scheduled

Expected behavior Backup doesn't fail

ohaitrans avatar May 06 '21 23:05 ohaitrans

This seems more like an issue somewhere in the networking/data sending part of the process, and nothing to do with the actual backup itself. The error is because the Panel saw a request to change a backup's status, but there was no successful field passed along, which should be impossible in Wings in the first place.

Also note that the log says "failed to notify panel of successful backup state" which means the backup was fine, but something went wrong between Wings and the Panel which cause the POST data to be lost. Do you have a proxy or something running that could be interfering?

DaneEveritt avatar May 07 '21 15:05 DaneEveritt

Do you use cloudflare maybe for you s3 host or another CDN that has an "upload/POST limit"? I had a similar issue like you and it was solved after disabling cloudflare.

VibeGAMESNL avatar May 12 '21 10:05 VibeGAMESNL

Tested more, not 100% sure it's related to transfer speed, but I've only experienced the issue when the backups are large and when

  • Using slow S3 storage or
  • Using fast S3 storage but with a slow disk (such as a network drive)

While uploading to S3 or when it finishes uploading, the backup appears as failed in the panel, but wings.log says "backup has been successfully uploaded" when finished uploading. The parts are uploaded, but they remain unassembled and must be deleted manually.

The "failed to notify panel of successful backup state" only shows up after a while or when deleting the failed backup from the panel.

I don't think there's a connection issue between wings and the panel, I don't have a proxy or something else that is probably interfering.

ohaitrans avatar May 21 '21 03:05 ohaitrans

You need to add/redefine the BACKUP_PRUNE_AGE on your .env The default is 360 (minutes)

GravityCube avatar May 21 '21 16:05 GravityCube

The backups fail after only 10-20 minutes.

I also found the issue happens with large backups when using a mounted remote filesystem like with rclone or sshfs:

 INFO: [May 22 07:25:47.804] creating backup for server adapter=wings backup=ac57f0f3-3fc9-4751-9520-9d94fae923af path=/mnt/pterobackup/ac57f0f3-3fc9-4751-9520-9d94fae923af.tar.gz request_id=4d4761c7-ed8b-4e61-b360-3e097d898714 server=66d203b4-7e2b-404f-9648-04f7e4d9a52a
 INFO: [May 22 07:37:26.197] created backup successfully adapter=wings backup=ac57f0f3-3fc9-4751-9520-9d94fae923af request_id=4d4761c7-ed8b-4e61-b360-3e097d898714 server=66d203b4-7e2b-404f-9648-04f7e4d9a52a
 INFO: [May 22 07:55:34.700] failed to notify panel of successful backup state error=Error response from Panel: ValidationException: The successful field must be present. (HTTP/422) server=66d203b4-7e2b-404f-9648-04f7e4d9a52a

Stacktrace:
Error response from Panel: ValidationException: The successful field must be present. (HTTP/422)
github.com/pterodactyl/wings/server.(*Server).notifyPanelOfBackup
	/home/runner/work/wings/wings/server/backup.go:29
github.com/pterodactyl/wings/server.(*Server).Backup
	/home/runner/work/wings/wings/server/backup.go:93
github.com/pterodactyl/wings/router.postServerBackup.func1
	/home/runner/work/wings/wings/router/router_server_backup.go:50
runtime.goexit
	/opt/hostedtoolcache/go/1.16.3/x64/src/runtime/asm_amd64.s:1371

This one was an 80GB backup, but works fine for smaller backups. After "creating backup for server" but before "created backup successfully", the panel showed the backup as failed. The file was successfully transferred.

ohaitrans avatar May 22 '21 12:05 ohaitrans

Error response from Panel: ValidationException: The successful field must be present. screams something being wrong with the request to the panel itself. You can see it clearly made a successful backup, and then for whatever reason butchered the HTTP request which caused Wings to think that failed, which then deletes the backup on the machine since it couldn't tell the Panel about it.

I don't actually think this has anything to do with the backup itself, theres something wrong with the communication to the Panel.

DaneEveritt avatar May 24 '21 17:05 DaneEveritt

I believe my own issue that I posted recently is a duplicate of this. I too have this issue consistently.

Sabinno avatar May 25 '21 15:05 Sabinno

35gb S3 backup with 3 hours time but http error happens, backups below 5gb are sent normally.

 INFO: [Jul 16 21:41:22.976] notified panel of failed backup state backup=4f791341-e6e9-4d94-b4f1-05c5c23b4432 server=c570d0d6-5c9a-4657-b62f-5ed7e9ff8ad9
ERROR: [Jul 16 21:41:22.976] router: failed to generate server backup error=backup: error while generating server backup: backup: failed to put S3 object: [HTTP/404] 404 Not Found request_id=02893aa2-0e85-400e-8b0f-daa8e064b602 server_id=c570d0d6-5c9a-4657-b62f-5ed7e9ff8ad9

Stacktrace:
backup: failed to put S3 object: [HTTP/404] 404 Not Found
github.com/pterodactyl/wings/server/backup.(*s3FileUploader).uploadPart.func1
	/home/runner/work/wings/wings/server/backup/backup_s3.go:229
github.com/cenkalti/backoff/v4.RetryNotifyWithTimer
	/home/runner/go/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:55
github.com/cenkalti/backoff/v4.RetryNotify
	/home/runner/go/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:34
github.com/cenkalti/backoff/v4.Retry
	/home/runner/go/pkg/mod/github.com/cenkalti/backoff/[email protected]/retry.go:28
github.com/pterodactyl/wings/server/backup.(*s3FileUploader).uploadPart
	/home/runner/work/wings/wings/server/backup/backup_s3.go:216
github.com/pterodactyl/wings/server/backup.(*S3Backup).generateRemoteRequest
	/home/runner/work/wings/wings/server/backup/backup_s3.go:157
github.com/pterodactyl/wings/server/backup.(*S3Backup).Generate
	/home/runner/work/wings/wings/server/backup/backup_s3.go:72
github.com/pterodactyl/wings/server.(*Server).Backup
	/home/runner/work/wings/wings/server/backup.go:69
github.com/pterodactyl/wings/router.postServerBackup.func1
	/home/runner/work/wings/wings/router/router_server_backup.go:50
runtime.goexit
	/opt/hostedtoolcache/go/1.16.5/x64/src/runtime/asm_amd64.s:1371

backup: error while generating server backup

OneHitX avatar Jul 17 '21 02:07 OneHitX

@OneHitX your issue is not the same as this bug report, please open a different issue to report that.

DaneEveritt avatar Jul 17 '21 17:07 DaneEveritt

Got the same issue: https://github.com/pterodactyl/panel/issues/3964 I have cloudflare in front of panel. Though I never experienced any communication issues between panel and wings. It only happens on S3 backups I'll try disabling Cloudflare on the panel domain though I still think it won't make the difference. As I said in my issue thread. Running S3 manually doesn't produce the issue.

realkarmakun avatar Feb 14 '22 11:02 realkarmakun