LGTM

On Friday, April 8, 2016 at 6:40:16 PM UTC+1, Brian Foley wrote:
>
> If ganeti-rapi/ganeti-noded receive a request while dom0 is under 
> resource pressure, it is possible for fork() to fail. Currently this 
> isn't handled, and leads to asyncore.dispatcher.log_info printing an 
> error to stdout, HttpServer exiting its runloop and terminating the 
> daemon. 
>
> Fix this by logging the error closing the connection since there isn't 
> very much else we can do. 
>
> Signed-off-by: Brian Foley <[email protected]> 
> --- 
>  lib/http/server.py | 13 ++++++++++++- 
>  1 file changed, 12 insertions(+), 1 deletion(-) 
>
> diff --git a/lib/http/server.py b/lib/http/server.py 
> index 835b737..81be4a6 100644 
> --- a/lib/http/server.py 
> +++ b/lib/http/server.py 
> @@ -574,7 +574,18 @@ class HttpServer(http.HttpBase, asyncore.dispatcher): 
>   
>      self._CollectChildren(False) 
>   
> -    pid = os.fork() 
> +    try: 
> +      pid = os.fork() 
> +    except OSError: 
> +      logging.exception("Failed to fork on request from %s:%s", 
> +                        client_addr[0], client_addr[1]) 
> +      # Immediately close the connection. No SSL handshake has been done. 
> +      try: 
> +        connection.close() 
> +      except socket.error: 
> +        pass 
> +      return 
> + 
>      if pid == 0: 
>        # Child process 
>        try: 
> -- 
> 2.8.0.rc3.226.g39d4020 
>
>

Reply via email to