From c591b47532d3cc272d5ff80d4632d4b61f2a3b2e Mon Sep 17 00:00:00 2001 From: Steven Moreland Date: Thu, 16 Sep 2021 13:56:11 -0700 Subject: libbinder: RPC use DEAD_OBJECT over -ECANCELED When we shutdown a connection with FdTrigger, we return -ECANCELED. However, the next call to that FD will return with -EPIPE (DEAD_OBJECT). It's not really important: if your call happens to get interrupted, you'll get -ECANCELED or if your call happened to be scheduled slightly later, you'd get DEAD_OBJECT. Actually, we don't care to distinguish between these two cases because existing clients of libbinder only have and consider DEAD_OBJECT now. Whether the server is shutting down right now, or you make the call a tiny bit later, we want to return the exact same error code in order to be consistent w/ the behavior of libbinder when it uses the binder driver. This was causing a flake in a later CL (fixing the 'Die' race), when rpcSend failing causes the server to shutdown. Bug: 200167417 Test: binderRpcTest 'Callbacks' case repeated 100s of times Change-Id: Id2977f05eb249691326955e6f2424d4e5e08b417 --- libs/binder/FdTrigger.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libs/binder/FdTrigger.cpp') diff --git a/libs/binder/FdTrigger.cpp b/libs/binder/FdTrigger.cpp index ecf13dc583..49f83ff346 100644 --- a/libs/binder/FdTrigger.cpp +++ b/libs/binder/FdTrigger.cpp @@ -53,7 +53,7 @@ status_t FdTrigger::triggerablePoll(base::borrowed_fd fd, int16_t event) { continue; } if (pfd[1].revents & POLLHUP) { - return -ECANCELED; + return DEAD_OBJECT; } return pfd[0].revents & event ? OK : DEAD_OBJECT; } -- cgit v1.2.3-59-g8ed1b