interface_http.py fails in assert_equal(response2.status, http.client.BAD_REQUEST) AssertionError: not(413 == 400) #35082

issue maflcko opened this issue on April 15, 2026
  1. maflcko commented at 2:11 PM on April 15, 2026: member

    no idea how to reproduce this, but it seems to fail in https://github.com/maflcko/bitcoin-core-nightly/actions/runs/24438190980/job/71397012801#step:11:1626:

     test  2026-04-15T06:46:03.124196Z TestFramework (INFO): Check excessive size HTTP request encoded with chunked transfer 
     test  2026-04-15T06:46:03.198837Z TestFramework (ERROR): Unexpected exception: 
                                       Traceback (most recent call last):
                                         File "/__w/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/test_framework.py", line 143, in main
                                           self.run_test()
                                         File "/__w/bitcoin-core-nightly/bitcoin-core-nightly/bld/test/functional/interface_http.py", line 109, in run_test
                                           self.check_chunked_transfer()
                                         File "/__w/bitcoin-core-nightly/bitcoin-core-nightly/bld/test/functional/interface_http.py", line 312, in check_chunked_transfer
                                           assert_equal(response2.status, http.client.BAD_REQUEST)
                                         File "/__w/bitcoin-core-nightly/bitcoin-core-nightly/test/functional/test_framework/util.py", line 83, in assert_equal
                                           raise AssertionError("not(%s)" % " == ".join(str(arg) for arg in (thing1, thing2) + args))
                                       AssertionError: not(413 == 400)
    
    

    I tried this in a fresh ubuntu:noble container locally, but it passed:

    # history 
        1  export DEBIAN_FRONTEND=noninteractive && apt update && apt install curl wget htop git vim ccache -y && git clone https://github.com/bitcoin/bitcoin.git  --depth=1 ./b-c && cd b-c && apt install  build-essential cmake pkg-config  python3-zmq libzmq3-dev libevent-dev libboost-dev libsqlite3-dev  systemtap-sdt-dev  libcapnp-dev capnproto  libqrencode-dev qt6-tools-dev qt6-l10n-tools qt6-base-dev  clang llvm libc++-dev libc++abi-dev  mold -y 
        2  wget https://apt.llvm.org/llvm.sh 
        3  bash ./llvm.sh 23
     
        6  cmake -B bld-23     -DAPPEND_CXXFLAGS='-O3 -g2'       -DAPPEND_CFLAGS='-O3 -g2'       -DCMAKE_BUILD_TYPE=Debug -DAPPEND_CPPFLAGS='-D_LIBCPP_REMOVE_TRANSITIVE_INCLUDES' -DCMAKE_C_COMPILER="clang-23" -DCMAKE_CXX_COMPILER="clang++-23;-stdlib=libstdc++"     --preset=dev-mode     -DCMAKE_COMPILE_WARNING_AS_ERROR=ON && cmake --build ./bld-23 --parallel  $(nproc) --target=bitcoind && ./bld-23/test/functional/interface_http.py
     
    

    Originally posted by @maflcko in #34772

  2. maflcko added the label Tests on Apr 15, 2026
  3. maflcko added the label CI failed on Apr 15, 2026
  4. pinheadmz commented at 2:12 PM on April 15, 2026: member

    looking in to this today. 413 is content too large which makes sense, maybe a race in libevent between that and generic 400 bad request

  5. pinheadmz commented at 2:59 PM on April 15, 2026: member

    OMG Claude is fucking amazing:

    https://github.com/libevent/libevent/blob/48296514d8fd9c0b3812b11d45ad80b0c002c14e/http.c#L1025-L1027

    1. Line 1022: buflen > EV_SSIZE_MAX fires before the chunk size is even parsed — if client sends chunk header + large data together, this fires. If they arrive in separate TCP segments, the max_body_size check at line 1065 fires instead. This is the race condition causing "sometimes 413, more often 400".
  6. maflcko added this to the milestone 32.0 on Apr 15, 2026
  7. pinheadmz commented at 6:57 PM on April 15, 2026: member

    Ok I got too excited, the problem is not as cool as claude thinks. There is still a race condition already described by a comment in the test, I just never correctly observed one path of the race. 413 is the expected error code and I can reproduce it, will update this test with a follow-up PR.

  8. fanquake closed this on Apr 17, 2026

  9. pull[bot] referenced this in commit 654556e631 on Apr 17, 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-04-21 09:12 UTC

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