开发者

rails + git + heroku - error on git push

I'm trying to push my app to heroku using: git push heroku master the process runs fine for a little while then spits out all kinds of errors that I've never seen before and I can't find much help on google.

Here is the error log form console:

XXXXX-MacBook-XXXXXX xxxx$ git push heroku master
Counting objects: 7885, done.
Delta compression using up to 4 threads.
git(237,0xb0185000) malloc: *** mmap(size=81125376) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
warning: suboptimal pack - out of m开发者_JAVA技巧emory
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
git(237,0xb0185000) malloc: *** mmap(size=93798400) failed (error code=12)
*** error: can't allocate region
*** set a breakpoint in malloc_error_break to debug
fatal: Out of memory, malloc failed (tried to allocate 93797389 bytes)
error: pack-objects died with strange error
error: failed to push some refs to 'git@heroku.com:xxxxx-xxx-xx.git'

Anyone know what this all means and why it's happening?

Also, i noticed that my: /Users/xxxxxx/Sites/xxxxxx/.git/objects folder is 700+ megs, not sure if that's normal or not as I'm new to rails and github.

Thank you for any help.


Most of the problem-solving is in the comments above; by the time we moved over to chat, things were pretty much taken care of. Here's an answer, just to help close out the question.

It seems that there was some unknown problem in the repository causing the objects directory to grow out of control. We didn't really need to determine what this was, because all of the commits had already been pushed to the github repository. Simply recloning from there (hooray for DVCS providing free backups) created a perfectly good repository to replace the old one.

Moral of the story: If your .git directory is 20 times the size of your content, and it causes malloc/mmap failures during routine operations, something's probably wrong with your repo.


short answer: before doing git push heroku master, run git repack -a -d --window-memory=200m

why? from what I understand, git push runs git gc, which runs git repack.

the problem is that if no maximum memory size is passed, then git will take up unlimited amount of memory (aka all of the memory in your computer) when compressing..hence the out of memory error.

so before doing git push heroku master, run git repack -a -d --window-memory=200m

this will use a maximum of 200MB of memory when compressing, hence preventing the process running out of memory.

see http://linux.die.net/man/1/git-repack for more details.


Should be able to limit the packsize to 100mb and limit the thread number to 1:

$ git config --global pack.packSizeLimit "100m"

$ git config --global pack.threads "1"
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜