Unhandled errors in Jupyter client
Any of our calls to `get_shell_msg` and `get_iopub_msg` could raise `zmq.error.ZMQError`, particularly when closing the process. We should handle these and do something more useful.

Similarly for `conn.recv` - `ConnectionResetError` could be raised, and we should do better handling.
diff --git a/Python/Product/PythonTools/ptvsd/ipcjson.py b/Python/Product/PythonTools/ptvsd/ipcjson.py
index 7d50c0abd..722545940 100644
--- a/Python/Product/PythonTools/ptvsd/ipcjson.py
+++ b/Python/Product/PythonTools/ptvsd/ipcjson.py
@@ -238,7 +238,13 @@ class IpcChannel(object):
         try:
             msg = self.__message.pop(0)
         except IndexError:
-            self._wait_for_message()
+            msg = None
+
+        if msg is None:
+            try:
+                self._wait_for_message()
+            except OSError:
+                return self.__exit
             try:
                 msg = self.__message.pop(0)
             except IndexError:
diff --git a/Python/Product/PythonTools/ptvsd/repl/jupyter_client.py b/Python/Product/PythonTools/ptvsd/repl/jupyter_client.py
index 51fcb9bc6..533ddb8fa 100644
--- a/Python/Product/PythonTools/ptvsd/repl/jupyter_client.py
+++ b/Python/Product/PythonTools/ptvsd/repl/jupyter_client.py
@@ -36,6 +36,7 @@ from ptvsd.util import to_bytes
 try:
     import jupyter_client
     import jupyter_client.manager
+    import zmq.error
 except ImportError:
     raise UnsupportedReplException("Jupyter mode requires the jupyter_client and ipykernel packages. " + traceback.format_exc())
 
@@ -362,6 +363,8 @@ class JupyterClientBackend(ReplBackend):
                     for callable in on_reply:
                         callable(m)
 
+        except zmq.error.ZMQError:
+            self.exit_process()
         except KeyboardInterrupt:
             self.exit_process()
         except:
@@ -400,6 +403,8 @@ class JupyterClientBackend(ReplBackend):
                     print("Received: " + m.msg_type + ":" + str(m) + "\\n")
                     self.write_stdout(str(m) + '\\n')
 
+        except zmq.error.ZMQError:
+            self.exit_process()
         except KeyboardInterrupt:
             self.exit_process()
         except:
['Python/Product/PythonTools/ptvsd/ipcjson.py', 'Python/Product/PythonTools/ptvsd/repl/jupyter_client.py']