Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6147e4f0 authored by Steven Moreland's avatar Steven Moreland
Browse files

RPC Binder: -ECONNRESET => DEAD_OBJECT

This is for consistency with kernel binder. Sometimes, socket
failures result in -ECONNRESET when the connection is not
available. Right now, this may be thrown as a different error,
and we will only recover after the next transaction returns
the DEAD_OBJECT error. Coalesce this error so that we have
consistent behavior between kernel and RPC binder.

Bug: 392717039
Bug: 419364025
Test: binderRpcTest
Flag: EXEMPT .
Change-Id: I80cf8124f9d9c4749b556a9287720f985cf82c3e
parent a4bed6a9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -386,6 +386,12 @@ static inline status_t handleRpcError(const std::unique_ptr<RpcTransport>& trans
              transport.get(), statusToString(status).c_str());
    }
    (void)session->shutdownAndWait(false);

    if (status == -ECONNRESET) {
        LOG_RPC_DETAIL("Converting -ECONNRESET to DEAD_OBJECT.");
        status = DEAD_OBJECT;
    }

    return status;
}

+1 −2
Original line number Diff line number Diff line
@@ -734,8 +734,7 @@ TEST_P(BinderRpc, SendTooLargeVector) {
    std::vector<uint8_t> result;
    status_t res = rootIface2->repeatBytes(kTestValue, &result).transactionError();

    // TODO(b/392717039): consistent error results always
    EXPECT_TRUE(res == -ECONNRESET || res == DEAD_OBJECT) << statusToString(res);
    EXPECT_EQ(res, DEAD_OBJECT) << statusToString(res);

    // died, so remove it for checks in destructor of proc
    proc.proc->sessions.erase(proc.proc->sessions.begin() + 1);