From 38ffaeebc922e85aca8d9d68c5cd4641e5cd73fd Mon Sep 17 00:00:00 2001 From: Shuhei Takahashi Date: Thu, 7 Nov 2019 16:51:27 +0900 Subject: [PATCH] chrome: Ignore errors of rpcc.Conn.Close. rpcc.Conn invokes Target.DetachFromTarget before closing the connection, which fails if the target is already closed. This error is not a real problem, but it can confuse cautious callers who check errors of Close. See also an upstream bug: https://github.com/mafredri/cdp/issues/110 BUG=chromium:1020484 TEST=tast run betty ui.ChromeSanity Change-Id: I0fb1e50a683e493195874344c07f66a8ecefd40e Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/tast-tests/+/1903152 Tested-by: Shuhei Takahashi Commit-Queue: Shuhei Takahashi Reviewed-by: Hidehiko Abe --- src/chromiumos/tast/local/chrome/cdputil/conn.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/chromiumos/tast/local/chrome/cdputil/conn.go b/src/chromiumos/tast/local/chrome/cdputil/conn.go index a2c6795d77d..c0287a61ff1 100644 --- a/src/chromiumos/tast/local/chrome/cdputil/conn.go +++ b/src/chromiumos/tast/local/chrome/cdputil/conn.go @@ -64,7 +64,13 @@ func (s *Session) NewConn(ctx context.Context, id target.ID) (conn *Conn, retErr // Close releases the resources associated with the connection. func (c *Conn) Close() error { - return c.co.Close() + // TODO(crbug.com/1020484): Return the error from rpcc.Conn.Close. + // rpcc.Conn invokes Target.DetachFromTarget before closing the connection, + // which fails if the target is already closed. This error is not a real + // problem, but it can confuse cautious callers who check errors of Close. + // See also an upstream bug: https://github.com/mafredri/cdp/issues/110 + c.co.Close() + return nil } // ConsoleAPICalled creates a client for ConsoleAPICalled events.