grasp icon indicating copy to clipboard operation
grasp copied to clipboard

segmentation fault when run on large sets of files

Open chriswatrous opened this issue 5 years ago • 3 comments

  • OS: macOS 10.13.6
  • node: v6.11.3, v8.11.3
  • npm: 6.3.0
  • grasp: 0.6.0

I'm getting Segmentation fault: 11 and sometimes Bus error: 10 when running grasp on large sets of files. I first noticed the problem working on a proprietary project that I can't share here but I was able to reproduce it by cloning the react repo.

To reproduce:

git clone https://github.com/facebook/react.git --branch v16.4.2 --depth 1
cd react
grasp -r ident
grasp -r import-dec
grasp -r with
grasp -re '__ = __'
grasp -re '__ = __ = __'

This gets 131643 lines of javascript. The query doesn't seem to matter. All of those grasp commands end with Segmentation fault: 11 every time.

Here's an example with a smaller set of files (but still 29065 lines).

cd packages/react-dom/src/__tests__

# run grasp on 29066 lines in 67 files
grasp with *.js # segfault

# run grasp separately on each file, largest file 2578 lines
ls *.js | xargs -L 1 grasp with  # no segfault

# cat the files together and pipe to grasp
cat *.js | grasp with  # segfault

chriswatrous avatar Aug 12 '18 23:08 chriswatrous

same problem here running on node.js codebase:

$ grasp -e '__.pop' -r ../node/lib/
lib/domain.js:247:        stack.pop();
lib/internal/assert.js:74:    actualLines.pop();
lib/internal/assert.js:75:    expectedLines.pop();
lib/internal/assert.js:176:        actualLines.pop();
lib/internal/assert.js:241:            res.pop();
lib/internal/freelist.js:13:      this.list.pop() :
Segmentation fault: 11

ainthek avatar Aug 13 '18 16:08 ainthek

chriswatrous: try $ node --version v10.7.0 works for me

ainthek avatar Aug 13 '18 16:08 ainthek

Cool. It works for me with node v10.7.0.

I made this shell script so I can use it while other node versions are active:

~/bin/grasp

#!/bin/bash

~/.nvm/versions/node/v10.7.0/bin/node ~/.nvm/versions/node/v10.7.0/lib/node_modules/grasp/bin/grasp "$@"

An alias also works:

alias grasp='~/.nvm/versions/node/v10.7.0/bin/node ~/.nvm/versions/node/v10.7.0/lib/node_modules/grasp/bin/grasp'

chriswatrous avatar Aug 16 '18 02:08 chriswatrous