grit.commits_since... SystemStackError: stack level too deep #41

Closed
hedgehog opened this Issue Nov 4, 2010 · 10 comments

7 participants

@hedgehog

ruby-1.8.7-p249

Full example details here:
http://www.redmine.org/issues/6566#note-3

@assimovt

I got the same problem. Is anyone looking into it?

My environment:

  • ruby-1.8.7-p174, tried also ruby-1.8.7-p249
  • git 1.7.1
  • grit 2.2.0

I got the error with rails source, but when I switched to smaller repository it started to work. Apparently its a memory leak problem in the recursive function rev_list in git-ruby.rb.

Any ideas?

@utkarshkukreti

I'm also getting the same error for projects with over 3000 commits. Seems to work fine for small projects.

@igrigorik

Ping. Same issue on larger repos, as documented on igrigorik/bugspots#4.

Easy way to reproduce:

gem install bugspots
bugspots -d 1000 /path/to/rails_repo 

That'll try to load the last 1000 commits from rails, which will trigger this bug.

@msgerbush

I have been able to work around this by using the native command to call rev-list and then parse the result using Grit.

This is for 24000 commits using:

  • ruby-1.9.3-p0
  • git 1.7.5.1
  • grit 2.4.1
@cleeland

Is the native command to call rev-list in a branch somewhere? I would like to try using it.

@msgerbush

I hadn't put this in a branch. Try the following:

commit_list = repo.git.rev_list({:max_count => false, :no_merges => true, :pretty => "raw", :timeout => false}, branch_name)
commits = Commit.list_from_string(repo, commit_list)

where branch_name is the name of your branch and repo is your Grit::Repo. You can modify the options as you see fit, except for the format (which must be 'raw' for Commit.list_from_string). I have only tried this with grabbing all the commits, which is why I set :max_count => false. Since this leverages the native call in git.rb's method_missing, you can pass any options here that you could normally pass to git-log, http://linux.die.net/man/1/git-log. This includes --since, which takes a date.

If this doesn't work out for you, let me know. I only took a cursory look at Grit while playing with https://github.com/igrigorik/bugspots, but I can try to look deeper into why this works for me, and maybe setup a branch for you.

@cleeland
@cleeland

FYI, I added the modification suggested above and committed to my fork at git://github.com/cleeland/bugspots.git. I'll put in a pull request.

@msgerbush

Correct. Basically there is code inside of git-ruby and git-ruby/repository that processes specific rev_list options by essentially walking the results of git-log without options. commits_since leverages this code instead of using the native git-log command with options. You could either edit the way that commits_since works to not use git-ruby, or you could simply access the Grit::Git CLI directly from your code, like I did above.

@bkeepers
Collaborator

Grit is no longer maintained. See #183 and check out libgit2/rugged.

@bkeepers bkeepers closed this Feb 3, 2014
@cyrus-one cyrus-one pushed a commit to munchery/bugspots that referenced this issue Sep 17, 2015
Chris Cleeland Fix mojombo/grit#41 using suggestion from msgerbush. ae888c7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment