Page MenuHomePhabricator

http: Track active requests and wait for last to finish
ClosedPublic

Authored by PiRK on Fri, Dec 6, 14:49.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC57e33cdc3c88: http: Track active requests and wait for last to finish
Summary

Context from core#19420:

This PR calls evhttp_free before releasing event base. But according to evhttp_free docs:

Works only if no requests are currently being served.

So this PR also tracks active requests with libevent and waits for last request to finish. This requires libevent 2.1 due to evhttp_request_set_on_complete_cb (https://github.com/libevent/libevent/blob/master/whatsnew-2.1.txt).

Finally, the call to evhttp_free is done in the event base loop to avoid concurrency issues.

Now test/functional/feature_abortnode.py quits normally, not due to socket timeouts.

This is a backport of core#26742 and core#28551
Depends on D17303

Test Plan

ninja all check-all

Diff Detail

Repository
rABC Bitcoin ABC
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

PiRK requested review of this revision.Fri, Dec 6, 14:49

Tail of the build log:

[392/577] Building CXX object src/CMakeFiles/bitcoin-cli.dir/bitcoin-cli.cpp.o
[393/577] Linking CXX executable src/bitcoin-cli
[394/577] Building CXX object src/CMakeFiles/server.dir/txpool.cpp.o
[395/577] Building CXX object src/CMakeFiles/server.dir/txmempool.cpp.o
[396/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockindex.cpp.o
[397/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/logging.cpp.o
[398/577] Building CXX object src/CMakeFiles/bitcoin-tx.dir/bitcoin-tx.cpp.o
[399/577] Linking CXX executable src/bitcoin-tx
[400/577] Building CXX object src/CMakeFiles/bitcoind.dir/bitcoind.cpp.o
[401/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/coins.cpp.o
[402/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/str.cpp.o
[403/577] Building CXX object src/CMakeFiles/server.dir/torcontrol.cpp.o
[404/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/random.cpp.o
[405/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/transaction_utils.cpp.o
[406/577] Building CXX object src/CMakeFiles/bitcoin-wallet.dir/bitcoin-wallet.cpp.o
[407/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/context.cpp.o
[408/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coinselection.cpp.o
[409/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/blockfilter.cpp.o
[410/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/bdb.cpp.o
[411/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/coincontrol.cpp.o
[412/577] Building CXX object src/CMakeFiles/server.dir/validation.cpp.o
[413/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/net.cpp.o
[414/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/crypter.cpp.o
[415/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/mining.cpp.o
[416/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/db.cpp.o
[417/577] Building CXX object src/CMakeFiles/server.dir/wallet/init.cpp.o
[418/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/txmempool.cpp.o
[419/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/validation.cpp.o
[420/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/setup_common.cpp.o
[421/577] Building CXX object src/test/CMakeFiles/testutil.dir/util/wallet.cpp.o
[422/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/sqlite.cpp.o
[423/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/transaction.cpp.o
[424/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/load.cpp.o
[425/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/fees.cpp.o
[426/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/receive.cpp.o
[427/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/encrypt.cpp.o
[428/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/util.cpp.o
[429/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/salvage.cpp.o
[430/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/interfaces.cpp.o
[431/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/signmessage.cpp.o
[432/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/dns.cpp.o
[433/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/scriptpubkeyman.cpp.o
[434/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/spend.cpp.o
[435/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletutil.cpp.o
[436/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpc/backup.cpp.o
[437/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/rpcwallet.cpp.o
[438/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/db.cpp.o
[439/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_formatter.cpp.o
[440/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/options.cpp.o
[441/577] Building CXX object src/seeder/CMakeFiles/bitcoin-seeder.dir/main.cpp.o
[442/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana.cpp.o
[443/577] Building CXX object src/iguana/CMakeFiles/iguana.dir/iguana_interpreter.cpp.o
[444/577] Linking CXX executable src/iguana/iguana
[445/577] Building CXX object src/seeder/CMakeFiles/seeder-base.dir/bitcoin.cpp.o
[446/577] Building CXX object src/wallet/CMakeFiles/wallet-tool.dir/wallettool.cpp.o
[447/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/walletdb.cpp.o
[448/577] Building CXX object src/wallet/CMakeFiles/wallet.dir/wallet.cpp.o
[449/577] Linking CXX static library src/wallet/libwallet.a
ninja: build stopped: cannot make progress due to previous errors.
Build build-clang-tidy failed with exit code 1
PiRK planned changes to this revision.Fri, Dec 6, 14:57

missing braces

add missing braces for clang-tidy

Fabien added a subscriber: Fabien.
Fabien added inline comments.
src/httpserver.cpp
154 ↗(On Diff #51442)

layout

This revision is now accepted and ready to land.Fri, Dec 6, 20:57