Kallithea issues archive

Issue #25: Non-empty git repositories appear to be empty

Reported by: Michael DePalatis
State: invalid
Created on: 2014-09-02 14:58
Updated on: 2014-09-21 14:36

Description

With git repositories, after I have pushed to the server, I frequently get an error message saying "There are no changesets yet" when clicking on Changelog using Firefox (both Windows and Linux).

It appears fairly consistent that if I press Changelog twice, I get the error message, then on the third time, it correctly shows the changelog. Pressing it once more repeats from the beginning showing the error message. The Summary view also frequently makes it look as if it were an empty repository. Clicking on the Files view results in 404 errors sometimes, unless I refresh.

Unfortunately, I don't seem to see anything useful in the log output. Pershaps this is a problem with how I've configured the logging. I am running Kallithea via uwsgi. Here is my relevant uwsgi section of the ini file:

[uwsgi]
master = true
socket = /tmp/kallithea.sock
pidfile = /tmp/kallithea.pid
daemonize = /var/log/kallithea.log
http = :5001
processes = 4
virtualenv = /home/iontrap/kallithea

I have left the logger sections untouched from the default configuration. Maybe some change there would enable proper output to help diagnose the source of this problem?

Attachments

Comments

Comment by domruf, on 2014-09-02 19:42

http://kallithea.readthedocs.org/en/latest/usage/performance.html says

"each instance needs it’s own .ini file and unique instance_id set in them"

to me that sounds like you can't use uwsgi with multiple processes

Comment by Mads Kiilerich, on 2014-09-02 22:58

So Kallithea doesn't notice the repo changed after someone pushed. There is a "install git hook" option under admin. Have you used that?

Comment by Mads Kiilerich, on 2014-09-02 23:04

Re instance_id: It can be set to '*' to assign it randomly. That do however mean that you should run paster cache-keys my.ini --cleanup regularly to avoid filling up the database.

I have refactored this instance-id system so I kind of understand what it is doing. I'm quite sure it pretty much just can be removed and replaced with something simpler.

Comment by Michael DePalatis, on 2014-09-03 07:39

@domruf I switched to using 1 process and at least so far that appears to have solved the problem. There was no real reason for 4 processes, other than example uwsgi configuration files I was using did that (though for other applications).

Any idea why this would have only affected git and not Mercurial repos?

Comment by domruf, on 2014-09-03 14:42

@kiilerix is the expert here :-)

Comment by Mads Kiilerich, on 2014-09-03 15:02

/me repeats question: There is a "install git hook" option under admin. Have you used that?

Comment by Michael DePalatis, on 2014-09-03 15:10

The option under "Remap and rescan"? If I check that and rescan, all I see is

Repositories successfully rescanned added: - ; removed: - 

Again, no useful output in the server log. I'm also not completely clear on what this is supposed to be doing in the first place.

Comment by Mads Kiilerich, on 2014-09-03 16:33

There should be hooks in place to update/expire Kallithea caches. Mercurial hooks pretty much just works. Git hooks are more tricky. Some digging around kallithea/lib/hooks.py might help figuring out what is going on.

The hook should pretty much do the same as paster update-repoinfo my.ini --update-only=my/repo --invalidate-cache you can perhaps try running it manually.

Does the same thing happen for git repos created from Kallithea and for 'scanned' repos?

Comment by Michael DePalatis, on 2014-09-03 18:28

digging around kallithea/lib/hooks.py might help figuring out what is going on.

Thanks for the pointer. I'll look into it a bit more later this week.

Does the same thing happen for git repos created from Kallithea and for 'scanned' repos?

I only have Kallithea-created git repos at the moment.

Comment by Mads Kiilerich, on 2014-09-18 15:54

Did you figure out exactly what was and wasn't the issue here?

Comment by Michael DePalatis, on 2014-09-21 11:58

Other than switching to use 1 process with uwsgi, no. Looking at the handle_git_receive function in kallithea/lib/hooks.py indicates that it executes a subprocess to do what it does, so that probably has something to do with it. This looks to be happening on lines 451, 457, and 465 with calls to repo.run_git_command. It would probably make more sense to use something like dulwich to read the repository rather than spawning subprocesses to run git commands.

Comment by Mads Kiilerich, on 2014-09-21 12:17

Sure, pure dulwich would be better ... if it can do it. I assume there is a reason it is the way it is.

But I doubt the callout to git is related to your issue.

How is your instance_id configured?

Comment by Michael DePalatis, on 2014-09-21 14:23

I don't have instance_id set in the ini file.

Comment by Mads Kiilerich, on 2014-09-21 14:35

The ini file template and http://kallithea.readthedocs.org/en/latest/usage/performance.html says that it must be set uniquely if you run multiple instances - as you do. What you see is pretty much what you can expect with the configuration you have. Not a bug but incorrect configuration.

The documentation could however be improved ... and we could reimplement this part of the system so it was less annoying. Contributions would be appreciated.

Comment by Mads Kiilerich, on 2014-09-21 14:36