TECHNOLOGY

Request cancellation: testing the full client-to-engine chain

In this article
THE QUICK TAKE

A closed client socket establishes only local cancellation. Observe upstream termination and resource cleanup separately.

A user stops an answer and the interface stops displaying text. That does not establish that server computation ended. The client may stop reading, a proxy retain upstream access, and the engine continue generating. Providers need a cancellation chain showing where the signal originated, which components handled it and which resources were actually released. Begin with a bounded synthetic scenario rather than assuming disconnect propagates automatically.

Separate observable boundaries

AbortController can abort fetch, body consumption and related streams on the client. It establishes local behavior rather than the remote engine’s action, especially across proxies and internal queues.

Map the client operation, external connection, API-process request and upstream operation. For each boundary identify an available ID and completion signal. Where part of the chain is invisible, record that limitation instead of declaring everything stopped from one external event.

Check proxy policy

The NGINX proxy reference documents client-abort behavior and related settings. Actual configuration matters. Do not transfer a direct-connection result to a proxied route or treat client disappearance as proof that every internal operation immediately closes.

Save effective test-location settings without secrets. Compare direct and intermediate paths using the same scenario. This localizes missing propagation or a buffer that hides continued source activity.

Test two cancellation points

One fixture cancels after acceptance but before first content. Another stops reading after a known event count. Both have small output limits, an overall timeout and bounded attempts. Real customer inputs and indefinitely generating workloads are unnecessary.

The OpenRouter documentation explicitly makes cancellation support dependent on providers and mode. One route’s ability to stop processing is not a universal integration guarantee. State your tested configuration and remaining unverified boundaries separately.

Observe resource cleanup

The vLLM metrics reference describes server observations useful for following requests and queues. Save a baseline before the fixture, a time series during it and the final state. Fewer external connections do not replace evidence for the corresponding upstream operation.

Growth or delayed gauge recovery needs investigation: work may still run, wait in a queue, hold a buffer or be sampled at another cadence. One late sample is not proof of a leak. Repeat the bounded test and compare identifiers before concluding how it works.

Separate cleanup from settlement

Released memory or a stopped stream does not independently define payment. Work accounting follows the selected contract and available terminal records. Cancellation may leave client usage incomplete, so missing counters do not establish that no work occurred.

Related guides cover stream failures and GPU monitoring. The artifact is traceable cancellation at known boundaries, without universal processing, billing or deployed-resource promises. Keep timestamps and the tested proxy path together so a later dependency update can reproduce the same evidence instead of relying on a stopped progress indicator.

← All articles