diff --git a/sql/sql_class.h b/sql/sql_class.h index fd04135..8b62412 100644 --- a/sql/sql_class.h +++ b/sql/sql_class.h @@ -2543,6 +2543,11 @@ private: NET net; // client connection descriptor String packet; // dynamic buffer for network I/O public: + bool got_net_error() const + { + return net.error != 0; + } + void issue_unsafe_warnings(); uint get_binlog_table_maps() const { diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index 50591c5..07da193 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -1167,6 +1168,14 @@ out: DBUG_ASSERT(thd->m_digest == NULL); DBUG_ASSERT(thd->m_statement_psi == NULL); } + + /* + If net operations fail with error, we should close the socket connection + othewise client would be blocked waiting for more data but server side isn't + sending any more data to it. + */ + if (!return_value && thd->got_net_error() && tdsql_disconnect_on_write_timeout) + return_value= true; DBUG_RETURN(return_value); } #endif /* EMBEDDED_LIBRARY */