Skip to content

Commit

Permalink
Add timeout value to the ingress timeout failure message
Browse files Browse the repository at this point in the history
Reviewed By: JunqiWang

Differential Revision: D54854639

fbshipit-source-id: ba77197eece8aded5f6fa58c6b8885d34af2ea34
  • Loading branch information
Nishant Nori authored and facebook-github-bot committed Mar 22, 2024
1 parent 72f28a3 commit a96bebe
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
22 changes: 20 additions & 2 deletions proxygen/lib/http/session/HTTPTransaction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -782,15 +782,33 @@ void HTTPTransaction::onIngressTimeout() {
if (windowUpdateTimeout) {
HTTPException ex(
HTTPException::Direction::INGRESS_AND_EGRESS,
folly::to<std::string>("ingress timeout, streamID=", id_));
folly::to<std::string>(
"ingress timeout, streamID=",
id_,
", timeout=",
idleTimeout_.has_value()
? std::chrono::duration_cast<std::chrono::milliseconds>(
idleTimeout_.value())
.count()
: -1,
"ms"));
ex.setProxygenError(kErrorWriteTimeout);
// This is a protocol error
ex.setCodecStatusCode(ErrorCode::PROTOCOL_ERROR);
onError(ex);
} else {
HTTPException ex(
HTTPException::Direction::INGRESS,
folly::to<std::string>("ingress timeout, streamID=", id_));
folly::to<std::string>(
"ingress timeout, streamID=",
id_,
", timeout=",
idleTimeout_.has_value()
? std::chrono::duration_cast<std::chrono::milliseconds>(
idleTimeout_.value())
.count()
: -1,
"ms"));
ex.setProxygenError(kErrorTimeout);
onError(ex);
}
Expand Down
14 changes: 12 additions & 2 deletions proxygen/lib/http/session/test/HTTPDownstreamSessionTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2847,7 +2847,12 @@ TEST_F(HTTP2DownstreamSessionTest, H2TimeoutWin) {
handler->expectEgressPaused();
handler->expectError([&](const HTTPException& ex) {
ASSERT_EQ(ex.getProxygenError(), kErrorWriteTimeout);
ASSERT_EQ(folly::to<std::string>("ingress timeout, streamID=", streamID),
ASSERT_EQ(folly::to<std::string>(
"ingress timeout, streamID=",
streamID,
", timeout=",
transactionTimeouts_->getDefaultTimeout().count(),
"ms"),
std::string(ex.what()));
handler->terminate();
});
Expand Down Expand Up @@ -4150,7 +4155,12 @@ TEST_F(HTTP2DownstreamSessionTest, TestTransactionStallByFlowControl) {

handler->expectError([&](const HTTPException& ex) {
ASSERT_EQ(ex.getProxygenError(), kErrorWriteTimeout);
ASSERT_EQ(folly::to<std::string>("ingress timeout, streamID=", streamID),
ASSERT_EQ(folly::to<std::string>(
"ingress timeout, streamID=",
streamID,
", timeout=",
transactionTimeouts_->getDefaultTimeout().count(),
"ms"),
std::string(ex.what()));
handler->terminate();
});
Expand Down

0 comments on commit a96bebe

Please sign in to comment.