Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Issue 2291453006: chromeos: Fix potential crash in SessionManagerClient (Closed)

Created:
4 years, 3 months ago by hashimoto
Modified:
4 years, 3 months ago
Reviewers:
achuithb, Daniel Erat
CC:
chromium-reviews, oshima+watch_chromium.org, hashimoto+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

chromeos: Fix potential crash in SessionManagerClient ErrorResponse can be null when an error happens locally. Also, this logging is unnecessary as ObjectProxy::CallMethod is already doing that. BUG=642241 Committed: https://crrev.com/b159d73f7098b1d36aff32c4ff593495a3c710b7 Cr-Commit-Position: refs/heads/master@{#415591}

Patch Set 1 #

Total comments: 1
Unified diffs Side-by-side diffs Delta from patch set Stats (+2 lines, -7 lines) Patch
M chromeos/dbus/session_manager_client.cc View 2 chunks +2 lines, -7 lines 1 comment Download

Messages

Total messages: 25 (9 generated)
hashimoto
4 years, 3 months ago (2016-08-30 05:52:41 UTC) #3
achuithb
Could you hold off on landing this for a few days until we resolve this ...
4 years, 3 months ago (2016-08-30 08:08:06 UTC) #8
hashimoto
On 2016/08/30 08:08:06, achuithb wrote: > Could you hold off on landing this for a ...
4 years, 3 months ago (2016-08-30 08:12:50 UTC) #9
achuithb
On 2016/08/30 08:12:50, hashimoto wrote: > On 2016/08/30 08:08:06, achuithb wrote: > > Could you ...
4 years, 3 months ago (2016-08-30 08:56:19 UTC) #10
achuithb
https://codereview.chromium.org/2291453006/diff/1/chromeos/dbus/session_manager_client.cc File chromeos/dbus/session_manager_client.cc (left): https://codereview.chromium.org/2291453006/diff/1/chromeos/dbus/session_manager_client.cc#oldcode87 chromeos/dbus/session_manager_client.cc:87: LOG(ERROR) << "DBus error " << response->ToString(); Add a ...
4 years, 3 months ago (2016-08-30 08:56:28 UTC) #11
hashimoto
Sorry, I don't understand what you mean by "impeding". I'm just fixing a bug which ...
4 years, 3 months ago (2016-08-30 11:20:07 UTC) #12
Daniel Erat
On 2016/08/30 11:20:07, hashimoto wrote: > Sorry, I don't understand what you mean by "impeding". ...
4 years, 3 months ago (2016-08-30 15:15:05 UTC) #13
Daniel Erat
On 2016/08/30 15:15:05, Daniel Erat wrote: > On 2016/08/30 11:20:07, hashimoto wrote: > > Sorry, ...
4 years, 3 months ago (2016-08-30 15:15:22 UTC) #14
achuithb
On 2016/08/30 11:20:07, hashimoto wrote: > Sorry, I don't understand what you mean by "impeding". ...
4 years, 3 months ago (2016-08-30 18:02:36 UTC) #15
hashimoto
On 2016/08/30 18:02:36, achuithb wrote: > On 2016/08/30 11:20:07, hashimoto wrote: > > Sorry, I ...
4 years, 3 months ago (2016-08-31 08:16:40 UTC) #16
hashimoto
On 2016/08/30 15:15:22, Daniel Erat wrote: > On 2016/08/30 15:15:05, Daniel Erat wrote: > > ...
4 years, 3 months ago (2016-08-31 08:29:34 UTC) #17
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2291453006/1
4 years, 3 months ago (2016-08-31 08:30:03 UTC) #19
commit-bot: I haz the power
Committed patchset #1 (id:1)
4 years, 3 months ago (2016-08-31 09:21:15 UTC) #21
commit-bot: I haz the power
Patchset 1 (id:??) landed as https://crrev.com/b159d73f7098b1d36aff32c4ff593495a3c710b7 Cr-Commit-Position: refs/heads/master@{#415591}
4 years, 3 months ago (2016-08-31 09:22:56 UTC) #23
Daniel Erat
On 2016/08/31 08:29:34, hashimoto wrote: > On 2016/08/30 15:15:22, Daniel Erat wrote: > > On ...
4 years, 3 months ago (2016-08-31 15:33:05 UTC) #24
hashimoto
4 years, 3 months ago (2016-09-01 02:28:37 UTC) #25
Message was sent while issue was closed.
On 2016/08/31 15:33:05, Daniel Erat wrote:
> On 2016/08/31 08:29:34, hashimoto wrote:
> > On 2016/08/30 15:15:22, Daniel Erat wrote:
> > > On 2016/08/30 15:15:05, Daniel Erat wrote:
> > > > On 2016/08/30 11:20:07, hashimoto wrote:
> > > > > Sorry, I don't understand what you mean by "impeding".
> > > > > I'm just fixing a bug which was introduced in an attempt to fix
another
> > bug.
> > > > > I know it's stressful to work on a complicated bug, but it's sad to
> > receive
> > > > this
> > > > > kind of response in a professional code review.
> > > > > 
> > > > > LogMethodCallFailure doesn't log service unknown and object unknown if
> > it's
> > > > > constructed with options, but that's not the case here because
> > > > > SessionManagerClient uses GetObjectProxy instead of
> > > GetObjectProxyWithOptions.
> > > > > 
> > > > > IIUC you don't need to add any additional logging because
> > > LogMethodCallFailure
> > > > > logs all D-Bus errors if ErrorResponse is available.
> > > > > If ErrorResponse is not available, SessionManager's OnRestartJob logs
it
> > as
> > > it
> > > > > gets called with null dbus::Response.
> > > > 
> > > > lgtm
> > > > 
> > > > thanks, i see the logging. it looks like we should see either
LOG(WARNING)
> > or
> > > > LOG(ERROR) or failure.
> > > > 
> > > > it'd probably be good to document the fact that ErrorResponse can be
null
> in
> > > > dbus/object_proxy.h -- it wasn't obvious to me that that can happen
> without
> > > > reading the implementation.
> > > 
> > > s/or failure/on failure/
> > It's already written in object_proxy.h
> > (https://cs.chromium.org/chromium/src/dbus/object_proxy.h?rcl=0&l=143), but
> > maybe we should change the comment to make it more obvious.
> > Do you have any idea for improvement?
> > I am the one who added CallMethodWithErrorCallback in
> > https://chromiumcodereview.appspot.com/10121005 with the existing comment,
so
> > probably I'm a too bad writer to rewrite it.
> 
> ah, i think i misunderstood it as saying that the non-error callback will get
> NULL:
> 
>   // If the method call is successful, a pointer to Response object will
>   // be passed to the callback. If unsuccessful, the error callback will be
>   // called and a pointer to ErrorResponse object will be passed to the error
>   // callback if available, otherwise NULL will be passed.
> 
> maybe this would be a bit clearer?
> 
> "If unsuccessful, the error callback will be invoked with an ErrorResponse
> object (if the remote object returned an error) or NULL (if a response was not
> received at all)."
Looks great, thanks!
Made a CL https://codereview.chromium.org/2299853002
> 
> it's also not completely clear to me when the non-error callback will be
invoked
> with NULL. from glancing at the code, i *think* that that only happens when
the
> call fails after you use ObjectProxy::CallMethod() instead of passing your own
> error callback. is that correct?
Correct.

CallMethod():
 No response -> callback.Run(nullptr)
 Error response -> callback.Run(nullptr) + logging
 Success -> callback.Run(response)

CallMethodWithErrorCallback():
 No response -> error_callback.Run(nullptr)
 Error response -> error_callback.Run(error_response)
 Success -> callback.Run(response)

Powered by Google App Engine
This is Rietveld 408576698