From 3fd78c922c2670333e2cfa947e50f64460ced721 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Mon, 20 Mar 2017 11:11:19 -0700 Subject: [PATCH] adb: detect closed jdwp socket. If a process opens a JDWP socket, but crashes before writing the full PID, adbd will spin forever. Bug: http://b/36411868 Test: none Change-Id: I1811759e15c3d9c819685c5fc159a566bd4bc842 --- adb/jdwp_service.cpp | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/adb/jdwp_service.cpp b/adb/jdwp_service.cpp index 9589d8885..af911bf90 100644 --- a/adb/jdwp_service.cpp +++ b/adb/jdwp_service.cpp @@ -232,11 +232,7 @@ static void jdwp_process_event(int socket, unsigned events, void* _proc) { size_t size = PID_LEN - proc->in_len; ssize_t rc = TEMP_FAILURE_RETRY(recv(socket, p, size, 0)); - if (rc < 0) { - if (errno == EAGAIN) { - return; - } - + if (rc <= 0) { D("failed to read jdwp pid: %s", strerror(errno)); goto CloseProcess; }