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
httpserver: drop boost (#8023 dependency) #8421
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
When using std::thread in place of boost::thread, letting the threads destruct results in a std::terminate. According to the docs, the same thing should be be happening in later boost versions: http://www.boost.org/doc/libs/1_55_0/doc/html/thread/thread_management.html#thread.thread_management.thread.destructor I'm unsure why this hasn't blown up already, but explicitly detaching can't hurt.
along with mutex/condvar/bind/etc. httpserver handles its own interruption, so there's no reason not to use std threading. While we're at it, may as well kill the BOOST_FOREACH's as well.
Concept ACK |
@@ -189,7 +187,7 @@ static bool ClientAllowed(const CNetAddr& netaddr) | |||
{ | |||
if (!netaddr.IsValid()) | |||
return false; | |||
BOOST_FOREACH (const CSubNet& subnet, rpc_allow_subnets) | |||
for(const CSubNet& subnet : rpc_allow_subnets) |
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.
nit: s/for(/for (/
for consistency
concept && utACK 7e87033 |
#else | ||
if (!threadHTTP.timed_join(boost::posix_time::milliseconds(2000))) { | ||
#endif | ||
if (threadResult.valid() && threadResult.wait_for(std::chrono::milliseconds(2000)) == std::future_status::timeout) { |
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.
Nice solution!
utACK 7e87033 |
zkbot
added a commit
to zcash/zcash
that referenced
this pull request
Oct 23, 2017
Fix various thread assertion errors caused during shutdown. Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6719 - bitcoin/bitcoin#6990 - bitcoin/bitcoin#8421 - Second commit only in this PR - bitcoin/bitcoin#11006 I've cherry-picked the relevant commits, along with a note in each commit referring to the original Bitcoin commit ID (and the Zcash issue numbers where applicable). I've tested each issue with/without these patches applied. Closes #2214, #2334, and #2554.
sickpig
pushed a commit
to sickpig/BitcoinUnlimited
that referenced
this pull request
Mar 12, 2018
HTTP Server cherries from Core: bitcoin/bitcoin#6719 - Make HTTP server shutdown more graceful bitcoin/bitcoin#6859 - http: Restrict maximum size of http + headers bitcoin/bitcoin#6990 - http: speed up shutdown bitcoin/bitcoin#7966 - http: Do a pending c++11 simplification handling work items bitcoin/bitcoin#8421 - httpserver: drop boost (#8023 dependency) bitcoin/bitcoin#11006 - Improve shutdown process
marlengit
pushed a commit
to marlengit/BitcoinUnlimited
that referenced
this pull request
Sep 25, 2018
HTTP Server cherries from Core: bitcoin/bitcoin#6719 - Make HTTP server shutdown more graceful bitcoin/bitcoin#6859 - http: Restrict maximum size of http + headers bitcoin/bitcoin#6990 - http: speed up shutdown bitcoin/bitcoin#7966 - http: Do a pending c++11 simplification handling work items bitcoin/bitcoin#8421 - httpserver: drop boost (#8023 dependency) bitcoin/bitcoin#11006 - Improve shutdown process
andvgal
pushed a commit
to energicryptocurrency/gen2-energi
that referenced
this pull request
Jan 6, 2019
zkbot
added a commit
to zcash/zcash
that referenced
this pull request
Oct 1, 2020
Small httpserver.cpp backports Also includes a change to the `uiInterface.NotifyBlockTip` signal API. These remove merge conflicts from subsequent backports for `sync.h`. Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6859 - bitcoin/bitcoin#7112 - Only the non-QT changes. - bitcoin/bitcoin#7966 - bitcoin/bitcoin#8421 - We already backported the second commit in #2555
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a prerequisite for #8023. The httpserver depends on boost::thread::try_join_for, which has no equivalent in std::thread. Rather than going to the effort of porting try_join_for to our interruptible thread wrapper, it's simpler and more efficient to not rely on it in the first place.
755aa05 replaces the try_join_for with a future which is set when the callable function finishes. The flow is otherwise the same. I tested that this works as intended by inserting sleeps to force the event_base_loopbreak.
d3773ca Fixes an incompatibility between boost and std threads. This was likely to be an issue in the future with boost anyway.
Lastly, with the incompatibilities removed, just go ahead and switch to std::thread since there's need for interruption here.