Skip to content

[Bug]: Chromium no-store Fetch stream reaches EOF but request fails with ERR_ABORTED #42742

Closed

Description

@etonedu2026

Version

1.63.0 (matching bundled full Chromium 153.0.8010.12). The same script also reproduces with playwright-core 1.62.1 / Chromium 151.0.7922.34.

Steps to reproduce

Repository: https://github.com/etonedu2026/playwright-no-store-stream-repro

The repository must remain private under the account owner's policy; maintainers will not have access by default. I understand the template requests a repository. To make this report independently reproducible without access, the complete synthetic script and exact dependency are included below. It contains no application code or application data.

In an empty directory, save the following as package.json:

{
  "name": "playwright-no-store-stream-repro",
  "private": true,
  "type": "module",
  "devDependencies": { "playwright-core": "1.63.0" }
}

Save the following as repro.mjs:

import { createServer } from 'node:http';
import { chromium } from 'playwright-core';

const server = createServer((req, res) => {
  const url = new URL(req.url, 'http://localhost');
  if (url.pathname !== '/data') return res.end('<html>synthetic reproduction</html>');
  res.writeHead(200, {
    'Content-Type': 'application/json',
    'Cache-Control': url.searchParams.get('cache'),
  });
  res.write('{"ok":');
  setTimeout(() => res.end('true}'), 20);
});
await new Promise(resolve => server.listen(0, '127.0.0.1', resolve));
const origin = `http://127.0.0.1:${server.address().port}`;
const browser = await chromium.launch({ headless: true, executablePath: chromium.executablePath() });
const results = [];
try {
  for (const [cache, reader] of [['no-store', 'stream'], ['no-store', 'json'], ['no-cache', 'stream']]) {
    for (let repeat = 0; repeat < 2; repeat++) {
      const context = await browser.newContext();
      try {
        const page = await context.newPage();
        await page.goto(origin);
        const matches = request => new URL(request.url()).pathname === '/data';
        const terminal = new Promise(resolve => {
          page.on('requestfinished', request => {
            if (matches(request)) resolve({ event: 'requestfinished' });
          });
          page.on('requestfailed', request => {
            if (matches(request)) resolve({ event: 'requestfailed', failure: request.failure()?.errorText });
          });
        });
        const headers = page.waitForResponse(response => matches(response.request()));
        const application = page.evaluate(async ({ cache, reader }) => {
          const response = await fetch(`/data?cache=${cache}`);
          if (reader === 'json') return (await response.json()).ok;
          const handle = response.body.getReader();
          const chunks = [];
          while (true) {
            const { done, value } = await handle.read();
            if (done) break;
            chunks.push(...value);
          }
          handle.releaseLock();
          return JSON.parse(new TextDecoder().decode(new Uint8Array(chunks))).ok;
        }, { cache, reader });
        const response = await headers;
        let hostBodyOk = false;
        let hostError = null;
        try { hostBodyOk = (await response.json()).ok === true; }
        catch (error) {
          hostError = error.message.includes('No data found for resource with given identifier')
            ? 'Network.getResponseBody: No data found for resource with given identifier'
            : 'Other response body error';
        }
        results.push({ cache, reader, repeat, pageBodyOk: await application, hostBodyOk, hostError, terminal: await terminal });
      } finally { await context.close(); }
    }
  }
  console.log(JSON.stringify({ node: process.version, browser: browser.version(), results }, null, 2));
} finally {
  await browser.close();
  server.closeAllConnections();
  await new Promise(resolve => server.close(resolve));
}

Run on Linux:

npm install --ignore-scripts --no-audit --no-fund --registry=https://registry.npmjs.org
export PLAYWRIGHT_BROWSERS_PATH="$(mktemp -d)"
npx playwright-core install chromium
timeout 30s node repro.mjs

The repository pins the same version and includes a lockfile, so a repository checkout can use npm ci.

Expected behavior

All six responses are completely consumed by the page. For each, Playwright should emit requestfinished, and host-side response.json() should return {"ok":true}.

Actual behavior

Both no-store + stream repetitions:

  • Page reader reaches done: true, parses all 11 bytes and returns ok: true.
  • Playwright emits requestfailed with net::ERR_ABORTED.
  • Host response.json() fails with Network.getResponseBody: No data found for resource with given identifier.

Both no-store + native response.json() controls and both no-cache + stream controls emit requestfinished and allow host body reading. The same six-case result was observed on both versions listed above.

The process exits 0 after printing the diagnostic results; exit 0 is not a passing assertion.

Additional context

This uses only a synthetic loopback Node HTTP server and Playwright. There is no AbortController, reader.cancel, request interception, response mocking, Service Worker, application framework, account or database. Each page/context is closed only after the page promise and original request terminal event have completed.

The server's 20 ms delay separates two writes; it is not a client-side sleep intended to fix or hide a failure. Full Chromium is launched using chromium.executablePath(). Changing to no-cache is only a diagnostic control, not a proposed workaround for sensitive responses that must retain no-store.

I have not established the upstream implementation cause or whether it belongs to Chromium or Playwright. No application workaround is being claimed.

Environment

Manually allowlisted environment fields (no environment-variable dump):

  • OS: Ubuntu 26.04 LTS, Linux x86_64 under WSL2
  • Kernel: 6.18.33.1-microsoft-standard-WSL2
  • Node: 22.23.2
  • npm: 10.9.8
  • playwright-core: 1.63.0, exact npm dependency
  • Browser: bundled Chromium 153.0.8010.12, headless, full executable

Activity

  1. etonedu2026 commented on Sep 16, 2026

    @etonedu2026
    Author

    Additional synthetic isolation and an exact-revision source-level hypothesis. This is not a verified Chromium fix or a captured C++ call stack.

    Controlled response comparison

    Using Playwright 1.62.1 and its Chromium 151.0.7922.34, a loopback Node HTTP server returned only the fixed 11-byte body {"ok":true} with HTTP/1.1, Content-Length: 11, Cache-Control: no-store, and Connection: keep-alive. There was no proxy, authentication, database, or application service. The server either wrote the body once or split it into 6 + 5 bytes separated by 20 ms. Each cell below was observed twice:

    Browser-side reader One write Two writes, 20 ms apart
    Native response.json() 2/2 page success, requestfinished, host body readable 2/2 page success, requestfinished, host body readable
    Plain byte-counted response.body.getReader() loop 2/2 page success, requestfinished, host body readable 2/2 page success and EOF, but requestfailed/aborted and host body unavailable

    These are observed diagnostic counts, not a comprehensive regression suite. The response bytes, HTTP version, headers, and connection policy were held constant.

    Two further tiny synthetic comparisons:

    • Native Response.clone() before acquiring the original reader, immediately cancelling the unused clone without awaiting that cancellation, changed the split-response result to 2/2 requestfinished with a readable host body.
    • response.body.tee() with the unused branch cancelled still produced 2/2 page success but native aborted/host body unavailable.

    I am not recommending clone as a workaround. In this revision, the native tee implementation eagerly reads into destination chunk queues. Cancelling one branch does not impose the application's byte limit/backpressure on the active native queue. Tiny successful examples cannot establish a memory bound.

    Source-level reentrancy candidate

    Browser.getVersion reported product Chrome/151.0.7922.34 and revision @782af9cb30a53f54487e5d2e44738645a8ec457c. At that exact public revision:

    1. In ResponseBodyLoader::DelegatingBytesConsumer, OnStateChange() invokes the client before its later terminal-state handling.
    2. In BodyStreamBuffer, a closed consumer leads through Close() to CancelConsumer().
    3. If this reenters the delegating consumer while it is still loading, Cancel() marks it cancelled. Later completion handling ignores a non-loading state, allowing the pending notification to dispatch cancellation rather than completion.

    That ordering is consistent with the multi-write page-EOF/native-abort discrepancy, but I have not instrumented Blink to prove this is the runtime path, nor proved from this inspection why no-store selects it. No patched Chromium build has been tested.

    Would latching an already-observed terminal state before invoking the reentrant client be an appropriate upstream investigation direction? Any change would need to preserve real transport errors, cancellation, waiting/lookahead and unread-body semantics; valid JSON bytes alone must not turn a truncated or cancelled response into successful delivery.

  2. dcrousso commented on Sep 18, 2026

    @dcrousso
    Contributor

    this appears to be a Chromium issue rather than a problem with your script and ordinary streaming responses can trigger it without artificial delays

    i think https://chromium-review.googlesource.com/c/chromium/src/+/6716020 is maybe relevant?

  3. github-actions commented on Sep 21, 2026

    @github-actions
    Contributor

    Hi, I'm the Playwright bot and I took a first look at this.

    Reproduced on tip-of-tree (npm 1.64.0-next, sha 42fbb78, bundled Chromium 154.0.8037.0). Chromium only — Firefox and WebKit report requestfinished for the same response. Your narrowing holds exactly: it needs no-store and a streaming body.getReader() consumer and a body split across more than one write. Any one of those removed and the request finishes cleanly.

    Your read of it as a Chromium issue matches what I see, and Devin Rousso (@dcrousso)'s pointer looks like the right thread to pull: crrev.com/c/6716020 — "Network.loadingFailed is issued for fetch requests with empty response" — touches response_body_loader.cc, the same file your reentrancy hypothesis lands on. It's still WIP upstream (last touched Aug 2025, never landed), so there's nothing to pick up on our side yet.

    Control matrix (chromium, tip-of-tree, 1 run each)
    Cache-Control Page reader Writes Terminal event Host response.json()
    no-store getReader() two, 20ms apart requestfailed / net::ERR_ABORTED No data found for resource with given identifier
    no-store getReader() one requestfinished ok
    no-store response.json() two requestfinished ok
    no-store response.json() one requestfinished ok
    no-cache getReader() two requestfinished ok
    no-cache getReader() one requestfinished ok
    no-cache response.json() two requestfinished ok
    no-cache response.json() one requestfinished ok

    In every row the page-side reader reached EOF and parsed {"ok":true} — only the Playwright-observed outcome differs.

    Also run: the failing case 3x on each of chromium/firefox/webkit (headless). Chromium failed all 3; firefox and webkit passed all 3. Both the headless shell and the full Chromium binary you used show it, so it isn't headless-specific.

    Condensed repro (tests/page/ style, fails on chromium)
    import { test, expect } from './pageTest';
    
    test('no-store streamed response should report requestfinished', async ({ page, server }) => {
      server.setRoute('/data', (req, res) => {
        res.writeHead(200, { 'Content-Type': 'application/json', 'Cache-Control': 'no-store' });
        res.write('{"ok":');
        setTimeout(() => res.end('true}'), 20);
      });
      await page.goto(server.EMPTY_PAGE);
    
      const matches = (url: string) => new URL(url).pathname === '/data';
      const terminal = new Promise<any>(resolve => {
        page.on('requestfinished', r => matches(r.url()) && resolve({ event: 'requestfinished' }));
        page.on('requestfailed', r => matches(r.url()) && resolve({ event: 'requestfailed', failure: r.failure()?.errorText }));
      });
    
      const pageResult = await page.evaluate(async () => {
        const response = await fetch('/data');
        const reader = response.body!.getReader();
        const chunks: number[] = [];
        for (;;) {
          const { done, value } = await reader.read();
          if (done)
            break;
          chunks.push(...value);
        }
        return JSON.parse(new TextDecoder().decode(new Uint8Array(chunks))).ok;
      });
    
      expect(pageResult).toBe(true);           // passes — page got the whole body
      expect(await terminal).toEqual({ event: 'requestfinished' });  // fails — requestfailed / net::ERR_ABORTED
    });

    Thanks for the unusually thorough report — the six-case matrix and the exact-revision source pointers made this quick to confirm.

    Triaged on Linux by the Playwright bot - agent run

  4. added
    browser-chromium
    and removed on Sep 28, 2026
  5. 0moku commented on Oct 1, 2026

    @0moku

    Additional evidence for this issue: BYOB and bounded pipeTo also reproduce the failure, without an HTTP release request or an explicit successful-EOF cancellation in the pipeTo arm.

    Node 22.23.1, Playwright 1.63.0, HeadlessChrome/153.0.8010.12, revision 971a7443b0c9b0a9b2860529b33331b76077ec62.

    One synthetic HTTP matrix used three fresh-context repetitions per arm. Response: Cache-Control: no-store, private; fetch: cache: 'no-store'; routing off. Each response sent {"ok":true} in 6 + 5 bytes, with a Playwright host binding releasing the final five bytes—no HTTP ACK endpoint. Default/BYOB issued the next read before invoking the binding. Binding ACK was joined only after body consumption settled.

    Consumer Valid JSON Original request failed (native CDP + Playwright) Whole-case strict completion
    Bounded default reader 3/3 3/3 0/3
    Bounded BYOB reader 3/3 3/3 0/3
    Bounded WritableStream + pipeTo 3/3 3/3 0/3
    Native Response.json() reference 3/3 0/3 3/3

    All nine bounded positives observed chunks [6,5], EOF and valid JSON; Node response finish occurred without premature close. Native events nevertheless reported Network.loadingFailed, type Fetch, net::ERR_ABORTED, canceled:true, agreeing with Playwright. Native JSON emitted loadingFinished/requestfinished. There were no additional request failures, and all terminals were observed before teardown. Native JSON's first chunk/raw consumed byte count was not instrumented; it is an unbounded diagnostic control, not a proposed replacement.

    Seven negative controls retained genuine failures:

    • Default/BYOB/pipeTo: 257-byte body against a 256-byte limit rejected before retaining the oversized second chunk (6 bytes retained).
    • All three: the full valid 11-byte JSON followed by socket FIN with declared length 12 rejected before EOF/parse; ERR_CONTENT_LENGTH_MISMATCH, canceled:false, Node premature close.
    • Default reader: explicit abort after six bytes rejected with AbortError/ERR_ABORTED, with Node premature close.

    Native/PW terminals agreed for 19/19 data requests (12 positive + 7 negative). The pipeTo arm does not explicitly call reader.cancel() after EOF, so that application cleanup call is not necessary for this reproduction. These are finite synthetic observations, not a failing C++ stack or evidence that a bounded workaround is safe.

    Executed code excerpts (not a standalone reproduction)

    The fragments below are copied verbatim from the executed synthetic harness/controller, with no code substitutions. They fit together as described, but omit fixture setup, bookkeeping and lifecycle observers. These fragments are not a separately validated standalone program. No original application helper or private import is included.

    Browser: validation, bounded consumers, release ordering and deferred ACK join

    The page function receives spec.arm (A/B/C/D) and spec.kind (positive/oversize/truncated/abort). Its omitted setup creates metrics, an AbortController, and a same-origin fetch of /data with request cache no-store and that controller's signal. The response is passed to the following executed consumer block. releaseFinalBytes is the host binding shown below, not HTTP.

    Validation functions:

    function invalid(code='INVALID_RESPONSE'){throw new Error(code);}
    function validate(response,limit){
      if(response.headers.get('Content-Type')?.split(';')[0].trim().toLowerCase()!=='application/json')invalid();
      const length=response.headers.get('Content-Length');
      if(length!==null&&(!/^\d+$/.test(length)||Number(length)>limit))invalid();
      if(!response.body)invalid();
    }

    Inside the page function, release signaling and byte accounting:

      const release=()=>{
        if(metrics.releaseInvoked)invalid('DUPLICATE_RELEASE');
        metrics.releaseInvoked=true;
        bindingPromise=window.releaseFinalBytes({firstChunkBytes:metrics.chunkSizes[0]??null,nextReadIssued:metrics.nextReadIssuedBeforeRelease,nativeJsonStarted:metrics.nativeJsonStartedBeforeRelease}).then(()=>({ok:true}),()=>({ok:false}));
        if(spec.kind==='abort'){metrics.abortRequested=true;aborter.abort();}
      };
      const store=(value,chunks,limit)=>{
        metrics.chunkCount++;metrics.chunkSizes.push(value.byteLength);metrics.bytesObserved+=value.byteLength;
        if(metrics.bytesObserved>limit)invalid('LIMIT_EXCEEDED');
        chunks.push(spec.arm==='B'?value.slice():value);metrics.bytesStored+=value.byteLength;
      };

    After fetch resolves, inside the surrounding try/catch:

        const limit=spec.kind==='oversize'?256:131072;let value;
        if(spec.arm==='D'){
          metrics.chunkCount=null;metrics.chunkSizes=[];metrics.readCalls=null;metrics.eof=null;
          const consuming=response.json();metrics.nativeJsonStartedBeforeRelease=true;release();value=await consuming;
        }else{
          validate(response,limit);const chunks=[];
          if(spec.arm==='C'){
            await response.body.pipeTo(new WritableStream({
              write(chunk){store(chunk,chunks,limit);if(metrics.chunkCount===1){metrics.firstChunkBeforeRelease=true;if(chunk.byteLength!==6)invalid('FIRST_CHUNK_NOT_SIX');release();}},
              close(){metrics.eof=true;},abort(){metrics.sinkAborted=true;}
            }));
          }else{
            const reader=spec.arm==='B'?response.body.getReader({mode:'byob'}):response.body.getReader();
            const nextRead=()=>{metrics.readCalls++;return spec.arm==='B'?reader.read(new Uint8Array(Math.min(16384,limit-metrics.bytesStored+1))):reader.read();};
            try{
              let pending=nextRead();
              while(true){
                const{done,value:chunk}=await pending;if(done){if(spec.arm==='B'&&chunk?.byteLength)store(chunk,chunks,limit);metrics.eof=true;break;}
                store(chunk,chunks,limit);
                // This native read call is issued while the host still holds the remainder.
                pending=nextRead();
                if(metrics.chunkCount===1){metrics.firstChunkBeforeRelease=true;if(chunk.byteLength!==6)invalid('FIRST_CHUNK_NOT_SIX');metrics.nextReadIssuedBeforeRelease=true;release();}
              }
            }finally{metrics.cancelAttempted=true;await reader.cancel().catch(()=>undefined);reader.releaseLock();metrics.lockReleased=true;}
          }
          const joined=new Uint8Array(metrics.bytesStored);let offset=0;for(const chunk of chunks){joined.set(chunk,offset);offset+=chunk.byteLength;}
          try{value=JSON.parse(new TextDecoder('utf-8',{fatal:true}).decode(joined));}catch{invalid();}
        }

    The surrounding catch records consumer failure (it does not convert it to success), and finally sets bodySettled=true. Only then is the binding promise joined:

      // Binding ACK never blocks body progress. Join only after consumer success/failure.
      if(bindingPromise){const ack=await bindingPromise;metrics.releaseAcknowledged=ack.ok;metrics.bindingJoinedAfterBody=bodySettled;}

    BYOB uses a fresh view of at most 16 KiB (or remaining limit + 1), copies accepted views, handles a nonempty final BYOB value before EOF, and has no fallback. A/B both cancel/release in finally; C uses no manual EOF reader cancellation. The normal fixture limit is 131072 bytes; the oversize control uses 256. The native JSON reference deliberately bypasses these bounded-consumer checks.

    Controller: Playwright binding and Node 6 + 5 byte response

    Each fresh context registers this binding before page creation. item is the active fixture case. demand throws on a false assertion; fault records an infrastructure fault. These are synthetic-controller bookkeeping, not application code.

          await item.context.exposeBinding('releaseFinalBytes',async(source,meta)=>{try{demand(source.page===item.page&&source.frame===item.page.mainFrame(),'BINDING_SOURCE');return await hostRelease(item,meta);}catch{fault('BINDING_FAILURE');throw new Error('BINDING_FAILURE');}});

    The host callback checks the page's metadata and resolves the case's deferred release promise:

      async function hostRelease(item,meta){
        demand(item===activeCase&&!!item.serverResult&&++item.releaseCount===1,'BINDING_CASE');
        demand(meta&&Object.keys(meta).sort().join(',')==='firstChunkBytes,nativeJsonStarted,nextReadIssued','BINDING_METADATA');
        const record=item.serverResult;record.releaseSeen=true;
        if(item.arm==='D'){demand(meta.nativeJsonStarted===true,'NATIVE_JSON_NOT_STARTED');record.nativeJsonConsumptionStarted=true;}
        else{demand(meta.firstChunkBytes===6,'FIRST_CHUNK_ACK');record.firstChunkAcknowledged=true;}
        if(item.arm==='A'||item.arm==='B'){demand(meta.nextReadIssued===true,'PENDING_READ_ACK');record.nextReadAcknowledged=true;}
        item.release.resolve();return true;
      }

    In the Node data handler, the executed response header block:

          const headers={'Content-Type':'application/json','Cache-Control':'no-store, private'};
          if(item.kind==='truncated')headers['Content-Length']='12';else headers['Transfer-Encoding']='chunked';
          res.writeHead(200,headers);

    The following is the exact write callback body within the controller's response-completion observer. That observer and its accounting wrapper are omitted, not replaced. record contains server counters; item.release.promise is the deferred gate resolved above. item.kind selects the positive/negative control. The ordinary positive branch writes {"ok": immediately and true} only after release. The explicit-abort control intentionally withholds the remainder.

            record.bodyWrites++;record.totalBodyBytes+=6;res.write('{"ok":');
            void item.release.promise.then(()=>{
              if(item.kind==='abort')return;
              if(res.destroyed){fault('RELEASE_AFTER_DESTROY');return;}
              record.remainderAfterRelease=record.releaseSeen;record.bodyWrites++;
              const remainder=item.kind==='oversize'?'x'.repeat(251):'true}';record.totalBodyBytes+=Buffer.byteLength(remainder);
              if(item.kind==='truncated')res.write(remainder,()=>{record.socketFinRequested=true;res.socket?.end();});
              else res.end(remainder);
            }).catch(()=>{fault('RELEASE_WRITE_ERROR');res.destroy();});

    The omitted observer waits for Node response finish/error/premature close. Separate observers capture the original request's CDP and Playwright terminal events before teardown; they retain failures even when the page parsed valid JSON.

  6. rldyourmnd commented on Oct 31, 2026

    @rldyourmnd

    Verification of the Chromium fix (crrev.com/c/8508456, first in 157.0.8090.0) on official Chrome for Testing builds. Synthetic loopback server, Playwright 1.64.1, headless, 3 fresh contexts per cell. The response is Cache-Control: no-store and the request uses cache: 'no-store'. Each cell checks the CDP terminal event, the Playwright terminal event and the host-side body.

    Case 156.0.8078.80 157.0.8103.15 158.0.8127.2
    getReader() / BYOB / pipeTo / pull-through wrapper to EOF; 3 deliveries each (chunked, Content-Length, page-gated second chunk) 0/36: loadingFailed net::ERR_ABORTED canceled 36/36: loadingFinished, requestfinished, host body OK 36/36
    response.json() (3 deliveries) 9/9 9/9 9/9
    Empty body, never read 0/3 aborted 3/3 3/3
    Control: declared Content-Length: 12, 11 bytes, FIN 6/6 ERR_CONTENT_LENGTH_MISMATCH 6/6 6/6
    Control: AbortController.abort() / reader.cancel() mid-body 6/6 ERR_ABORTED canceled 6/6 6/6

    So the fixed builds report completion for every stream consumer, and genuine truncation and cancellation still fail as they should. Note that Playwright 1.64.1 (the latest release) still bundles 156.0.8078.4 and is affected; main (Chromium r1253, 158.0.8127.2) is not.

    Regression test: #43830 (NE-144 in tests/page/page-event-request.spec.ts, next to the 204 test). It delivers the last data chunk and the end of the body separately, each only after the page has read everything before it. It is skipped on Chromium before 157. With that skip removed, it fails 10/10 with net::ERR_ABORTED on 156.0.8078.80. It passes on 157.0.8103.15, on bundled r1253, on Firefox r1570 and on WebKit r2387 (Linux).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

browser-chromiumv1.65

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions