From mboxrd@z Thu Jan 1 00:00:00 1970 From: Zheng Li Subject: [PATCH 4/8] oxenstored: catch the error when a connection is already deleted Date: Mon, 15 Sep 2014 23:39:16 +0100 Message-ID: <1410820760-7994-5-git-send-email-dev@zheng.li> References: <1410820760-7994-1-git-send-email-dev@zheng.li> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XTexg-000737-Oa for xen-devel@lists.xenproject.org; Mon, 15 Sep 2014 22:41:32 +0000 In-Reply-To: <1410820760-7994-1-git-send-email-dev@zheng.li> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Dave Scott , Joe Jin , "Luis R. Rodriguez" , Luonengjun , Zheng Li , Fanhenglong , "Liuqiming (John)" , Ian Jackson List-Id: xen-devel@lists.xenproject.org The function process_fdset_with is called on the read set connections first. During the process, it might destroy a connection and remove it from the connections database if some errors occur. However, a reference to the same connection might still exist in the write set, which is awaiting to be processed next. In this case, a Not_found error will be raised and the process is aborted. This patch changes the logic to ignore connections just missing from the connection database and continue the rest part of the work. Signed-off-by: Zheng Li --- tools/ocaml/xenstored/xenstored.ml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/ocaml/xenstored/xenstored.ml b/tools/ocaml/xenstored/xenstored.ml index dacea21..ea1a08f 100644 --- a/tools/ocaml/xenstored/xenstored.ml +++ b/tools/ocaml/xenstored/xenstored.ml @@ -43,8 +43,11 @@ let process_connection_fds store cons domains rset wset = debug "closing socket connection" in let process_fdset_with fds fct = - List.iter (fun fd -> try_fct fct (Connections.find cons fd)) fds - in + List.iter + (fun fd -> + try try_fct fct (Connections.find cons fd) + with Not_found -> () + ) fds in process_fdset_with rset Process.do_input; process_fdset_with wset Process.do_output -- 2.1.0