vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Error: [birpc] timeout on calling "onTaskUpdate" is sometimes thrown

Open Artur- opened this issue 2 years ago • 5 comments

Describe the bug

When running vitest dev --browser.name=chromium --no-browser.headless to debug a test and you debug for more than 60s, the browser is closed, you lose the debug session and the Vite process exits with

⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯ Unhandled Rejection ⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯⎯
Error: [birpc] timeout on calling "onTaskUpdate"
 ❯ Timeout._onTimeout node_modules/vitest/dist/vendor-index.b271ebe4.js:39:22
 ❯ listOnTimeout node:internal/timers:573:17
 ❯ process.processTimers node:internal/timers:514:7

Reproduction

it('should not crash', () => {
   debugger;
});

System Info

System:
    OS: macOS 14.0
    CPU: (10) arm64 Apple M1 Max
    Memory: 1011.86 MB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 20.9.0 - ~/.nvm/versions/node/v20.9.0/bin/node
    npm: 10.1.0 - ~/.nvm/versions/node/v20.9.0/bin/npm
    bun: 1.0.7 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 107.1.45.123
    Chrome: 119.0.6045.123
    Chrome Canary: 121.0.6125.0
    Edge: 119.0.2151.58
    Safari: 17.0
  npmPackages:
    @vitejs/plugin-react: 4.1.1 => 4.1.1 
    @vitest/browser: ^0.34.6 => 0.34.6 
    @vitest/ui: ^0.34.6 => 0.34.6 
    vite: 4.5.0 => 4.5.0 
    vitest: ^0.34.6 => 0.34.6

Used Package Manager

npm

Validations

Artur- avatar Nov 14 '23 07:11 Artur-

This also happens seemingly randomly when running vitest watch and then you need to restart the process

Artur- avatar Dec 04 '23 13:12 Artur-

I'm also seeing this regularly in a workspace based setup where multiple browser and non-browser tests are run together. Here, the timeout occurs much more frequently than if we run only the browser tests specifically.

fubhy avatar Dec 14 '23 10:12 fubhy

The hacky workaround here for debugging is to go and edit node_modules/vitest/dist/vendor/index.cAUulNDf.js and change the default birpc timeout to something larger, e.g.

const DEFAULT_TIMEOUT = 6e7;

Artur- avatar Dec 18 '23 11:12 Artur-

Same here in a file with 61 tests. Passed locally but failed on CI. After splitting the tests into 2 separate files it passed in CI too.

shamelio avatar Jan 10 '24 17:01 shamelio

I have also run into this in CI but not locally. The option workaround I found was to flushPromises await new Promise(res => setImmediate(res)) in afterEach for the tests these errors popped up in. I haven't been able to determine the root cause.

SCasarotto avatar Jan 11 '24 18:01 SCasarotto

I could not reproduce this on the latest beta.

sheremet-va avatar Jun 18 '24 12:06 sheremet-va

I have not seen this error in quite some time, even with vitest 1.6

Artur- avatar Jun 18 '24 13:06 Artur-

Last weekly we decided to close the issue if it's not reproducible. Feel free to reopen it if the issue still persists.

sheremet-va avatar Jun 18 '24 13:06 sheremet-va