Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

segmentation fault when run on large sets of files #128

Open
chriswatrous opened this issue Aug 12, 2018 · 3 comments
Open

segmentation fault when run on large sets of files #128

chriswatrous opened this issue Aug 12, 2018 · 3 comments

Comments

@chriswatrous
Copy link

chriswatrous commented Aug 12, 2018

  • 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
@ainthek
Copy link

ainthek commented Aug 13, 2018

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
Copy link

ainthek commented Aug 13, 2018

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

@chriswatrous
Copy link
Author

chriswatrous commented Aug 16, 2018

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'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants