-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HTTP: Warning and test fix #943
base: main
Are you sure you want to change the base?
Changes from 1 commit
dc3eaad
d507054
cfae058
5ceda4c
995da77
e8de934
98db2f4
f35f6f0
2b43faf
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -606,6 +606,8 @@ BOOST_FIXTURE_TEST_CASE(bytes_in_flight, http_plugin_test_fixture) { | |
req.set(http::field::host, "127.0.0.1:8891"); | ||
boost::beast::http::write(s, req); | ||
} | ||
//make sure got to the point http threads had responses queued | ||
std::this_thread::sleep_for(std::chrono::seconds(5)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why here sleeping 5 seconds but below sleeping 1 second? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because the 1s is not for 4mb messages. |
||
}; | ||
|
||
auto drain_http_replies = [&](unsigned max = std::numeric_limits<unsigned>::max()) { | ||
|
@@ -642,13 +644,14 @@ BOOST_FIXTURE_TEST_CASE(bytes_in_flight, http_plugin_test_fixture) { | |
|
||
//load up some more requests that exceed max | ||
send_4mb_requests(32u); | ||
//make sure got to the point http threads had responses queued | ||
std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
//now rip these connections out before the responses are completely sent | ||
connections.clear(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. If I understood your description right, this is the area that is problematic. Between this line and the line below the http plugin needs to have cleaned up all its ownstanding async_writes. Just closing the socket here does indeed send the FIN but the http threads need time to wake up and handle that error on the async_write to then clear out what's in flight. I wonder if what might work is to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That would likely work. I added a check for |
||
//send some requests that should work still | ||
send_4mb_requests(8u); | ||
r = drain_http_replies(); | ||
for (const auto& e : r) { | ||
ilog( "response: ${r}, count: ${c}", ("r", std::string(obsolete_reason(e.first)))("c", e.second)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I almost thought the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Changed |
||
} | ||
BOOST_REQUIRE_EQUAL(r[boost::beast::http::status::ok], 8u); | ||
} | ||
|
||
|
@@ -677,6 +680,8 @@ BOOST_FIXTURE_TEST_CASE(requests_in_flight, http_plugin_test_fixture) { | |
req.set(http::field::host, "127.0.0.1:8892"); | ||
boost::beast::http::write(s, req); | ||
} | ||
//make sure got to the point http threads had responses queued | ||
std::this_thread::sleep_for(std::chrono::seconds(1)); | ||
}; | ||
|
||
auto scan_http_replies = [&]() { | ||
|
@@ -712,6 +717,9 @@ BOOST_FIXTURE_TEST_CASE(requests_in_flight, http_plugin_test_fixture) { | |
//requests should still work | ||
send_requests(8u); | ||
r = scan_http_replies(); | ||
for (const auto& e : r) { | ||
ilog( "response: ${r}, count: ${c}", ("r", std::string(obsolete_reason(e.first)))("c", e.second)); | ||
} | ||
BOOST_REQUIRE_EQUAL(r[boost::beast::http::status::ok], 8u); | ||
connections.clear(); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why does it matter if the response is queued or not at this point?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This avoids
boost::beast::http::status::service_unavailable
on my machineThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe after the
boost::beast::http::write(s, req)
try doing as.wait(wait_read)
, that will guarantee that the response is in flight. just a guess though