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
"Git is already running" on Windows #487
Comments
I'm having this problem all the times on Windows 7 at home (i7 processor, 8G RAM), but never had it on Windows XP at work (old computer with 1G RAM). The problem is that the previous git process is still alive, and I have to kill the process manually each time I got into this problem. |
Is this still an issue? If so do you have any insight into why that might be so? |
I used to have the exact same problem but when I updated via elpa yesterday, it worked like a charm. |
I don't think this problem is Windows specific. This happens when git gets killed at the wrong time for whatever reason. This could be a Regardless we need to make sure that magit does not get in a state were it refuses to call git because it thinks that is still running. Pull request #676 seems to address this, but unfortunately I did not find the time to inspect it yet. |
This may also not be related to magit because when this problem start occuring, if I just kill magit-process buffer and continue working, it will fail to detect git was killed nearly every time I use a magit command. And from that moment, emacs itself will be a bit lagging (cursor movement will not be as smooth as normal) and gnus will also become slow. It may just be a bug in emacs on windows. |
But it happens on Mac, too Sent from my moss-covered three-handled family gradunza On Jul 11, 2013, at 6:32 PM, razcampagne notifications@github.com wrote:
|
I have fixed this with 5633708. |
FYI, I'm still getting this problem with magit version 20130724.1937. Not positive if that's the latest one, but it seems to be more recent than the last comment on this issue... Also, the previously mentioned workaround of killing the git-process buffer doesn't work. For me that just causes magit to get well and stuck. It still says that "Git is already running" on every command, and in addition if I try and see the git-process buffer with "$" then it says "No Git commands have run." Edit: It appears that killing the git-process buffer via kill-buffer doesn't actually end the git process. Doing that manually by executing kill-process did the trick of restoring magit to working status. I'm on Windows 7 64-bit, with emacs 24.3.1. |
This is definitely a HUGE problem with Windows 7 64 bits, but not a problem with Windows XP. I have been suffering from this for at least a year and am pretty sure that this a a problem with Emacs running on Windows 7 64 bits because not only does Magit has the issue but also the "compile" has exactly the same issue when compiling a C++ project. I have been using mwolson's patch for several months now and it had helped tremendously. Previously both "compile" and Magit gave me the headache but now only the "compile" is giving me headache. Mwolson's patch is something I can't live without and thank you very much mwsolson. Whenever the problem shows up, it is exactly as what razcampagne had mentioned, "cursor movement will not be as smooth as normal". I haven't tried "5633708" yet but I'm wondering whether "5633708" had killed the git process which is the most important. If the git process is not killed the "fix" might just mask the symptom without addressing the root cause. This problem becomes really bad if you are using the `speck-mode' as well. |
Hi mwolson, Your patch worked pretty well for me in the past a few months. Recently I pulled the latest magit and it looks like they have changed a lot making it a bit harder to merge your fixes. For this reason I have temporarily dropped you patch and switched back to the latest magit. Unfortunately I'm having the "git was already runing" problem all the time again. It is really unfortunate that "they" didn't want to merge you fixes. I would appreciate it if you could take some time to merge your fixes into the latest magit. Thanks in advance |
Apparently github doesn't understand what "This might, or might not, fix #487." means :-) |
The relevant paragraph from 83fb910 reads:
I actually have only little hope that this fixes anything related to this issue. I have before suggested setting On the other hand I have made quite a few changes to the process handling, so maybe I have fixed this issue by chance. However it is more likely that it just appears like I did: Magit now supports multiple parallel processes, so if the issue actually is that some process never finishes (which I am guessing is the issue) that will no longer prevent new process from being started. That's an improvement I suppose, but it would still be nice to know whether that is the issue and why that happens. While refactoring the process code I came across some dubious code in ;; Find last ^M in string. If one was found, ignore everything
;; before it and delete the current line.
(let ((ret-pos (length string)))
(while (and (>= (setq ret-pos (1- ret-pos)) 0)
(/= ?\r (aref string ret-pos))))
(cond ((>= ret-pos 0)
(goto-char (line-beginning-position))
(delete-region (point) (line-end-position))
(insert-and-inherit (substring string (+ ret-pos 1))))
(t
(insert-and-inherit string)))) That was added five years ago in d1f0df3 and makes sure we see:
instead of
But due to differences in eol encoding between Windows (CR+LF) on one side and pretty much every other popular contemporary OS (LF) that could be the problem. The above code filters CR. See http://en.wikipedia.org/wiki/Newline. Could you please open the |
No I don't (Edit: ah you weren't asking me, well I don't know :-). One problem so far was insufficient maintainer-affected_user alignment, e.g. by the time some maintainer was ready to look into this issue, the affected user had given up :-/ In other words I was never able to get any reliable information, but that is partly my fault. So let's hope you run into this problem, giving us another change to finally fix this :-) |
Well, I was sort of directing the question to @YorkZ, but of course anyone who has some insight into this could answer... I found this mentioned in
This wouldn't be specific to Windows 7 64bit, but perhaps that isn't the relevant difference: it may affect those machines only because they are newer with newer and more aggressive anti virus software installed. |
@npostavs: how long have you been using Magit in Windows box? I think you might But running emacs.exe from msysGit bash doesn't fix the problem, it still With regard to Antivirus, I guess that might make the issue worse. I have @tarsius: thank you very much for your effort to address this issue, York |
But there's no specific thing that triggers it? eg: it happens more often during pushing or something like that? I haven't been using it too long on this machine, but no problems so far. I'm just a bit worried that my usage pattern will be a bit different from yours, and somehow I won't hit the bug.
Yes, exactly like that. |
@npostavs: The problem happened frequently after committing, rebasing and some |
As per #487 (comment), please try this patch: diff --git a/magit.el b/magit.el
index 8f73e56..30d4a09 100644
--- a/magit.el
+++ b/magit.el
@@ -3311,17 +3311,7 @@ repository are reverted using `auto-revert-buffers'."
(setq string (propertize string 'invisible
(magit-section-hidden
(process-get proc 'section))))
- ;; Find last ^M in string. If one was found, ignore everything
- ;; before it and delete the current line.
- (let ((ret-pos (length string)))
- (while (and (>= (setq ret-pos (1- ret-pos)) 0)
- (/= ?\r (aref string ret-pos))))
- (cond ((>= ret-pos 0)
- (goto-char (line-beginning-position))
- (delete-region (point) (line-end-position))
- (insert-and-inherit (substring string (+ ret-pos 1))))
- (t
- (insert-and-inherit string))))
+ (insert-and-inherit string)
(set-marker (process-mark proc) (point)))))
(defun magit-process-logfile-filter (process string) ... and report whether that makes these errors go away on Windows. I might apply this patch even if it doesn't help, because even on systems that use LF for newlines a file might actually contain CR (for some other reason) and the above code would corrupt that. Having a long list of |
@tarsius: Just tried the above patch and it didn't help with staging individual hunks. |
Back to the origin problem, the problem just hitted me right now. First, here is
Then goes the contents of "magit-process" buffer (the prefix "0" are
Hope this helps. |
And on second thought, it wouldn't make much sense if it did. The patch affects output from git. And for a valid patch not to apply git's input would have to be somehow corrupted. But generally I think we are on the right track looking at encodings of line endings. Please experiment with While eol problems might explain why a patch doesn't apply, it seems strange that such problems would keep git processes from ever finishing, as appears to be the case. |
Also |
The git not finishing part is probably this issue (I haven't managed to reproduce that), but the patch not applying is something else, it happens on linux too, see #1139 (comment). |
I fixed the newline problem by using the |
I don't think this issue had ever been addressed. I'm still suffering from it every day, no exception. |
There can't be any progress on this until we figure out what about your setup causes it. Although it's probably not really a magit issue since you said:
|
I'm pretty sure the root cause of this problem is in NTEmacs itself, because Magit is not the only one that suffers this issue. However, Magit is the one that suffers the most, and I'm sure it can be improved because pull request #622 used to work pretty well for me. The problem is that pull request is no longer compatible with the current Magit and I don't want to fall back to old Magit either because the current Magit really has huge improvement. I'm wondering if pull request #622 can be considered more seriously to make our life easier. And I don't think this issue is specific to my setup because obviously I'm not the only person who suffers from this. If you use NTEmacs on Windows 7 I'm sure you will easily run into this issue. |
There were a few other reports, so it's less specific than your particular setup, but NTEmacs Windows 7 64 bit isn't specific enough because I have that too and it doesn't happen to me. Also, I searched for previous reports about Emacs subprocesses hanging and the only thing I turned up is the anti virus thing. |
@tarsius: I have pulled the latest change, and will report back. Thank you. @tarsius and npostavs: One thing I think I had mention before, which I believe is the single most important factor, is that I'm using speck.el for spell checking. This program uses idle timer and I suspect that anything utilizing idle timer would make the issue much worse. For this reason, may I suggest that you try out speck.el (with Windows 7)? This program by itself is an excellent spell checking program, much faster (and usable) than flyspell. |
I'm still having exactly the same issue. Is it possible to use |
Tramp integration need start-process. I believe a lot of us don't want to loose it. |
So does staging and committing, even locally. And then a few things that are not quite as essential. So no, we cannot make everything synchronous. |
Most commands appear to get "stuck" in this state. I can `$' and then kill the buffer without even a prompt. Very strange.
The text was updated successfully, but these errors were encountered: