]> xenbits.xensource.com Git - xen.git/commitdiff
oxenstored: catch the error when a connection is already deleted
authorZheng Li <dev@zheng.li>
Fri, 24 Mar 2017 17:01:08 +0000 (17:01 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Wed, 5 Apr 2017 14:26:37 +0000 (15:26 +0100)
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.

Reported-by: Juergen Gross <jgross@suse.com>
Signed-off-by: Zheng Li <dev@zheng.li>
Reviewed-by: David Scott <dave.scott@citrix.com>
tools/ocaml/xenstored/xenstored.ml

index 438ecb9599159d925ebbec52c85167a0f9a479a0..d74846c64045c4c79c1e31686f45291360e3729f 100644 (file)
@@ -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