From patchwork Fri Jul 10 11:33:21 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dumitru Ceara X-Patchwork-Id: 1326700 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=openvswitch.org (client-ip=140.211.166.138; helo=whitealder.osuosl.org; envelope-from=ovs-dev-bounces@openvswitch.org; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=redhat.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=hIk0Za+F; dkim-atps=neutral Received: from whitealder.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4B39sj4lc2z9sSn for ; Fri, 10 Jul 2020 21:33:45 +1000 (AEST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 06F96896B0; Fri, 10 Jul 2020 11:33:44 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id B88ieIJSLzfO; Fri, 10 Jul 2020 11:33:40 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [140.211.9.56]) by whitealder.osuosl.org (Postfix) with ESMTP id 5DAB1896EB; Fri, 10 Jul 2020 11:33:40 +0000 (UTC) Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 4458FC0890; Fri, 10 Jul 2020 11:33:40 +0000 (UTC) X-Original-To: dev@openvswitch.org Delivered-To: ovs-dev@lists.linuxfoundation.org Received: from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id CDABDC016F for ; Fri, 10 Jul 2020 11:33:39 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by silver.osuosl.org (Postfix) with ESMTP id 91A9B265BB for ; Fri, 10 Jul 2020 11:33:39 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from silver.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 5D5-8vkWsyiu for ; Fri, 10 Jul 2020 11:33:38 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) by silver.osuosl.org (Postfix) with ESMTPS id 49376227AD for ; Fri, 10 Jul 2020 11:33:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1594380817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:content-type:content-type; bh=AOy6vjnLoc3r2WWZXWuaGz67BtvSBwFBw7UIT2OAk9U=; b=hIk0Za+FtW+ACpdCIJ64zSgqK1MJvoMYOxtVh92UlmtzGj6K6rCwTsI1Rr8n5Si3xXetWC iEDiEjmdDzuaCJQVjP9Dg8hnNbp5lIlUH+mrHf7s6QgIxnjJrk597RUJ6yLW7Fe1TKpkV2 kcg7Vfig716tyqhfRmGnz/xLl6bpMV8= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-162-nprECZckP9mK2ZlPwgyzWg-1; Fri, 10 Jul 2020 07:33:32 -0400 X-MC-Unique: nprECZckP9mK2ZlPwgyzWg-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 1503E18FF662; Fri, 10 Jul 2020 11:33:31 +0000 (UTC) Received: from dceara.remote.csb (ovpn-114-36.ams2.redhat.com [10.36.114.36]) by smtp.corp.redhat.com (Postfix) with ESMTP id 877635C1D6; Fri, 10 Jul 2020 11:33:29 +0000 (UTC) From: Dumitru Ceara To: dev@openvswitch.org Date: Fri, 10 Jul 2020 13:33:21 +0200 Message-Id: <1594380801-32134-1-git-send-email-dceara@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Cc: Han Zhou , Ilya Maximets Subject: [ovs-dev] [PATCH] ovsdb-idl: Send "set_db_change_aware" before "monitor_cond_since". X-BeenThere: ovs-dev@openvswitch.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: ovs-dev-bounces@openvswitch.org Sender: "dev" For short lived IDL clients (e.g., ovn-sbctl) if the client sends monitor_cond_since before set_db_change_aware, the client might close the DB connection immediately after it received the reply for monitor_cond_since and before the server has a chance to reply to set_db_change_aware. E.g., from the logs of the ovsdb-server: 2020-07-10T09:29:52.649Z|04479|jsonrpc|DBG|unix#72: received request, method="monitor_cond_since", params=["OVN_Southbound", ["monid","OVN_Southbound"],{"SB_Global":[{"columns":["options"]}]}, "00000000-0000-0000-0000-000000000000"], id=2 2020-07-10T09:29:52.649Z|04480|jsonrpc|DBG|unix#72: send reply, result=[false,"00000000-0000-0000-0000-000000000000", {"SB_Global":{"6ad26b48-a742-4fe1-8671-3975e2146ce6":{"initial": {"options":["map",[["mac_prefix","be:85:cb"],["svc_monitor_mac", "52:58:b5:19:8c:40"]]]}}}}], id=2 2020-07-10T09:29:52.649Z|04482|jsonrpc|DBG|unix#72: received request, method="set_db_change_aware", params=[true], id=3 <<< IDL client closes the connection here because it already got the response to the monitor_cond_since request. 2020-07-10T09:29:59.023Z|04483|jsonrpc|DBG|unix#72: send reply, result={}, id=3 2020-07-10T09:29:59.023Z|04484|stream_fd|DBG|send: Broken pipe 2020-07-10T09:29:59.023Z|04485|jsonrpc|WARN|unix#72: send error: Broken pipe While this is not a critical issue, it can be easily mitigated by changing the IDL client to always send "set_db_change_aware" before "monitor_cond_since". This way we ensure that a well behaving IDL client doesn't close the connection too early, avoiding the error logs in ovsdb-server. This patch moves the code to send monitor_cond_since(data) from function ovsdb_idl_check_server_db() to ovsdb_idl_process_response() as we can transition to IDL_S_DATA_MONITOR_COND_SINCE_REQUESTED only upon receiving a reply for monitor_cond(server). CC: Ben Pfaff CC: Han Zhou CC: Ilya Maximets Reported-by: Girish Moodalbail Reported-at: https://mail.openvswitch.org/pipermail/ovs-discuss/2020-July/050343.html Fixes: 1b1d2e6daa56 ("ovsdb: Introduce experimental support for clustered databases.") Signed-off-by: Dumitru Ceara Acked-by: Numan Siddique --- lib/ovsdb-idl.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/ovsdb-idl.c b/lib/ovsdb-idl.c index ef3b97b..c6427f5 100644 --- a/lib/ovsdb-idl.c +++ b/lib/ovsdb-idl.c @@ -770,6 +770,10 @@ ovsdb_idl_process_response(struct ovsdb_idl *idl, struct jsonrpc_msg *msg) OVSDB_IDL_MM_MONITOR_COND); if (ovsdb_idl_check_server_db(idl)) { ovsdb_idl_send_db_change_aware(idl); + ovsdb_idl_send_monitor_request( + idl, &idl->data, OVSDB_IDL_MM_MONITOR_COND_SINCE); + ovsdb_idl_transition( + idl, IDL_S_DATA_MONITOR_COND_SINCE_REQUESTED); } } else { ovsdb_idl_send_schema_request(idl, &idl->data); @@ -2057,9 +2061,6 @@ ovsdb_idl_check_server_db(struct ovsdb_idl *idl) if (idl->state == IDL_S_SERVER_MONITOR_COND_REQUESTED) { json_destroy(idl->data.schema); idl->data.schema = json_from_string(database->schema); - ovsdb_idl_send_monitor_request(idl, &idl->data, - OVSDB_IDL_MM_MONITOR_COND_SINCE); - ovsdb_idl_transition(idl, IDL_S_DATA_MONITOR_COND_SINCE_REQUESTED); } return true; }