Page MenuHomePhabricator

[services] Backup - Fix premature errors crash
ClosedPublic

Authored by karol on Mar 29 2022, 4:39 AM.
Tags
None
Referenced Files
F3106873: D3533.diff
Thu, Oct 31, 4:14 AM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:36 PM
Unknown Object (File)
Sun, Oct 13, 4:35 PM
Unknown Object (File)
Sun, Oct 13, 4:32 PM

Details

Summary

Depends on D3532

In CreateNewBackupReactor when an error occurs before the putReactor is created, there is a crash, because we try to use the putReactor in doneCallback but it's nullptr.

Test Plan
cd services
yarn run-backup-service

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

tomek requested changes to this revision.Apr 1 2022, 4:22 AM

If we can't execute doneCallback maybe we should not call it at all?

This revision now requires changes to proceed.Apr 1 2022, 4:22 AM

still need to address the feedback

In D3533#98253, @palys-swm wrote:

If we can't execute doneCallback maybe we should not call it at all?

What do you mean?

tomek requested changes to this revision.Apr 5 2022, 9:26 AM
In D3533#98617, @karol-bisztyga wrote:
In D3533#98253, @palys-swm wrote:

If we can't execute doneCallback maybe we should not call it at all?

What do you mean?

In the summary you mentioned that

In CreateNewBackupReactor when an error occurs before the putReactor is created, there is a crash, because we try to use the putReactor in doneCallback but it's nullptr.

Which means that the code crashes because we call doneCallback in CreateNewBackupReactor after an error. I was asking if it makes sense to completely avoid calling doneCallback in that case instead of adding early return to it. Do you think it makes sense? Which solution do you prefer?

This revision now requires changes to proceed.Apr 5 2022, 9:26 AM

This is against the whole idea behind the doneCallback - it should be called regardless of whether an error has been thrown or not. In this callback, we can access this->status and see if there was an error or not.
The purpose of this callback is to perform operations when a reactor is finishing and there are no more grpc operations left.

In D3533#99379, @karol-bisztyga wrote:

This is against the whole idea behind the doneCallback - it should be called regardless of whether an error has been thrown or not. In this callback, we can access this->status and see if there was an error or not.
The purpose of this callback is to perform operations when a reactor is finishing and there are no more grpc operations left.

Ok, that makes sense! Thanks for explaining it

services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h
106

What is the purpose of this empty string?

This revision is now accepted and ready to land.Apr 6 2022, 6:46 AM
services/backup/docker-server/contents/server/src/Reactors/server/CreateNewBackupReactor.h
106

It's a leftover, I forgot to remove it, thanks