diff --git a/sql/sql_class.h b/sql/sql_class.h
index db22fc5d67b4a9fafcb07739ea0183bcbaaee50a..b73f830463e7f2b6829d00f38924cdef4c5f478e 100644
--- a/sql/sql_class.h
+++ b/sql/sql_class.h
@@ -2459,7 +2459,12 @@ public:
   /** Return FALSE if connection to client is broken. */
   bool is_connected()
   {
-    return vio_ok() ? vio_is_connected(net.vio) : FALSE;
+    /*
+      All system threads (e.g., the slave IO thread) are connected but
+      not using vio. So this function always returns true for all
+      system threads.
+    */
+    return system_thread || (vio_ok() ? vio_is_connected(net.vio) : FALSE);
   }
 #else
   inline bool vio_ok() const { return TRUE; }