Skip to content

Releases

Bessemer v1.0.0rc13

Bessemer v1.0.0rc13 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 01 Dec 17:17
68ef1b3

Fixed

  • CPU-backed routes recover from a broken process pool without deadlocking.
    Concurrent shutdown callers wait for synchronous work to finish. Mutable
    request defaults are isolated across requests, and native model encoding
    honours changes to a model's default.
  • HTTP/2 after-response work starts once the transport flushes the response
    and is cancelled on a reset. Streaming responses keep produced chunks
    within the worker's response budget or bounded temporary-file storage.
  • On Linux, a fatal io_uring pump error wakes listeners so the worker
    can report it. Orderly teardown drains pending receives before releasing
    buffer memory. Socket writes also accept contiguous signed-byte buffers.
  • Static files, file responses and ASGI middleware preserve HEAD lengths
    and use validators from the file actually opened. Mounted apps receive
    the HTTP version and external path prefix and can finish post-body work.
  • Router lifespan hooks compose with their parent. Injected headers preserve
    the response class's default status. Explicit CLI options take precedence
    over invalid environment values.
  • WebSocket JSON reads respect the requested frame mode, and compression
    respects the client's window size. The AG-UI adapter reports streams
    that end without a terminal event.
  • OpenTelemetry metrics count spans rejected by the collector. Dropping the
    last application owner stops the background JWKS refresh.
  • Remote benchmarks clean up only resources they created and build each
    checkout's wheel in a fresh directory. Frozen container build contexts
    include both licences. Publication verifies that the release tag points
    to the tested commit.

Bessemer v1.0.0rc12

Bessemer v1.0.0rc12 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Nov 18:30
5a24978

Fixed

  • Supervised Linux workers sharing a listener balance incoming HTTP
    connections during bursts. Each generation keeps separate connection
    counts through rolling reloads.

Performance

  • Retain the JSON encoder scratch buffer for responses up to 64 KiB,
    avoiding a replacement allocation on large typed echoes.
  • Skip the per-reply request counter when request-count recycling is
    disabled.

See the Linux benchmark report
for results on standard and free-threaded Python 3.14.

Bessemer v1.0.0rc11

Bessemer v1.0.0rc11 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 30 Nov 09:38
af1bdd8

Fixed

  • The opt-in Linux io_uring backend rechecks outstanding completions
    after 10 ms without a wake while connections are open. Uploads, streams
    and WebSockets can continue on kernels that miss deferred notifications.
  • The PyPI project description uses absolute links for the banner,
    benchmark results and documentation.

Performance

  • On free-threaded Python, building a model from a typed JSON body no longer
    locks its new __dict__ once for each field, or the new instance once for
    each Pydantic slot: the dict is made in one call and the slots are written
    directly while nothing else can reach the instance.
  • Type identity checks on the request path no longer take a reference to the
    type, which a free-threaded build counts in a field every thread shares.

Bessemer v1.0.0rc10

Bessemer v1.0.0rc10 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 21 Nov 18:39
687e707

Fixed

  • Adaptive admission gives a CPU-busy event loop a bounded chance to recover
    before returning a 503 when connections run on separate I/O threads.
    Requests waiting for recovery use the existing in-flight capacity and
    retain their original deadline.

Performance

  • Typed JSON decoding reuses the parser's ASCII check when constructing
    Python strings and avoids repeating list and nullable value lookahead.
  • Reduced JSON encoding work for ordered response models, including
    short string fields on free-threaded Python.

Bessemer v1.0.0rc9

Bessemer v1.0.0rc9 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 21 Nov 00:52
a7c199b

Fixed

  • Static files and FileResponse now choose HEAD headers and conditional
    validators using the result of compression for files that can be buffered.
    When compression would enlarge the file, HEAD keeps the identity metadata
    and a matching identity ETag returns 304.
  • HTTP/2 file responses reserve space before reading each streamed chunk.
    The reservation follows the bytes through transport, and a stream waits
    for a chunk to be released when its allowance is full.

Bessemer v1.0.0rc8

Bessemer v1.0.0rc8 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 20 Nov 10:39
4a0f104

Changed

  • On Linux and macOS with the default event_loop="auto", a worker whose
    application has synchronous work serves its connections on two I/O threads
    beside Bessemer's loop, as a worker with loops above 1 or asyncio's loop
    does, instead of on the loop's own thread. Synchronous work is a def
    route handler, a request-scoped def, generator or class dependency at any
    depth (mounted apps and WebSocket routes included) or a def exception
    handler. The loop's thread takes the GIL for every callback, so while a
    handler thread held the GIL nothing was accepted, read or written: one
    def handler inside a 0.9 s C call delayed native /healthz by up to
    700 ms, long enough for a liveness probe to restart a healthy worker. It
    now waits under 3 ms. These applications pay for it in CPU per request.
    With the worker on one core, an async route of such an application used
    about 20% more at one connection and 30% more at 64 (89,000 to 70,000
    requests a second), and a sync route 20 to 40% more at one connection and
    no more at 64. event_loop="bessemer" named explicitly keeps the
    single-thread layout and its figures. All-async applications,
    loops above 1, asyncio's loop, io_backend="io_uring" and free-threaded
    builds with the GIL disabled are unchanged. Each worker writes the layout
    it chose to standard error when it starts, for example
    Bessemer worker pid=4242 event_loop=bessemer loops=1 connections=io-threads (sync handler GET /report).
    An all-async application that holds the GIL in threads the worker cannot
    see at start (asyncio.to_thread, an executor, a C extension) still
    delays native routes on the single-thread layout; event_loop="asyncio"
    avoids it.
  • A worker refuses to start when a BESSEMER_* environment variable is a
    near miss of a real setting (BESSEMER_MAX_CONECTIONS), or is any unknown
    BESSEMER_TLS_* name, and names the setting it resembles. Such a variable
    was ignored with at most a warning, so a limit or TLS option an operator
    believed was set was not. Other BESSEMER_* names still belong to the
    application.
  • APIKeyQuery answers 400 when its parameter is repeated, as the header
    schemes do, with or without auto_error. Cookies keep the first value.
  • Static mounts and FileResponse share one descriptor for each file being
    sent, read by position, and a worker holds at most max_connections
    distinct files open for bodies; a body for a further file gets the existing
    503 "Static file capacity is full". The per-mount slots are gone: eleven
    slow downloads could take all of a mount's slots and leave every other
    client of that mount with 503, 304s included, and three HTTP/2
    connections that never opened their windows held 300 descriptors. 304,
    404, 416 and HEAD take nothing. Resolving, opening and the first
    read of a static file are one trip to the blocking pool, which cut the
    server's CPU per small static response to between a third and a quarter.
    A file replaced while it is being sent finishes as the file its headers
    describe.
  • A FileResponse whose path has become something other than a regular
    file is answered 500 at once: the open no longer waits for a FIFO's
    writer, which froze the worker. The file is still opened when the handler
    returns the response, so one removed by a yield dependency's cleanup is
    sent as before, and it is now read off the event loop.
  • Response bodies and stream frames of 16 KiB or more are compressed on the
    blocking pool (it was more than 64 KiB, which a file's 64 KiB chunks never
    were), a stream that has compressed 64 KiB inline sends its later frames
    there too, and at most one compression per CPU runs at a time; the rest
    wait without holding a pool thread. Eight compressed downloads of a 48 MB
    file held native /healthz at a median of 50 to 150 ms; it is now about
    1 ms.
    Small bodies such as typical JSON are compressed inline as before.
  • A 304 or 206 for a resource that compression applies to carries
    Vary: Accept-Encoding, and a 304 answering the weak ETag given with
    a compressed 200 carries that tag, as RFC 9110 requires, so a cache can
    match the revalidation to the representation it holds.
  • A multipart upload to a route that spools to disk is refused with 413
    before any of it is read when its Content-Length already exceeds
    max_upload_size, and a client that sent Expect: 100-continue is not
    invited to send it. It was read and written to disk up to the limit first.
  • An HTTP/1.1 request answered before its body was read (a 413 for its
    declared length, a 401) has the rest of that body read and discarded
    before the connection closes: until the client closes, sends nothing for
    half a second, or five seconds have passed. Closing on unread input resets
    the connection, and a client still sending then lost the answer; on
    Windows a response it had already received was discarded. Nothing read is
    kept and the request's admission slot has been returned by then.
  • An incoming W3C trace context (traceparent, tracestate) is honoured
    only from a peer inside trusted_proxies, or from any peer with the new
    OpenTelemetry(trust_inbound_context=True). Any client could choose the
    trace id and force its spans to be exported whatever sample_ratio was:
    with a ratio of 0, twenty unauthenticated requests were all exported with
    the client's trace id, 401s included, and a flood displaced real spans
    from the queue. Other clients now start a new trace sampled by
    sample_ratio. A service called directly by other services, with no
    proxy in trusted_proxies, must set trust_inbound_context=True to go
    on joining its callers' traces.
  • A full local rate-limit table no longer refuses clients. A client that
    cannot be given its own record shares one with its network (IPv4 /24 then
    /16, IPv6 /48 then /32, then a single record for everyone left), so the
    limit still applies, more strictly, and nobody is answered 503 "Rate
    limiter is at capacity" because the table is full: one routed IPv6 /48, or
    one request a window from each of 10,000 addresses, was enough to refuse
    every other client on every limited path. Records in use are never
    evicted, a client that moves from a shared record to its own keeps the
    history it had, and memory stays bounded. Retry-After from a shared
    record can be up to nine eighths of a window.
  • The router adds Allow only to its own 405. A control's 401, 403
    or 429 for a path whose method did not match carried the path's
    methods, which told an unauthenticated client which paths and methods
    exist.
  • The limit of 1,024 route templates counts each path once, whatever its
    methods, and applies only when metrics, the access log or tracing uses
    them. An application with 520 paths that each took GET and POST and
    no telemetry failed to start.
  • access_log=True costs about a tenth of what it did. Each record is
    encoded straight into a buffer and the writer takes whatever is queued
    in batches of whole records of at most 4,096 bytes, woken only when it is
    idle. On a trivial route the server's CPU per request with the log on
    fell from 26 to 30 µs to 10 to 12 µs, against about 9 µs without it, and
    futex and write calls for 40,000 requests from about 65,000 and
    40,000 to 83 and 3,100. The output is byte for byte what it was; a record
    can be written up to about a millisecond later.
  • A worker runs at most max_connections WebSocket sessions, however they
    arrive; a handshake beyond that is answered 503 "Too many WebSocket
    sessions". Each HTTP/2 connection could carry 100 sessions, so the bound
    was 100 times max_connections: with --max-connections 4, three
    connections ran 300 handlers. HTTP/1.1 sessions, one a connection, cannot
    reach the bound on their own, and one HTTP/2 connection still carries at
    most 100.
  • An HTTP/2 extended CONNECT to anything but a WebSocket route is refused
    with 400 "Not a WebSocket route" before any handler runs. It ran the
    route's GET handler, discarded the body and answered 200 without
    ending the stream, which a client reads as an accepted handshake, and the
    WebSocket origin allowlist was never consulted. Authentication and rate
    limiting still answer first.
  • With tls_client_ca set, TLS sessions are never resumed: no session
    cache and no tickets, so every connection makes a full handshake and has
    its client certificate checked against the current time and CRLs. A
    resumed session restored the certificate chain without verifying it
    again, so an expired client certificate went on working for as long as
    its sessions kept being resumed. Servers without client authentication
    resume sessions as before.
  • JWTAuth.entra with several tenants uses a signing key only for the issuer
    that key publishes. Microsoft's shared common key set holds keys for
    every tenant beside keys for one issuer only, each naming its issuer, and
    Microsoft requires an API reading that set to check it: a key's issuer,
    with the token's tid in place of {tenantid}, must equal the token's
    iss. Any key in the set was accepted for any listed tenant. A token whose
    tid disagrees with its iss, or that a one-issuer key signed for another
    issuer, is now answered 401. Keys without the member (v1.0 key sets,
    static keys, other providers) and single-tenant configurations behave as
    before.
  • require_scope(...) runs on the event loop instead of the handler pool
    and does not count as synchronous work, so an all-async application that
    uses it keeps the single-thread connection layout. A scope-checked route
    cost 124 to 215 µs a request in a probe on a busy host and now costs 37 to
    41 µs, the same as the check written async def. Calling the returned
    dependency directly still returns the principal.
  • The verified-token cache hashes a bearer tok...
Read more

Bessemer v1.0.0rc7

Bessemer v1.0.0rc7 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 16 Nov 09:47
a106a56

Seventh release candidate for 1.0. It is 1.0.0rc6 with its adaptive admission
corrected and two older faults fixed: a sync handler that could run after its
request had been answered, and a refused request head whose answer Windows
could lose. CPU-bound sync handlers are no longer refused on a busy or a
paused host. A loop blocked in its handlers is refused whether or not other
threads of the process are at work, and stays marked for as long as it is
inside what made it late. A fixed max_in_flight no longer costs four system
calls a request. Two things change for an application that sets
nothing. A loop blocked by handlers that each run for longer than 20 ms now
refuses new requests throughout, where it refused them in gaps or, on the
Rust event loop, not at all. And a blocked loop beside threads that use
between a quarter and a half as much CPU as it spends blocked is no longer
refused, where 1.0.0rc6 refused it. The 1.x API freeze holds and nothing is
added to it. The evidence is in
production readiness.

Fixed

  • Adaptive admission no longer requires CPU-bound handler threads to receive
    half a host core before their work can explain a delayed loop. It compares
    their recorded CPU work with the loop's own work, avoiding false overload
    refusals when a busy host stretches GIL waits. Invalid clock samples still
    count as delay, and genuine loop overload, fixed limits and request deadlines
    remain bounded.
  • A loop blocked in its handlers is refused while other threads of the
    process work. With the work of other threads judged by its amount alone,
    which is the entry above before it was released, any late request was
    excused once they had used 5 ms of CPU and twice the loop's: a thread of
    the application using a twentieth of a core was enough for a loop asleep in
    every handler never to be refused. The loop now also keeps the wall-clock
    time it spends running request handlers, and other threads excuse a wait
    only if they used at least a quarter as much CPU time as that, over the
    request's own wait and over the whole run of late requests it would end.
    CPU work added up across short samples must also have gone on through the
    request's own wait, not only before it. CPU-bound sync handlers are still not
    refused, on a busy or a paused host. What this does not see is listed under
    adaptive request admission.
  • A loop marked congested stays marked while it is inside the batch in which
    it last started a request late, and for four target intervals after that
    batch ends. The four intervals were counted from the late request itself,
    so under handlers that each block the loop for longer than they last
    (20 ms at the default timeout) the mark lapsed before the next request was
    started. Such a loop was refused only in the gaps, and on the Rust event
    loop a burst to it was not refused at all. Every release since 1.0.0rc2
    has this.
  • A request started on time no longer ends a run of late requests when a
    late one was counted earlier in the same batch. A batch takes requests in
    the order they came, so its last ones may be on time only because they came
    just before it. With handlers that block after their first await, every
    batch could end that way, and a loop blocked nearly all the time was never
    refused.
  • A sync handler waiting for a pool thread no longer starts after its request
    has been answered, by its deadline or because its client went. The event
    loop tells it of the cancellation when it next takes its batch, and a pool
    thread freed before then started the call anyway, so its work was done for
    nobody. The pool thread now asks whether anyone is still waiting before it
    starts the call. 1.0.0rc5 and 1.0.0rc6 both have this, on a busy host.
  • A request head refused before it had ended, for more headers than allowed,
    is answered while the rest of it arrives. The connection closed straight
    after its error response, so what the client sent next reset it; on
    Windows the client could lose the 431 and see a reset instead. After an
    error response a connection now keeps reading what its client sends, for at
    most 500 ms and 64 KiB, until the client closes.
  • A worker with an explicit max_in_flight no longer reads two CPU clocks
    for every request. A fixed cap has no delay target, so since 1.0.0rc6 each
    of its requests was late the moment it was queued, and took the readings a
    late request takes before being ignored: four clock_gettime system calls
    a request in 1.0.0rc6. Which requests were admitted was not affected.
  • Requests queued before CPU tracking starts can use subsequent CPU readings
    to explain continued contention. Batch mark numbers are no longer reused
    after a healthy period.
  • Queue delay is sampled when each request starts, without counting its own
    batch's handler execution again after the batch finishes.

Bessemer v1.0.0rc6

Bessemer v1.0.0rc6 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 13 Nov 22:47
48f8e57

Sixth release candidate for 1.0. CPU-bound sync handlers no longer make a
worker refuse requests as overloaded. On free-threaded Python run_cpu runs
its work in processes, as it does with the GIL, and model responses cost
less. The allowance 1.0.0rc5 makes for large request bodies now ends when a
collection runs. Two things change for an application that sets nothing: on
free-threaded Python run_cpu no longer uses threads, and under the default
admission CPU-bound work in sync handlers is no longer refused early. The
1.x API freeze holds and nothing is added to it. The evidence is in
production readiness.

Changed

  • run_cpu runs its work in processes on free-threaded Python too. An
    application that passes no executor got threads there up to 1.0.0rc5. In
    threads without the GIL a function is fast only while it leaves alone every
    object the threads share, and that is not something its code shows: a loop
    reading a module-level list ran at a quarter of the rate it reached in
    processes, and so did a loop using only local values and one integer
    constant when its module had been compiled from source instead of loaded
    from a bytecode cache. In processes both ran as they do with the GIL. An
    application that relied on threads there, for a function or argument that
    cannot be pickled, a context variable read in the job, or objects shared
    with the worker, passes App(executor=ThreadPoolExecutor()). Interpreters
    with the GIL already used processes. See
    threads or processes.
  • Model responses cost less on free-threaded Python. The encoder took a
    reference to each field of a model through a separate dict lookup, and
    copied every dict returned in place of a model. It now reads either in one
    pass under the dict's lock when the fields are in their declared order,
    as they are in a model Pydantic built or a dict written in that order. A
    response of 256 four-field models took 14% fewer instructions on CPython
    3.14.6t, and the same response returned as dicts 28% fewer. Interpreters
    with the GIL are unchanged.
  • With gc_allowance="body", a server logs a warning at start-up when no
    allowance can be made because functions of the gc module were replaced
    before it started. A free-threaded build, where the setting is documented
    to have no effect, logs nothing.

Fixed

  • CPU-bound sync handlers no longer make a worker refuse requests as
    overloaded. Under the default max_in_flight="auto", a request its event
    loop started late counted towards congestion whatever had delayed it. On an
    interpreter with the GIL, every thread running Python holds it for a switch
    interval, so a few CPU-bound sync handlers, ThreadPoolExecutor jobs or
    threads of the application kept an idle loop waiting, and every route of
    the worker answered 503 with "Server event loop is overloaded". Eight
    connections to one CPU-bound sync route were enough. On Linux and macOS a
    late request now counts only when the loop thread was itself busy, or the
    rest of the process was not; a loop behind on its own work, or blocked in a
    call, sheds as before. Work in sync handlers is bounded by sync_workers,
    the 4,096-request ceiling and request_timeout. Windows is unchanged. See
    adaptive request admission.
  • A large body's allowance ends when a collection runs, not only when its
    request does. 1.0.0rc5 kept gc.get_threshold()[0] raised until the request
    ended, although a collection had already promoted the body's objects and
    reset the count they were in, so unrelated cyclic garbage was collected
    later than the application's threshold asked for as long as such a request
    stayed open. Bessemer now sees collections through an entry it adds to
    gc.callbacks, after those already there; leave it in place.
  • No allowance is made on a free-threaded build of Python whose GIL has been
    switched on (PYTHON_GIL=1, or an extension that re-enables it). 1.0.0rc5
    made one there. That build keeps its own collector, which does not start a
    collection on the young count alone, so the raised threshold did not do
    what it was for. With the GIL off nothing changes: no allowance was made.

Bessemer v1.0.0rc5

Bessemer v1.0.0rc5 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 11 Nov 23:44
69add39

Fifth release candidate for 1.0. Large typed request bodies cost less: the
objects a body is parsed into no longer start a garbage collection by
themselves, and the parser builds each model in fewer steps. On the
1,000-item typed echo used for comparisons, a request took about a quarter
fewer instructions than under 1.0.0rc4 (CPython 3.13, one worker; see
production readiness). Nothing else in the
server has changed since 1.0.0rc4. The 1.x API freeze holds; gc_allowance
is an addition. The change to default behaviour is listed first.

Changed

  • A large request body no longer starts a garbage collection by itself.
    Parsing a body into models allocates thousands of container objects at
    once, enough to pass Python's young collection threshold, and the
    collection that followed walked all of them and could free none. While a
    request holds objects its body was parsed into, gc.get_threshold()[0] is
    now higher by their number, and it comes back down when the request ends.
    Everything else the application allocates meets the same budget as before.
    This applies to bodies of 4 KiB or more that Bessemer parses for a route's
    Pydantic model, on interpreters running with the GIL; free-threaded
    Python is unchanged. A threshold the application sets is kept as the base,
    and a collector switched off is left alone. See
    large request bodies and the garbage collector;
    gc_allowance="none" restores the old behaviour.
  • Request bodies parse with less work per model. The three Pydantic
    attributes of each instance are written through slot members found once
    per model, lists are created at their final length, one-character strings
    are the interpreter's own, and a decimal of up to fifteen digits is
    converted in the pass that reads it.

Added

  • gc_allowance (--gc-allowance, BESSEMER_GC_ALLOWANCE,
    [tool.bessemer] gc_allowance, App.run(gc_allowance=)): body, the
    default, or none. Process-wide.

Bessemer v1.0.0rc4

Bessemer v1.0.0rc4 Pre-release
Pre-release

Choose a tag to compare

@github-actions github-actions released this 10 Nov 19:11
add3380

Fourth release candidate for 1.0. Fixes from a whole-project review of
1.0.0rc3 and from two reviews of those fixes, limits on what a slow client
can hold, and a request path that does less work per request. The 1.x API
freeze holds; App(strict_content_type=) and min_send_rate are additions.
The changes to default behaviour are listed first.

Changed

  • A JSON body must say that it is JSON. A request body sent with no
    Content-Type to a route with a body parameter is refused with 415, as
    one with the wrong type already was, instead of being read as JSON. A
    browser can post such a body to another site without a CORS preflight,
    and FastAPI refuses it by default for the same reason. Pass
    App(strict_content_type=False) to keep reading it. Routes that read
    await request.body() themselves are not affected.

  • Cookies never refuse a request. A pair that is not well-formed RFC 6265 is
    left out and the first cookie with a name wins; before, one malformed or
    repeated cookie answered 400 on every route that reads cookies or takes
    a Request, and on every WebSocket handshake. A browser sends every
    cookie in scope, including those other applications set on the domain.

  • Rate limits count an IPv6 client by its /64 rather than its full address.

  • A WebSocket session keeps at most about max_body_size bytes of received
    messages, plus one message, waiting for its handler (and at most 64
    messages, as before); it then stops reading the socket until the handler
    consumes.

  • A static mount serves at most max_connections responses at once per
    worker and answers 503 with Retry-After beyond that. HTTP/1.1 clients
    cannot reach the bound; it stops HTTP/2 streams from each holding a file
    open.

  • A request that declares a Content-Length over max_body_size is refused
    with 413 at once, before 100 Continue, instead of when the excess
    arrives.

  • During shutdown new connections are refused immediately instead of
    waiting in the listen backlog until the drain ends.

  • A request holds its max_in_flight slot for its work, not while the
    server waits for its body. A request that finds no slot free is still
    refused at once with 503, before any of its body is read. One that is
    admitted gives the slot up while its body is outstanding and takes one
    again when the body is in, so it can now be answered 503 after sending
    its body if every slot has been taken meanwhile. A spooled upload does the
    same each time it waits for its client, but waits its turn for a slot
    rather than being refused part way. Before, a client that declared a body
    and sent none held a slot until the request timeout, and a handful of them
    made every Python route answer 503.

  • Uploads spooled to disk have a limit of their own. Each takes one of
    max_in_flight upload slots, separate from the slots requests run in,
    from its first byte until the last reader of its file is closed, and its
    disk bytes stay charged for as long. That includes a client that has
    paused and an UploadFile the application keeps after the request. A
    further upload is answered 503 Upload capacity is full; other routes
    are not affected. Close an upload when you have finished with it. One
    that is dropped without being closed is freed with its last reference,
    and a refusal for capacity asks Python for a garbage collection (at most
    once a second, and less often while collections free nothing) so that
    readers left in a reference cycle do not hold capacity until an unrelated
    collection.

  • A client must take a response it is behind on at a minimum rate, 240
    bytes a second by default (min_send_rate, below). The send deadline was
    only an idle timeout: a client that took a little, just inside each
    timeout, could hold a response and its share of the response byte budget
    for as long as it liked. Now, within an HTTP/1 response, the time writes
    spend blocked may not exceed the longest request timeout plus the time
    the bytes taken would need at that rate; past it the connection is
    closed. On HTTP/2 the same holds for each stream, and a WebSocket session
    over HTTP/1.1 is counted as one long response. Time the application
    spends producing a response is not counted. A consumer that deliberately
    reads a stream more slowly than that for longer than the timeout is now
    disconnected; set the rate to 0 for the old behaviour.

  • A request that asks for a protocol upgrade the server does not perform is
    answered with Connection: close. Such a connection used to stay open
    for further requests.

  • With the default sync handler pool, a burst of blocking calls can grow
    the pool after its last call has been submitted: a backlog that persists
    is rechecked on the pool's own clock, under the same CPU gate and thread
    ceiling. Before, the pool was only reconsidered when another call
    arrived, so a burst of twelve calls stayed at eight threads.

  • A static or FileResponse file small enough to be compressed whole (up to
    1 MiB) is charged to the response byte budget while it is in memory, as
    other buffered responses are. When the budget cannot take it, it is
    compressed a chunk at a time and sent with chunked framing, as larger
    files already were, instead of being refused. Before, each such response
    held up to 1 MiB that no budget counted.

  • Generated X-Request-ID values start with a prefix chosen at random per
    worker instead of the worker's start time and process id.

  • A SIGHUP received during a rolling reload starts one more cycle when the
    current one ends instead of being dropped.

  • HTTPException and request-validation errors keep their own responses
    when the application registers a handler for a base class such as
    Exception or ValueError: the 404 stays a 404 and an invalid body stays
    a 422, as in FastAPI. A handler for the exception's own class or status
    code applies as before, and a handler for Exception (or status 500)
    remains the catch-all for everything else.

  • An exception that no handler takes is raised from call_next in
    @app.middleware("http"), and into ASGI middleware, after the route's
    dependencies have been torn down, as in Starlette; it used to arrive as a
    500 response. Code after await call_next(request) therefore no longer
    runs for such an error unless it is in finally, and a middleware that
    commits after call_next no longer commits a failed request. If no
    middleware answers it, the catch-all handler or the built-in 500 does.

  • Error logging. A handled exception no longer writes an ERROR line (it
    wrote "Unhandled ..." even when a handler answered). An unhandled one
    writes the same line followed by where it was raised: each frame's file,
    line and function and the exception class names, including chained
    causes. Exception messages and source lines are still never logged.

  • Depends(obj.method) written in several places is one dependency: it
    runs once per request and makes one scope="app" resource, as in
    FastAPI. Each occurrence used to be a separate dependency because a
    bound method is a new object every time it is read.

  • include_router() refuses an App that carries exception handlers,
    middleware, mounted apps, dependency overrides or server options, which
    it used to drop silently, and points to mount(). An App with only
    routes and a lifespan is still included like a router.

  • Assigning JSONResponse.body raises AttributeError (it was ignored),
    and TestClient.cookies.set() rejects a domain or path it cannot
    honour and unknown keywords (they were swallowed).

  • request.scope no longer contains the internal "bessemer.call" entry
    once a request under ASGI middleware has finished.

  • Requests cost less. Under Callgrind, against 1.0.0rc3 and including the
    fixes below, a request takes 8.5% fewer user-space instructions on /json
    and 7.7% fewer on /items/{id} with the default Rust event loop (32,505
    to 29,751 and 35,566 to 32,830), about 5% fewer with asyncio's loop, and
    about 5% fewer for a 20-item Pydantic body on either. Nothing changes on
    the wire. The savings come from resolving common header names in any
    letter case (clients and proxies send them Title-Case), remembering a
    connection's validated Host, borrowing rather than moving the request
    through dispatch, one stop-signal wait per connection, smaller queued
    jobs, and matching a model's next expected key in place. These are
    instruction counts, not throughput; the formal performance gate is still
    open.

  • A response model returned as a dict whose keys are the model's fields
    in declaration order (up to sixteen) is serialised from one pass over the
    dict on GIL builds. Any other dict takes the checked path as before.

Added

  • App(strict_content_type=True).
  • min_send_rate (--min-send-rate, BESSEMER_MIN_SEND_RATE,
    [tool.bessemer] min_send_rate, App.run(min_send_rate=)): the bytes a
    second a client must take of a response it is behind on, once it has been
    behind for the longest request timeout. Default 240; 0 sets no floor.
  • Linux x86_64 wheels for the regular CPython 3.14 build, tested with the
    same suite as the others.
  • py.typed: the package's annotations are visible to type checkers.
  • A warning at startup for a BESSEMER_* environment variable that sets
    nothing but is a slip from a setting (BESSEMER_WORKER), naming the
    setting it resembles.

Fixed

  • A sync handler, sync dependency or executor call that raises no longer
    leaves its error, its future and the waiting frame referring to each
    other. On GIL builds everything the failed call had in scope, an upload
    included, is freed at once instead of at the next garbage collection.
  • Reading Supervisor.bound_address from another thread while the
    supervisor shut down could raise OSError: Bad file descriptor. It now
    reads None once the listener is closed.
  • **Unbounded memory growth on CPython 3....
Read more