{"thread":{"id":"21025","subject":"gitk management of git diff-tree processes","startedAt":"2009-09-22T15:10:04Z","lastAt":"2009-09-23T16:05:59Z","messageCount":2,"participants":["David Holmer"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"123636","messageId":"1253632204.8531.78.camel@blackbird","threadId":"21025","inReplyTo":null,"subject":"gitk management of git diff-tree processes","fromName":"David Holmer","fromEmail":"dholmer@persistentsystems.com","sentAt":"2009-09-22T15:10:04Z","receivedAt":"2009-09-22T15:10:04Z","isPatch":false,"sender":{"key":"dholmer@persistentsystems.com","avatar":null},"body":"I find that if I am in gitk browsing through commits, gitk seems to be\nspawning a git diff-tree process in order to display the changes and\npatch file list in the bottom panes.\n\nI have a certain commit that adds a very large amount of data to my\nrepository (1.2 GB). Understandably, the git diff-tree process that\ntries to display the changes in this commit takes a VERY long time to\nrun (e.g. churns indefinitely).\n\nThe issue is that I find that if I simply browse past this commit (e.g.\nusing up/down arrows), gitk starts up a git diff-tree process and leaves\nit running. As many times as I pass the commit (e.g. while looking at\nchanges before and after this commit), I end up with multiple processes\nall running and my CPUs quickly go to 100%. Furthermore, even if I exit\ngitk, all the git diff-tree processes keep running unless I manually\nkill them.\n\nPerhaps gitk could kill the git diff-tree process it spawns if its\noutput is no longer needed (e.g. user browses to a different commit, or\ngitk exits).\n\nThank you,\nDavid\n\n$ ps -aF\nUID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD\ndavid    23635     1 18 88365 102892  0 10:49 pts/1    00:01:11 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23640     1 18 88368 102908  1 10:49 pts/1    00:01:10 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23644     1 16 88368 102904  0 10:49 pts/1    00:01:04 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23646     1 16 88367 102916  0 10:49 pts/1    00:01:04 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23652     1 17 88365 102892  1 10:49 pts/1    00:01:07 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23656     1 17 88368 102920  1 10:49 pts/1    00:01:06 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23660     1 16 88369 102932  0 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23664     1 16 88368 102908  0 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23670     1 16 88368 102904  1 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23680     1 17 88365 102896  1 10:49 pts/1    00:01:05 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\ndavid    23851 10444  0   692  1032   0 10:56 pts/1    00:00:00 ps -aF\n\n$ git version\ngit version 1.6.4.4\n\n-- \nDavid G. Holmer, Ph.D.\ndholmer@persistentsystems.com\nCTO and Co-Founder\nPersistent Systems, LLC\nwww.persistentsystems.com\nOffice: 212-561-5895\nMobile: 650-533-4964\nFax: 212-202-3625\n"},{"id":"123675","messageId":"1253721959.8531.112.camel@blackbird","threadId":"21025","inReplyTo":"1253632204.8531.78.camel@blackbird","subject":"Re: gitk management of git diff-tree processes","fromName":"David Holmer","fromEmail":"dholmer@persistentsystems.com","sentAt":"2009-09-23T16:05:59Z","receivedAt":"2009-09-23T16:05:59Z","isPatch":false,"sender":{"key":"dholmer@persistentsystems.com","avatar":null},"body":"On Tue, 2009-09-22 at 11:10 -0400, David Holmer wrote: \n> I find that if I am in gitk browsing through commits, gitk seems to be\n> spawning a git diff-tree process in order to display the changes and\n> patch file list in the bottom panes.\n> \n> I have a certain commit that adds a very large amount of data to my\n> repository (1.2 GB). Understandably, the git diff-tree process that\n> tries to display the changes in this commit takes a VERY long time to\n> run (e.g. churns indefinitely).\n> \n> The issue is that I find that if I simply browse past this commit (e.g.\n> using up/down arrows), gitk starts up a git diff-tree process and leaves\n> it running. As many times as I pass the commit (e.g. while looking at\n> changes before and after this commit), I end up with multiple processes\n> all running and my CPUs quickly go to 100%. Furthermore, even if I exit\n> gitk, all the git diff-tree processes keep running unless I manually\n> kill them.\n> \n> Perhaps gitk could kill the git diff-tree process it spawns if its\n> output is no longer needed (e.g. user browses to a different commit, or\n> gitk exits).\n> \n> Thank you,\n> David\n> \n> $ ps -aF\n> UID        PID  PPID  C    SZ   RSS PSR STIME TTY          TIME CMD\n> david    23635     1 18 88365 102892  0 10:49 pts/1    00:01:11 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23640     1 18 88368 102908  1 10:49 pts/1    00:01:10 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23644     1 16 88368 102904  0 10:49 pts/1    00:01:04 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23646     1 16 88367 102916  0 10:49 pts/1    00:01:04 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23652     1 17 88365 102892  1 10:49 pts/1    00:01:07 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23656     1 17 88368 102920  1 10:49 pts/1    00:01:06 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23660     1 16 88369 102932  0 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23664     1 16 88368 102908  0 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23670     1 16 88368 102904  1 10:49 pts/1    00:01:03 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23680     1 17 88365 102896  1 10:49 pts/1    00:01:05 git diff-tree -r -p --textconv -C --cc --no-commit-id -U3 8df50645c4cadf26dc951540e0c713b0826247b8\n> david    23851 10444  0   692  1032   0 10:56 pts/1    00:00:00 ps -aF\n> \n> $ git version\n> git version 1.6.4.4\n> \n\nLooking at the code of gitk, I believe the git diff-tree process is\nspawned by proc getblobdiffs (gitk-git/gitk:7322). It sets up a command\nthat matches all the arguments I see in the above ps -aF listing\n(gitk-git/gitk:7335):\n\nset cmd [diffcmd $ids \"-p $textconv -C --cc --no-commit-id -U\n$diffcontext\"]\n\nIt then seems to setup this command to be run and the output processed\nvia proc filerun (gitk-git/gitk:7352):\n\nfilerun $bdf [list getblobdiffline $bdf $diffids]\n\nI am not very familiar with TCL. Is there a standard/correct way to\npre-maturely halt this filerun processing? It seems to use the fileevent\nto know when there is more data to process.\n\nA Google search turned up a way to get the PID from $bfd and said that\non unix systems you could run a kill, but that TCL had no built in kill\nmechanism. This seems a bit hackish/non-cross platform. Is there a\nbetter mechanism? Would something like closing the file descriptor cause\nthe filerun processing to finish and the git diff-tree to terminate with\na broken pipe?\n\nThank you,\nDavid\n\n-- \nDavid G. Holmer, Ph.D.\ndholmer@persistentsystems.com\nCTO and Co-Founder\nPersistent Systems, LLC\nwww.persistentsystems.com\nOffice: 212-561-5895\nMobile: 650-533-4964\nFax: 212-202-3625\n"}]}