{"thread":{"id":"45223","subject":"git status --> Out of memory, realloc failed","startedAt":"2017-02-25T10:13:38Z","lastAt":"2017-03-03T21:34:38Z","messageCount":7,"participants":["Carsten Fuchs","René Scharfe","Duy Nguyen"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"312629","messageId":"84c02ca1-269e-2f26-c625-476d7f087f5c@cafu.de","threadId":"45223","inReplyTo":null,"subject":"git status --> Out of memory, realloc failed","fromName":"Carsten Fuchs","fromEmail":"carsten.fuchs@cafu.de","sentAt":"2017-02-25T10:13:17Z","receivedAt":"2017-02-25T10:13:38Z","isPatch":false,"sender":{"key":"carsten.fuchs@cafu.de","avatar":"https://gravatar.com/avatar/bd0d6585c2cec9529584fc310bbcdee3ffd1f06f3fb88644fdb87fd880fc75a6?d=mp&s=160"},"body":"Dear Git group,\n\nI use Git at a web hosting service, where my user account has a memory \nlimit of 768 MB:\n\n(uiserver):p7715773:~$ uname -a\nLinux infongp-de15 3.14.0-ui16322-uiabi1-infong-amd64 #1 SMP Debian \n3.14.79-2~ui80+4 (2016-11-17) x86_64 GNU/Linux\n\n(uiserver):p7715773:~$ git --version\ngit version 2.1.4\n\nThe problem is that `git status` fails with an out of memory error:\n\n(uiserver):p7715773:~/cafu$ git status\nfatal: Out of memory, realloc failed\nfatal: recursion detected in die handler\n\nI talked to their support and their suggestion was to set a couple of \nmemory constraints and to run `git gc`. This seemed to work well – but \n`git status` still fails:\n\n(uiserver):p7715773:~/cafu$ cat ~/.gitconfig\n[color]\n     ui = auto\n[user]\n     name = Carsten Fuchs\n     email = carsten.fuchs@cafu.de\n[core]\n     editor = nano\n     pager = less -M -FRXS\n     packedgitwindowsize = 30m\n     packedgitlimit = 40m\n[i18n]\n     commitEncoding = ISO-8859-1\n[pack]\n     threads = 1\n     windowMemory = 10m\n     packSizeLimit = 20m\n     deltaCacheSize = 30m\n\n(uiserver):p7715773:~/cafu$ git gc\nZähle Objekte: 44293, Fertig.\nKomprimiere Objekte: 100% (24534/24534), Fertig.\nSchreibe Objekte: 100% (44293/44293), Fertig.\nTotal 44293 (delta 17560), reused 41828 (delta 16708)\n\n(uiserver):p7715773:~/cafu$ git status\nfatal: Out of memory, realloc failed\nfatal: recursion detected in die handler\n\nThe repository is tracking about 19000 files which together take 260 MB.\nThe git server version is 2.7.4.1.g5468f9e (Bitbucket)\n\nWell, their next response was that they have no solution for me – \nexcept, unsurprisingly, coaxing me into a more expensive hosting package.\n\nI've read the Git man page about `git config`, but was not able to come \nup with anything to improve the situation.\n\nAny ideas what I could do to reduce the memory consumption of `git status`?\n\nBest regards,\nCarsten\n\nPS: Many thanks to Philip Oakley for initial advice at git-users, to \nwhich I should have properly subscribed in the first place, as the \nGoogle Groups interface seems to lose messages (mine at least, and \ninadvertently posts them as HTML) and gmane's NNTP interface reports \nthat it is unidirectional/read-only.\n\n"},{"id":"312936","messageId":"ea0722e2-c2bd-bd80-a233-50676efcafda@web.de","threadId":"45223","inReplyTo":"84c02ca1-269e-2f26-c625-476d7f087f5c@cafu.de","subject":"Re: git status --> Out of memory, realloc failed","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-03-01T10:02:51Z","receivedAt":"2017-03-01T10:04:26Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 25.02.2017 um 11:13 schrieb Carsten Fuchs:\n> Dear Git group,\n>\n> I use Git at a web hosting service, where my user account has a memory\n> limit of 768 MB:\n>\n> (uiserver):p7715773:~$ uname -a\n> Linux infongp-de15 3.14.0-ui16322-uiabi1-infong-amd64 #1 SMP Debian\n> 3.14.79-2~ui80+4 (2016-11-17) x86_64 GNU/Linux\n\nWhat's the output of \"ulimit -a\"?\n\n> (uiserver):p7715773:~$ git --version\n> git version 2.1.4\n\nThat's quite old.  Can you try a more recent version easily (2.12.0 just \ncame out)?  I don't remember a specific fix, and memory usage perhaps \neven increased with newer versions, but ruling out already fixed issues \nwould be nice.\n\n> (uiserver):p7715773:~/cafu$ git gc\n> Zähle Objekte: 44293, Fertig.\n> Komprimiere Objekte: 100% (24534/24534), Fertig.\n> Schreibe Objekte: 100% (44293/44293), Fertig.\n> Total 44293 (delta 17560), reused 41828 (delta 16708)\n>\n> (uiserver):p7715773:~/cafu$ git status\n> fatal: Out of memory, realloc failed\n> fatal: recursion detected in die handler\n>\n> The repository is tracking about 19000 files which together take 260 MB.\n> The git server version is 2.7.4.1.g5468f9e (Bitbucket)\n\nIs your repository publicly accessible?\n\nRené\n"},{"id":"312975","messageId":"cbd281fc-3a4b-b4dc-5dff-145c97cd68d6@cafu.de","threadId":"45223","inReplyTo":"ea0722e2-c2bd-bd80-a233-50676efcafda@web.de","subject":"Re: git status --> Out of memory, realloc failed","fromName":"Carsten Fuchs","fromEmail":"carsten.fuchs@cafu.de","sentAt":"2017-03-01T20:12:52Z","receivedAt":"2017-03-01T20:31:34Z","isPatch":false,"sender":{"key":"carsten.fuchs@cafu.de","avatar":"https://gravatar.com/avatar/bd0d6585c2cec9529584fc310bbcdee3ffd1f06f3fb88644fdb87fd880fc75a6?d=mp&s=160"},"body":"Hi René,\n\nAm 01.03.2017 um 11:02 schrieb René Scharfe:\n>> I use Git at a web hosting service, where my user account has a memory\n>> limit of 768 MB:\n>>\n>> (uiserver):p7715773:~$ uname -a\n>> Linux infongp-de15 3.14.0-ui16322-uiabi1-infong-amd64 #1 SMP Debian\n>> 3.14.79-2~ui80+4 (2016-11-17) x86_64 GNU/Linux\n>\n> What's the output of \"ulimit -a\"?\n\n(uiserver):p7715773:~$ ulimit -a\ncore file size          (blocks, -c) 0\ndata seg size           (kbytes, -d) unlimited\nscheduling priority             (-e) 1\nfile size               (blocks, -f) unlimited\npending signals                 (-i) 16382\nmax locked memory       (kbytes, -l) 64\nmax memory size         (kbytes, -m) unlimited\nopen files                      (-n) 512\npipe size            (512 bytes, -p) 8\nPOSIX message queues     (bytes, -q) 819200\nreal-time priority              (-r) 0\nstack size              (kbytes, -s) 8192\ncpu time               (seconds, -t) 1800\nmax user processes              (-u) 42\nvirtual memory          (kbytes, -v) 786432\nfile locks                      (-x) unlimited\n\n>> (uiserver):p7715773:~$ git --version\n>> git version 2.1.4\n>\n> That's quite old.  Can you try a more recent version easily (2.12.0 just came out)?\n\nI don't think that they have any newer version available, having just upgraded from Git \n1.7 a couple of weeks ago... (1und1)\n\nGit 1.7 used to work for me in the same environment, but iirc they also said they \nswitched from 32-bit to 64-bit edition and blame the increased memory consumption on \nthat change.\n\nI'll ask for a newer version, but I'd be surprised if this happened.\n\n>> The repository is tracking about 19000 files which together take 260 MB.\n>> The git server version is 2.7.4.1.g5468f9e (Bitbucket)\n>\n> Is your repository publicly accessible?\n\nUnfortunately, no. There are no big secrets in there, but just a couple of database \ndetails so that I cannot make it universally available. I can gladly give you access \nthough. (E.g. by adding your public SSH key?)\n\nBest regards,\nCarsten\n"},{"id":"313060","messageId":"CACsJy8B3Qy1mra_GwhbYdk5LFrgYx=6NRqq=wvw2_wcWCO_yNw@mail.gmail.com","threadId":"45223","inReplyTo":"cbd281fc-3a4b-b4dc-5dff-145c97cd68d6@cafu.de","subject":"Re: git status --> Out of memory, realloc failed","fromName":"Duy Nguyen","fromEmail":"pclouds@gmail.com","sentAt":"2017-03-02T09:31:18Z","receivedAt":"2017-03-02T11:16:54Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, Mar 2, 2017 at 3:12 AM, Carsten Fuchs <carsten.fuchs@cafu.de> wrote:\n>>> The repository is tracking about 19000 files which together take 260 MB.\n>>> The git server version is 2.7.4.1.g5468f9e (Bitbucket)\n>>\n>>\n>> Is your repository publicly accessible?\n>\n>\n> Unfortunately, no. There are no big secrets in there, but just a couple of\n> database details so that I cannot make it universally available. I can\n> gladly give you access though. (E.g. by adding your public SSH key?)\n\nYou could also try \"git fast-export --anonymize\" (read the doc first).\nI'm not sure if it keeps blob size though, and delta chain might also\nmatter so an anonymized repo may or may not share the same problem,\nI'm not sure.\n-- \nDuy\n"},{"id":"313097","messageId":"6ba86c1a-87a9-f886-273b-7f94c30c4a95@web.de","threadId":"45223","inReplyTo":"cbd281fc-3a4b-b4dc-5dff-145c97cd68d6@cafu.de","subject":"Re: git status --> Out of memory, realloc failed","fromName":"René Scharfe","fromEmail":"l.s.r@web.de","sentAt":"2017-03-02T20:04:12Z","receivedAt":"2017-03-02T20:04:40Z","isPatch":false,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 01.03.2017 um 21:12 schrieb Carsten Fuchs:\n> Hi René,\n>\n> Am 01.03.2017 um 11:02 schrieb René Scharfe:\n>>> I use Git at a web hosting service, where my user account has a memory\n>>> limit of 768 MB:\n>>>\n>>> (uiserver):p7715773:~$ uname -a\n>>> Linux infongp-de15 3.14.0-ui16322-uiabi1-infong-amd64 #1 SMP Debian\n>>> 3.14.79-2~ui80+4 (2016-11-17) x86_64 GNU/Linux\n>>\n>> What's the output of \"ulimit -a\"?\n>\n> (uiserver):p7715773:~$ ulimit -a\n> core file size          (blocks, -c) 0\n> data seg size           (kbytes, -d) unlimited\n> scheduling priority             (-e) 1\n> file size               (blocks, -f) unlimited\n> pending signals                 (-i) 16382\n> max locked memory       (kbytes, -l) 64\n> max memory size         (kbytes, -m) unlimited\n> open files                      (-n) 512\n> pipe size            (512 bytes, -p) 8\n> POSIX message queues     (bytes, -q) 819200\n> real-time priority              (-r) 0\n> stack size              (kbytes, -s) 8192\n> cpu time               (seconds, -t) 1800\n> max user processes              (-u) 42\n> virtual memory          (kbytes, -v) 786432\n> file locks                      (-x) unlimited\n\nWhen I use ulimit -v with lower and lower numbers I can provoke mmap \nfailures on bigger pack files, but not the realloc failures that you're \nseeing.  And your packs should be only up to 20MB anyway (you can check \nthat with \"ls -l .git/objects/pack/*.pack\").\n\n>>> The repository is tracking about 19000 files which together take 260 MB.\n>>> The git server version is 2.7.4.1.g5468f9e (Bitbucket)\n>>\n>> Is your repository publicly accessible?\n>\n> Unfortunately, no. There are no big secrets in there, but just a couple\n> of database details so that I cannot make it universally available. I\n> can gladly give you access though. (E.g. by adding your public SSH key?)\n\nI'd rather not look at semi-confidential data, and you probably \nshouldn't hand it to a stranger on the internet anyway. ;)\n\nSo a shot in the dark: Do you have a lot of untracked files?  You could \ncheck by cloning your repository locally (which copies only tracked \ncontents).  Does \"git status\" work on the clone?\n\nAnother one, darker yet: Does \"git config core.preloadIndex 0\" help?\n\nRené\n"},{"id":"313235","messageId":"6cdb5c44-76ad-b38a-c9f2-46f8916cbe5a@cafu.de","threadId":"45223","inReplyTo":"CACsJy8B3Qy1mra_GwhbYdk5LFrgYx=6NRqq=wvw2_wcWCO_yNw@mail.gmail.com","subject":"Re: git status --> Out of memory, realloc failed","fromName":"Carsten Fuchs","fromEmail":"carsten.fuchs@cafu.de","sentAt":"2017-03-03T21:10:18Z","receivedAt":"2017-03-03T21:17:38Z","isPatch":false,"sender":{"key":"carsten.fuchs@cafu.de","avatar":"https://gravatar.com/avatar/bd0d6585c2cec9529584fc310bbcdee3ffd1f06f3fb88644fdb87fd880fc75a6?d=mp&s=160"},"body":"Hi Duy,\n\nAm 2017-03-02 um 10:31 schrieb Duy Nguyen:\n> You could also try \"git fast-export --anonymize\" (read the doc first).\n\nEventually this was not needed, but thanks for letting me know about it! \nI've not been aware of this feature beforehand, learned something.\n\nBest regards,\nCarsten\n\n"},{"id":"313238","messageId":"f0787f93-5bba-f79c-2211-1558b3886c09@cafu.de","threadId":"45223","inReplyTo":"6ba86c1a-87a9-f886-273b-7f94c30c4a95@web.de","subject":"Re: git status --> Out of memory, realloc failed","fromName":"Carsten Fuchs","fromEmail":"carsten.fuchs@cafu.de","sentAt":"2017-03-03T21:03:16Z","receivedAt":"2017-03-03T21:34:38Z","isPatch":false,"sender":{"key":"carsten.fuchs@cafu.de","avatar":"https://gravatar.com/avatar/bd0d6585c2cec9529584fc310bbcdee3ffd1f06f3fb88644fdb87fd880fc75a6?d=mp&s=160"},"body":"Hi René,\n\nAm 02.03.2017 um 21:04 schrieb René Scharfe:\n> When I use ulimit -v with lower and lower numbers I can provoke mmap failures on\n> bigger pack files, but not the realloc failures that you're seeing.  And your\n> packs should be only up to 20MB anyway (you can check that with \"ls -l\n> .git/objects/pack/*.pack\").\n\nYes, there are 9 of them, all about 20 MB in size.\n\n> So a shot in the dark: Do you have a lot of untracked files?  You could check by\n> cloning your repository locally (which copies only tracked contents).  Does \"git\n> status\" work on the clone?\n\nI had about 40 modified or untracked files with a combined file size of \nabout 5 MB.\n\nBefore I got your latest mail, I tried something else: Instead of \nconnecting to the system with the repository via SSH as usual, I \naccessed the repository by mounting its file system via gvfs-mount onto \nmy local desktop machine. Then I used my local, normally working Git to \ncommit all modified and some untracked files (and deleted those that \nwere left). Running `git status` and other commands took a very long \ntime over a network connection of only 6 MBit/s, but eventually I got \neverything committed and pushed.\n\nQuite in the spirit of your above words, getting rid of untracked files \nhelped: Logging normally via SSH into the remote machine again, `git \nstatus` ran normally.\n\nOnly then did I see your mail and got another clone, where `git status` \nworked equally well – but then `git diff` failed in a similar manner, \ncontinuing the problems of `git status`:\n\n(uiserver):p7715773:~/__TEST__$ git clone \nhttps://CarstenF@bitbucket.org/CarstenF/website-cafu.git\nCloning into 'website-cafu'...\nPassword for 'https://CarstenF@bitbucket.org':\nremote: Counting objects: 44359, done.\nremote: Compressing objects: 100% (28777/28777), done.\nremote: Total 44359 (delta 19201), reused 38661 (delta 14143)\nReceiving objects: 100% (44359/44359), 168.28 MiB | 20.95 MiB/s, done.\nResolving deltas: 100% (19201/19201), done.\nChecking connectivity... done.\nChecking out files: 100% (18524/18524), done.\n\n(uiserver):p7715773:~/__TEST__$ cd website-cafu/\n\n(uiserver):p7715773:~/__TEST__/website-cafu$ git status\nOn branch master\nYour branch is up-to-date with 'origin/master'.\nnothing to commit, working directory clean\n\n(uiserver):p7715773:~/__TEST__/website-cafu$ git diff\nfatal: unable to create threaded lstat\n\n(uiserver):p7715773:~/__TEST__/website-cafu$ git diff\nfatal: Out of memory, realloc failed\nfatal: Out of memory, realloc failed\nfatal: Out of memory, realloc failed\nfatal: recursion detected in die handler\n\n> Another one, darker yet: Does \"git config core.preloadIndex 0\" help?\n\nThat's it!  :-)\n\nOnce that was set, both `git status` and `git diff` worked normally again!\n\nI cannot test `git status` right now in the same situation as before, as \nI no longer have a working directory that is \"as dirty\" as before, but \nthe above setting seems to fix the problem promptly and thoroughly!\n\nMany thanks for your help!   :-)\n\nBest regards,\nCarsten\n"}]}