[POC] Full Libevent removal #34411

pull fanquake wants to merge 35 commits into bitcoin:master from fanquake:full_libevent_removal changing 53 files +2495 −1040
  1. fanquake commented at 12:35 PM on January 26, 2026: member

    This builds on all the work being done by pinheadmz in #35182 to demo a libevent-less bitcoind.

  2. DrahtBot commented at 12:35 PM on January 26, 2026: contributor

    <!--e57a25ab6845829454e8d69fc972939a-->

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    <!--006a51241073e994b41acfe9ec718e94-->

    Code Coverage & Benchmarks

    For details see: https://corecheck.dev/bitcoin/bitcoin/pulls/34411.

    <!--021abf342d371248e50ceaed478a90ca-->

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

    <!--174a7506f384e20aa4161008e828411d-->

    Conflicts

    Reviewers, this pull request conflicts with the following ones:

    • #35387 (logging: make trace logging easily usable by ryanofsky)
    • #35355 (Use atomics for determining whether trace logging is enabled by ajtowns)
    • #35322 (logging: streamline Logger state and drop redundant methods by ryanofsky)
    • #34038 (logging: replace -loglevel with -trace, expose trace logging via RPC by ajtowns)
    • #31425 (RFC: Riscv bare metal CI job by sedited)
    • #26022 (Add util::ResultPtr class by ryanofsky)
    • #25665 (refactor: Add util::Result failure types and ability to merge result values by ryanofsky)

    If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.

    <!--5faf32d7da4f0f540f40219e4f7537a3-->

    LLM Linter (✨ experimental)

    Possible places where named args for integral literals may be used (e.g. func(x, /*named_arg=*/0) in C++, and func(x, named_arg=0) in Python):

    • [Lookup("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaam2dqd.onion", 0, false)] in src/test/httpserver_tests.cpp

    Possible places where comparison-specific test macros should replace generic comparisons:

    • [test/functional/interface_http.py] assert response.status == err -> assert_equal(response.status, err)

    <sup>2026-06-02 10:20:28</sup>

  3. fanquake force-pushed on Jan 26, 2026
  4. DrahtBot added the label CI failed on Jan 26, 2026
  5. pinheadmz commented at 4:05 PM on January 26, 2026: member

    nit: Pull request description should be replaced by the lyrics of Taylor Swift's "We Are Never Ever Getting Back Together" before merging.

  6. fanquake force-pushed on Jan 28, 2026
  7. fanquake force-pushed on Feb 2, 2026
  8. fanquake force-pushed on Feb 3, 2026
  9. fanquake force-pushed on Feb 9, 2026
  10. fanquake force-pushed on Feb 10, 2026
  11. DrahtBot added the label Needs rebase on Feb 11, 2026
  12. fanquake force-pushed on Feb 18, 2026
  13. DrahtBot removed the label Needs rebase on Feb 18, 2026
  14. DrahtBot added the label Needs rebase on Feb 19, 2026
  15. fanquake force-pushed on Feb 25, 2026
  16. DrahtBot removed the label Needs rebase on Feb 25, 2026
  17. DrahtBot added the label Needs rebase on Feb 26, 2026
  18. fanquake force-pushed on Apr 30, 2026
  19. fanquake force-pushed on Apr 30, 2026
  20. fanquake commented at 10:17 AM on April 30, 2026: member

    Rebased on master, and the latest versions of #32061 and #34342.

  21. DrahtBot removed the label Needs rebase on Apr 30, 2026
  22. fanquake force-pushed on Apr 30, 2026
  23. DrahtBot added the label Needs rebase on May 5, 2026
  24. fanquake force-pushed on May 8, 2026
  25. DrahtBot removed the label Needs rebase on May 8, 2026
  26. fanquake force-pushed on May 11, 2026
  27. fanquake force-pushed on May 13, 2026
  28. fanquake force-pushed on May 14, 2026
  29. fanquake force-pushed on May 15, 2026
  30. fanquake commented at 8:57 AM on May 15, 2026: member

    @dergoegge want to run this in antithesis?

  31. fanquake force-pushed on May 18, 2026
  32. fanquake force-pushed on May 18, 2026
  33. DrahtBot added the label Needs rebase on May 22, 2026
  34. fanquake force-pushed on May 22, 2026
  35. DrahtBot removed the label Needs rebase on May 22, 2026
  36. fanquake force-pushed on May 22, 2026
  37. fanquake force-pushed on May 26, 2026
  38. fanquake force-pushed on May 26, 2026
  39. DrahtBot added the label Needs rebase on May 26, 2026
  40. fanquake force-pushed on May 26, 2026
  41. DrahtBot removed the label Needs rebase on May 26, 2026
  42. DrahtBot added the label Needs rebase on May 27, 2026
  43. fanquake force-pushed on May 27, 2026
  44. DrahtBot removed the label Needs rebase on May 27, 2026
  45. DrahtBot added the label Needs rebase on May 29, 2026
  46. fanquake force-pushed on May 30, 2026
  47. DrahtBot removed the label Needs rebase on May 30, 2026
  48. test: cover common HTTP attacks and common malformed requests d683e53702
  49. util/string: use string_view in LineReader
    Co-authored-by: Hodlinator <172445034+hodlinator@users.noreply.github.com>
    17651bbb65
  50. util/string: LineReader should only trim \r or \r\n
    The utility can not be opinionated about CR or SP on either end of a
    line it reads. That decision is up to the caller and in fact in the
    case of HTTP should be allowed in some places and rejected in others.
    
    Replace TrimStringView() with more surgical operation.
    113f3c8c29
  51. http: enclose libevent-dependent code in a namespace
    This commit is a no-op to isolate HTTP methods and objects that
    depend on libevent. Following commits will add replacement objects
    and methods in a new namespace for testing and review before
    switching over the server.
    4eabfe3f6a
  52. http: Implement HTTPHeaders class
    see:
    https://www.rfc-editor.org/rfc/rfc2616#section-4.2
    https://www.rfc-editor.org/rfc/rfc7231#section-5
    https://www.rfc-editor.org/rfc/rfc7231#section-7
    https://httpwg.org/specs/rfc9111.html#header.field.definitions
    f067715b57
  53. http: Implement HTTPResponse class
    HTTP Response message:
    https://datatracker.ietf.org/doc/html/rfc1945#section-6
    
    Status line (first line of response):
    https://datatracker.ietf.org/doc/html/rfc1945#section-6.1
    
    Status code definitions:
    https://datatracker.ietf.org/doc/html/rfc1945#section-9
    ea8c0bc7f6
  54. http: Implement HTTPRequest class
    HTTP Request message:
    https://datatracker.ietf.org/doc/html/rfc1945#section-5
    
    Request Line aka Control Line aka first line:
    https://datatracker.ietf.org/doc/html/rfc1945#section-5.1
    
    See message_read_status() in libevent http.c for how
    `MORE_DATA_EXPECTED` is handled there
    54f4971056
  55. http: Introduce HTTPServer class and implement binding to listening socket
    Introduce a new low-level socket managing class `HTTPServer`.
    
    BindAndStartListening() was copied from CConnMan's BindListenPort()
    in net.cpp and modernized.
    
    Unit-test it with a new class `SocketTestingSetup` which mocks
    `CreateSock()` and will enable mock client I/O in future commits.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    9fc606fb77
  56. HTTPServer: implement and test AcceptConnection()
    AcceptConnection() is mostly copied from CConmann in net.cpp
    and then modernized.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    83243043cb
  57. HTTPServer: generate sequential Ids for each newly accepted connection
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    50ddfa71c6
  58. http: Introduce HTTPRemoteClient class 5926076930
  59. HTTPServer: start an I/O loop in a new thread and accept connections
    Socket handling methods are copied from CConnMan:
    
    `CConnman::GenerateWaitSockets()`
    `CConnman::SocketHandlerListening()`
    `CConnman::ThreadSocketHandler()` and `CConnman::SocketHandler()` are combined into ThreadSocketHandler()`.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    9f96e93cb1
  60. HTTPServer: read requests from connected clients
    `SocketHandlerConnected()` adapted from CConnman
    
    Testing this requires adding a new feature to the SocketTestingSetup,
    inserting a "request" payload into the mock client that connects
    to us.
    
    This commit also moves IOErrorIsPermanent() from sock.cpp to sock.h
    so it can be called from the socket handler in httpserver.cpp
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    98d2c0e140
  61. HTTPserver: support "chunked" Transfer-Encoding 77e8b422f0
  62. HTTPServer: compose and send replies to connected clients
    Sockets-touching bits copied and adapted from `CConnman::SocketSendData()`
    
    Testing this requires adding a new feature to the SocketTestingSetup,
    returning the DynSock I/O pipes from the mock socket so the received
    data can be checked.
    
    Co-authored-by: Vasil Dimov <vd@FreeBSD.org>
    f6c7d2603a
  63. HTTPServer: disconnect clients 6113114b06
  64. Allow http workers to send data optimistically as an optimization ed20758ef5
  65. HTTPServer: use a queue to pipeline requests from each connected client
    See https://www.rfc-editor.org/rfc/rfc7230#section-6.3.2
    
    > A server MAY process a sequence of pipelined requests in
      parallel if they all have safe methods (Section 4.2.1 of [RFC7231]),
      but it MUST send the corresponding responses in the same order that
      the requests were received.
    
    We choose NOT to process requests in parallel. They are executed in
    the order recevied as well as responded to in the order received.
    This prevents race conditions where old state may get sent in response
    to requests that are very quick to process but were requested later on
    in the queue.
    d251e2e0c5
  66. define HTTP request methods at module level outside of class
    This is a refactor to prepare for matching the API of HTTPRequest
    definitions in both namespaces http_bitcoin and http_libevent. In
    particular, to provide a consistent return type for GetRequestMethod()
    in both classes.
    7dfd0975a3
  67. Add helper methods to HTTPRequest to match original API
    These methods are called by http_request_cb() and are present in the
    original http_libevent::HTTPRequest.
    eef6b97eb3
  68. refactor: split http_request_cb into libevent callback and dispatch
    The original function is passed to libevent as a callback when HTTP
    requests are received and processed. It wrapped the libevent request
    object in a http_libevent::HTTPRequest and then handed that off to
    bitcoin for basic checks and finally dispatch to worker threads.
    
    In this commit we split the function after the
    http_libevent::HTTPRequest is created, and pass that object to a new
    function that maintains the logic of checking and dispatching.
    
    This will be the merge point for http_libevent and http_bitcoin,
    where HTTPRequest objects from either namespace have the same
    downstream lifecycle.
    85394dbf19
  69. refactor: split HTTPBindAddresses into config parse and libevent setup
    The original function was already naturally split into two chunks:
    First, we parse and validate the users' RPC configuration for IPs and
    ports. Next we bind libevent's http server to the appropriate
    endpoints.
    
    This commit splits these chunks into two separate functions, leaving
    the argument parsing in the common space of the module and moving the
    libevent-specific binding into the http_libevent namespace.
    
    A future commit will implement http_bitcoin::HTTPBindAddresses to
    bind the validate list of endpoints by the new HTTP server.
    69f895d39f
  70. HTTPServer: implement control methods to match legacy API 57aa714122
  71. HTTPServer: disconnect after idle timeout (-rpcservertimeout) fbae11cb50
  72. http: switch servers from libevent to bitcoin f85a81f056
  73. fuzz: switch http_libevent::HTTPRequest to http_bitcoin::HTTPRequest a6361bc711
  74. http: remove libevent usage from this subsystem f783b52890
  75. logging: deprecate libevent category
    Creates logic to deprecate logging categories but still
    "support" them so the software doesn't quit with unknown category
    on startup. Deprecated categories are always false and attempts
    to switch them are logged as wwarnings.
    08fce0526e
  76. doc: add release note for #35182 replace libevent HTTP server 4a8befcb86
  77. test: remove raii_event_tests d71bdc93f6
  78. cmake: remove libevent 9ef7dca0f4
  79. depends: remove libevent 87317c5d4e
  80. ci: remove libevent af5e172868
  81. vcpkg: remove libevent d6decd1276
  82. doc: remove libevent 64e5e7d5a4
  83. fanquake force-pushed on Jun 2, 2026

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-06-05 10:51 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me