Open tsdh opened 1 week ago
I'm in need of a break but will try to look at this (probably late) next week.
Hey Jonas, no problem at all. Take as much time as you need.
Oh, I found the culprit myself in a new debugging session! It's actually in ghub
and not forge
. I added a small fix locally right at the start of the ghub--handle-response
function which makes pulling work for me and our company's GitLab server. But as stated in the FIXME comment, I'm not sure why that has ever worked...
(cl-defun ghub--handle-response (status req &optional (buffer nil sbuf))
;; FIXME START: status being nil won't set buf and will make
;; ghub--handle-response-error assume that a timeout has happened.
;;
;; ghub--handle-response is used as callback function of url-retrieve. Its
;; docstring states that the first arg STATUS is a plist with :redirect and
;; :error keys or an empty list, if no events have occured which means the
;; request worked normally, e.g. no error and no redirects. That has been
;; the case since at least Emacs 27, so I don't understand how this code has
;; ever worked. Maybe there is always a :redirect with https connections (my
;; companies GitLab is accessed with plain http because it's only reachable
;; interally)? Who knows...
(unless status
(setq status '(:status 200))) ;; Anything non-nil will do.
;; FIXME END
...
I don't understand how this code has ever worked
Before the misguided but fairly recent https://github.com/magit/ghub/commit/03d7161cadabce8e371a98f30edf4ad092a72bbd, it didn't do some of the things you are describing.
What was good about that commit is that it tries to gracefully handle (well at least signal) a timeout (and correctly assumes that url.el
fails to properly document how callers are informed about timeouts). However "status = nil => timeout" was clearly the wrong conclusion. "return value = nil => timeout" appears to be the correct way to detect it.
To minimize the risk of another broken "fix", I'll take a few days for this.
I cannot add my self-hosted GitLab repository using Forge. The request keeps pending and slows down Emacs. It seems to be related to this issue.
@LuciusChen Do you also get tons of http buffers? If so, that's probably the same issue. You can check by typing C-x b
, then entering a space (the buffers are "hidden"), an asterisk, http
, and then TAB to get a list of completions.
@LuciusChen Do you also get tons of http buffers? If so, that's probably the same issue. You can check by typing
C-x b
, then entering a space (the buffers are "hidden"), an asterisk,http
, and then TAB to get a list of completions.
Whenever I add multiple self-hosted GitLab repositories, there are multiple HTTP requests ongoing. When the number reaches a certain level, Emacs becomes very slow and laggy.
@LuciusChen Alright, then it's probably the same issue.
I'm trying to get Forge working with our company's GitLab instance but fail. That instance uses only http, not https, so I've added the relevant entries to
ghub-insecure-hosts
.Now when I open a Magit status buffer for a project hosted there and do
' f f a
to pull all topics, I see the mode line shows"Pulling group/project"
but nothing seems to happen. Except that Emacs seems to get slower after some time.By accident I discovered that I have more than 5000 buffers named
*http srv-upsource.shd.lan*
. Well, that's the name of the first and the others have a-N
suffix with N being an integer. It seems that I get about 5-10 more such buffers every second. They all have the same contents except for the timestamps, e.g., the JSON is always the same. Buffer contents of*http srv-upsource.shd.lan*-127110
I edebugged
url-retrieve
to get a backtrace:The problem seems to be that the
&optional v
arg of the callbackcb
lambda inforge--pull
for gitlab is alwaysnil
. Which in turn seems to be because the:callback
lambda inforge--fetch-repository
doesn't assign tovalue
because neither does(oref repo selective-p)
hold nor(magit-get-boolean "forge.omitExpensive")
andvalue
is and staysnil
. Therefore, we callforge--fetch-repository
over and over again.I've tried adding a default case to the
cond
which setsvalue
to(t)
. It seems like forge then goes on fetching assignees, forks, and labels but not issues and pull-requests... Hm, I guess instead oft
the alist representation of the JSON in*http srv-upsource.shd.lan*-127110
buffer should be added tovalue
. But how?I use an up-to-date Emacs from the master branch and the current MELPA versions of all magit-related packages: