vitest icon indicating copy to clipboard operation
vitest copied to clipboard

Debugger Segmentation fault when a file contains 6 functions

Open Zombobot1 opened this issue 3 years ago • 2 comments

Describe the bug

I set up debugger as the documentation guides. When I place a breakpoint inside a file that contains more than 5 functions debugger crashes with segmentation fault.

Reproduction

// test.ts

import { foo } from './parser'

describe('parser', () => {
  it.only('works', () => {
    const f = foo()
  })
})

// parser.ts
function bar() {}
export function bar2() {}
export function bar3() {}
export function bar4() {}
// export const bar4 = () => {}

export function foo() {
  const a = 1 // breakpoint is here
}

//zsh: segmentation fault  /usr/bin/env   /usr/local/bin/node ./node_modules/vitest/vitest.mjs run 

Note: If I replace a function by arrow function debugger works without a crash

System Info

System:
    OS: macOS 11.5.2
    CPU: (8) arm64 Apple M1
    Memory: 269.11 MB / 16.00 GB
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.9.1 - /usr/local/bin/node
    npm: 7.21.1 - /usr/local/bin/npm
  Browsers:
    Chrome: 97.0.4692.71
    Safari: 14.1.2
  npmPackages:
    @vitejs/plugin-react-refresh: ^1.3.6 => 1.3.6 
    vite: ^2.7.12 => 2.7.12 
    vitest: ^0.1.16 => 0.1.16

Used Package Manager

npm

Validations

Zombobot1 avatar Jan 15 '22 23:01 Zombobot1

I'm not sure if this is related, but my tests suddenly started failing with a seg fault as well.

DerYeger avatar Jan 16 '22 07:01 DerYeger

I am also suffering random segmentation faults (sometimes it works, sometimes not) while using the debugger with vitest.

I appreciated that, when I tried to record the issue with OBS (that is, when I have the processor with a higher load) segmentation faults are less prone. I assume then it seems to be some kind of race condition, which is also compatible with @Zombobot1's issue.

$> ~/.config/nvm/versions/node/v17.3.0/bin/node --inspect-brk=42855 ~/my-project/www/node_modules/vitest/vitest.mjs --run --threads false -r src/data -c __tests__/vitest.config.ts __tests__/audience.test.ts
Debugger listening on ws://127.0.0.1:42855/bf20dc67-c771-437d-af4d-46b9a58979e6
For help, see: https://nodejs.org/en/docs/inspector
Debugger attached.

 RUN  ~/my-project/www/src/data


Process finished with exit code 139 (interrupted by signal 11: SIGSEGV)

ajaest avatar Jan 19 '22 10:01 ajaest

Not reproducible anymore. All segmentation issues should be reported as separate issues. Thank you!

sheremet-va avatar Mar 24 '23 13:03 sheremet-va