Page MenuHomePhabricator

[services] Backup - Fix terminate callback in pull backup reactor
ClosedPublic

Authored by karol on Jun 7 2022, 12:26 AM.
Tags
None
Referenced Files
F3362168: D4223.id13371.diff
Sun, Nov 24, 9:43 PM
Unknown Object (File)
Fri, Nov 8, 11:06 PM
Unknown Object (File)
Sat, Nov 2, 9:37 AM
Unknown Object (File)
Sat, Nov 2, 9:37 AM
Unknown Object (File)
Sat, Nov 2, 9:37 AM
Unknown Object (File)
Sat, Nov 2, 9:37 AM
Unknown Object (File)
Sat, Nov 2, 9:35 AM
Unknown Object (File)
Sun, Oct 27, 10:10 PM

Details

Summary

We have to check whether the get reactor is initialized in the pull backup reactor before checking its status. The initialization of this reactor happens in the writeResponse method so if we have an error in the initialize method, terminate's going to be called with get reactor uninitialized and that will lead to a crash.

Test Plan

make a request for pulling a backup without passing a backup id (missing any fields would trigger this I think).

Diff Detail

Repository
rCOMM Comm
Branch
fix-pull-backup-reactor
Lint
No Lint Coverage
Unit
No Test Coverage

Event Timeline

karol edited the test plan for this revision. (Show Details)
karol added a reviewer: tomek.

CI looks dead at the moment and I'm pretty sure it's going to compile.

In D4223#119338, @karol-bisztyga wrote:

CI looks dead at the moment and I'm pretty sure it's going to compile.

Sorry, the issue here was with the switch from phabricator.ashoat.com => phab.comm.dev. Had to update the webhook endpoint in Buildkite for the build status to get picked up by Phabricator.

Kicked off the builds again... hopefully everything works as expected. Will take a look to see if any other diffs are stuck in this state and kick them off again.

tomek added inline comments.
services/backup/src/Reactors/server/PullBackupReactor.cpp
140–141

From the summary it looks like this->getReactor == nullptr means that there was an error - shouldn't we throw in that case?

This revision is now accepted and ready to land.Jun 13 2022, 3:20 AM
services/backup/src/Reactors/server/PullBackupReactor.cpp
140–141

No. You're introducing a crash here. If get reactor is null, then reading anything from it in the next line causes a crash.

I think it suffices to look at the status in terms of deciding whether an error occurred or not.