Skip to content

Commit

Permalink
Temporary fix for TAO
Browse files Browse the repository at this point in the history
Summary: I'm investigating a TAO crash and while I'm not yet sure of the root cause, I know where it is crashing.  Add some checks in the code to prevent the crash from occurring to see if TAO can make progress while waiting for the root cause fix.

Differential Revision: D63038824

fbshipit-source-id: d01e733f152ccbf19f14055295d9a920e3a112ee
  • Loading branch information
Jay Edgar authored and facebook-github-bot committed Sep 19, 2024
1 parent 495af87 commit 77192f1
Showing 1 changed file with 20 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,32 @@ namespace facebook::common::mysql_client::mysql_protocol {
class MysqlRowMetadata;

size_t MysqlResult::numFields() const {
// T202181457
if (!res_) {
return 0;
}
auto ret = mysql_num_fields(res_.get());
VLOG(4) << fmt::format(
"mysql_num_fields({}) returned {}", (void*)res_.get(), ret);
return ret;
}

MYSQL_FIELD* MysqlResult::fields() const {
// T202181457
if (!res_) {
return nullptr;
}
auto ret = mysql_fetch_fields(res_.get());
VLOG(4) << fmt::format(
"mysql_fetch_fields({}) returned {}", (void*)res_.get(), (void*)ret);
return ret;
}

size_t MysqlResult::numRows() const {
// T202181457
if (!res_) {
return 0;
}
auto ret = mysql_num_rows(res_.get());
VLOG(4) << fmt::format(
"mysql_num_rows({}) returned {}", (void*)res_.get(), ret);
Expand Down Expand Up @@ -64,6 +76,8 @@ InternalResult::FetchRowRet MysqlRowFactory(
} // namespace

InternalResult::FetchRowRet SyncMysqlResult::fetchRow() {
// T202181457
CHECK(res_);
auto mysqlRow = mysql_fetch_row(res_.get());
VLOG(4) << fmt::format(
"mysql_fetch_row({}) returned {}", (void*)res_.get(), (void*)mysqlRow);
Expand All @@ -74,6 +88,12 @@ InternalResult::FetchRowRet SyncMysqlResult::fetchRow() {
InternalResult::FetchRowRet AsyncMysqlResult::fetchRow() {
std::unique_ptr<InternalRow> row;

// T202181457
if (!res_) {
return std::make_pair(
MysqlConnection::toHandlerStatus(NET_ASYNC_ERROR), std::move(row));
}

MYSQL_ROW mysqlRow;
auto ret = mysql_fetch_row_nonblocking(res_.get(), &mysqlRow);
VLOG(4) << fmt::format(
Expand Down

0 comments on commit 77192f1

Please sign in to comment.