After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 748974 - gitg crashes on startup in gitg_lanes_next
gitg crashes on startup in gitg_lanes_next
Status: RESOLVED FIXED
Product: gitg
Classification: Applications
Component: gitg
3.16.x
Other Linux
: Normal critical
: ---
Assigned To: gitg-maint
gitg-maint
Depends on:
Blocks:
 
 
Reported: 2015-05-05 18:53 UTC by pedrum
Modified: 2016-04-26 17:33 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Backtrace of crash (566 bytes, text/plain)
2015-07-23 11:47 UTC, nathanaelg
Details

Description pedrum 2015-05-05 18:53:52 UTC
gitg crashes on startup for one of my repos, but seems to work on some other ones. Git log and gitk load and run fine on the problem repo.

I'm running gitg 3.16.1 on Arch.

Here's backtrace.

  • #0 gitg_lanes_next
    from /usr/lib/libgitg-1.0.so.0
  • #0 gitg_lanes_next
    from /usr/lib/libgitg-1.0.so.0
  • #1 ??
    from /usr/lib/libgitg-1.0.so.0
  • #2 ??
    from /usr/lib/libglib-2.0.so.0
  • #3 start_thread
    from /usr/lib/libpthread.so.0
  • #4 clone
    from /usr/lib/libc.so.6

I didn't attach the dump as it was large (~> 13MB), and may contain sensitive information. Since it's easily reproducible, I can assist with further debugging if necessary.
Comment 1 nathanaelg 2015-07-23 11:45:59 UTC
I also am affected by this bug with a practically identical backtrace to the segmentation fault on opening a repository.
Comment 2 nathanaelg 2015-07-23 11:47:06 UTC
Created attachment 307983 [details]
Backtrace of crash
Comment 3 jessevdk@gmail.com 2015-07-31 17:00:26 UTC
Is any of your repositories that you are able to reproduce this on available publicly? If not, it would be great if you could install debug symbols for gitg (or compile with debug symbols from source) so that we can obtain a better stack trace.
Comment 4 pedrum 2015-07-31 23:47:26 UTC
This happens on private work repo, so I can't share that.

I built gitg-3.16.1 (via AUR on Arch) and disabled stripping the build. I hope this helps.


  • #0 gitg_lanes_collapse_lane
    at /home/pedrum/gitg/src/gitg-3.16.1/libgitg/gitg-lanes.vala line 338
  • #0 gitg_lanes_collapse_lane
    at /home/pedrum/gitg/src/gitg-3.16.1/libgitg/gitg-lanes.vala line 338
  • #1 gitg_lanes_collapse_lanes
    at /home/pedrum/gitg/src/gitg-3.16.1/libgitg/gitg-lanes.vala line 382
  • #2 gitg_lanes_next
    at /home/pedrum/gitg/src/gitg-3.16.1/libgitg/gitg-lanes.vala line 166
  • #3 __lambda32_
    at /home/pedrum/gitg/src/gitg-3.16.1/libgitg/gitg-commit-model.vala line 387
  • #4 ___lambda32__gthread_func
    at gitg-commit-model.c line 2211
  • #5 ??
    from /usr/lib/libglib-2.0.so.0
  • #6 start_thread
    from /usr/lib/libpthread.so.0
  • #7 clone
    from /usr/lib/libc.so.6


(gdb) p newindex 
$1 = 0
(gdb) p lane.from.date
Cannot access memory at address 0x28
Comment 5 pedrum 2015-07-31 23:50:41 UTC
This might be more relevant.

(gdb) p lane
$1 = (GitgLane *) 0x0
Comment 6 jessevdk@gmail.com 2015-08-01 11:04:26 UTC
Cool, this helps. But would still need a repro repo to investigate this. Since this issue should only rely on the particular parent structure of your repo, could you maybe try the following to recreate a repo with the same commit hierarchy, but without any sensitive data and attach it to the issue.

IMPORTANT!!!!: doing the following will completely destroy your local copy of the original repo, so please do this on a throwaway COPY ONLY at your own risk!!!



BRANCH=master

# Rewrite history of $BRANCH to remove all content and author/committer information
git filter-branch --index-filter 'git rm --cached -r -q *' --commit-filter 'GIT_AUTHOR_NAME="Author"; GIT_AUTHOR_EMAIL="author@test.org"; GIT_COMMITTER_NAME="Committer"; GIT_COMMITTER_EMAIL="committer@test.org"; git commit-tree "$@" -m "Test commit"' $BRANCH

# Remove the backup
git update-ref -d refs/original/refs/heads/master

# Remove all remotes
for remote in $(git remote)
do
    git remote remove "$remote";
done

# Remove all branches and tags
for ref in $(git for-each-ref refs/heads refs/tags --format='%(refname)')
do
    [ "$ref" != "refs/heads/$BRANCH" ] && git update-ref -d "$ref"
done

# Remove all logs
rm -rf .git/logs

# Remove all hooks
rm -rf .git/hooks/*

# Prune the repository
git gc --force --aggressive --prune=all




If the crash happens when viewing a different branch in gitg, please replace master with that branch. Also, please verify if the crash still happens on the rewritten repo.

To verify that your rewritten repo doesn't contain any commits that were missed:


find .git/objects/pack -name 'pack-*.idx' | while read p ; do     git show-index < $p | cut -f 2 -d ' '; done | xargs git show


This should only show empty rewritten commits without any sensitive data. Please check .git/config for sensitive data manually before attaching the repo here.
Comment 7 pedrum 2015-08-04 01:18:28 UTC
I tried the above script and it leaves me with content in my repo in form of diffable items (e.g git diff master^1) and large packfile in .git/objects/ directory. Any way to scrub those?
Comment 8 jessevdk@gmail.com 2015-08-04 15:43:50 UTC
Not sure what happened without having more info. Did the script perform all the steps successfully? I tried this on a repo of mine (https://github.com/jessevdk/go-flags) and it seemed to work as expected.
Comment 9 pedrum 2015-08-05 01:27:47 UTC
Ok, not sure what I did different but re-ran the commands and I *do* have a repro that occurs at gitg shutdown (used to happen at startup).

However, there's a large pack file within .git/objects/ (~1.2 G) and leftover stuff on disk in .git {/refs/heads/,ref/remotes). Any way to clear those out before I send over?

Also, would it be acceptable to send to your email address rather than as attachment to a world viewable ticket (for privacy reasons).
Comment 10 jessevdk@gmail.com 2015-08-05 06:13:13 UTC
That doesn't sound right, I just ran this on gitg and in the end I don't have any branches other than master, no remotes, and I have a pack file of 100kb. I guess the script isn't working for you as intended, but without more information I don't know what could be going wrong. If the history rewriting worked, then maybe you can try to just do some manual steps to clean up (check if you still have remotes and remove them, check if you still have branches and remove them, run git gc --aggressive --prune=all) and see if that helps. If you manage, sending it by e-mail is fine by me.
Comment 11 pedrum 2015-08-06 00:18:59 UTC
I was able to trim the extra pack content (using the BFG tool) and manually removed branches. 

It's still large (~13MB), and this appears to be all metadata AFAICT. I've sent this to your gmail account.

The crash occurs reliably for me by opening gitg in this repo, waiting a couple secs, and exiting the gitg applications.
Comment 12 jessevdk@gmail.com 2015-08-06 06:52:45 UTC
I managed to locate and fix the issue of crashing on closing, but I'm not sure it also fixes your original issue. Are you able to build gitg from git? If so, could you please try with latest master and see if the problem is fixed?
Comment 13 pedrum 2015-08-06 20:55:37 UTC
I tried to build gitg from master, but getting stuck in make of gitg.

I was able to build libgit2-glib and libgit2 to match the version requirements (with some minor pkg-config override) and by running g-ir-scanner command manually.

I'm not familiar with codebase or vala to continue further. If you want to throw over a statically built version, I could give that a try.

Here's a snippet of build failure in gitg. I'm assuming this had something to do with g-ir-scanner output (goject introspection?) stuff.

libgitg/gitg-stage-status-enumerator.vala:240.4-240.35: error: The name `snapshot' does not exist in the context of `Ggit.Config'
			repository.get_config().snapshot().match_foreach(s_ignore_regex, (match, val) => {
			^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libgitg/gitg-stage-status-enumerator.vala:151.14-151.44: error: The name `get_submodule_status' does not exist in the context of `Ggit.Repository'
			d_flags = repository.get_submodule_status(submodule.get_name(),
			          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
Comment 14 jessevdk@gmail.com 2015-08-08 07:38:57 UTC
This means you don't have the correct version of libgit2-glib. For current master of gitg, you also need current master of libgit2-glib.
Comment 15 pedrum 2015-08-12 01:44:10 UTC
Jesse,

I took another look at compiling gitg from master and hit the same issues. I checked out libgit2 and libgit2-glib from git repo (master branch). I got them to compile, but still getting stuck at the valac step for gitg itself. 

I can't seem to point it to my compiled copies. It seems to try to use system libs, even though I used the PKG_CONFIG_PATH to override to my lib build locations.

PKG_CONFIG_PATH=../../libgit2/lib/pkgconfig/:../../libgit2-glib/lib/pkgconfig/:$PKG_CONFIG_PATH  ./configure  --prefix=/home/pedrum/src/gitg.master


/usr/bin/valac --pkg ggit-1.0 --pkg gtk+-3.0 --pkg gio-2.0 --pkg libsoup-2.4 --pkg webkit2gtk-4.0 --pkg gee-0.8 --pkg json-glib-1.0 --pkg libsecret-1 --pkg gio-unix-2.0 --pkg gitg-js-utils --pkg gdesktop-enums-3.0 --target-glib 2.38 -g --vapidir ./vapi --includedir libgitg --basedir . --gir Gitg_in-1.0.gir --vapi libgitg/libgitg-1.0.vapi --library libgitg/libgitg-1.0 --header libgitg/libgitg.h --gresources "./libgitg/resources/resources.xml"  -C libgitg/gitg-assembly-info.vala libgitg/gitg-async.vala libgitg/gitg-authentication-dialog.vala libgitg/gitg-avatar-cache.vala libgitg/gitg-branch-base.vala libgitg/gitg-branch.vala libgitg/gitg-cell-renderer-lanes.vala libgitg/gitg-color.vala libgitg/gitg-commit-list-view.vala libgitg/gitg-commit-model.vala libgitg/gitg-commit.vala libgitg/gitg-credentials-manager.vala libgitg/gitg-date.vala libgitg/gitg-diff-stat.vala libgitg/gitg-diff-view-options.vala libgitg/gitg-diff-view-request-diff.vala libgitg/gitg-diff-view-request-icon.vala libgitg/gitg-diff-view-request-resource.vala libgitg/gitg-diff-view-request.vala libgitg/gitg-diff-view.vala libgitg/gitg-hook.vala libgitg/gitg-init.vala libgitg/gitg-label-renderer.vala libgitg/gitg-lane.vala libgitg/gitg-lanes.vala libgitg/gitg-progress-bin.vala libgitg/gitg-ref-base.vala libgitg/gitg-ref.vala libgitg/gitg-remote.vala libgitg/gitg-remote-notification.vala libgitg/gitg-repository-list-box.vala libgitg/gitg-repository.vala libgitg/gitg-sidebar.vala libgitg/gitg-stage-status-enumerator.vala libgitg/gitg-stage.vala libgitg/gitg-utils.vala libgitg/gitg-when-mapped.vala
mv -f libgitg_libgitg_1_0_la_vala.stamp-t libgitg_libgitg_1_0_la_vala.stamp
make[3]: Leaving directory '/home/pedrum/src/gitg.master/src/gitg.git'

...

  VALAC    libgitg_libgitg_1_0_la_vala.stamp
libgitg/gitg-stage-status-enumerator.vala:240.4-240.35: error: The name `snapshot' does not exist in the context of `Ggit.Config'
			repository.get_config().snapshot().match_foreach(s_ignore_regex, (match, val) => {
			^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
libgitg/gitg-stage-status-enumerator.vala:151.14-151.44: error: The name `get_submodule_status' does not exist in the context of `Ggit.Repository'
			d_flags = repository.get_submodule_status(submodule.get_name(),


Here's the paths to the master builds of those two libs... 

PKG_CONFIG_PATH=../../libgit2/lib/pkgconfig/:../../libgit2-glib/lib/pkgconfig/:$PKG_CONFIG_PATH  pkg-config --libs libgit2

-L/home/pedrum/src/gitg.master/libgit2/lib -lgit2 

PKG_CONFIG_PATH=../../libgit2/lib/pkgconfig/:../../libgit2-glib/lib/pkgconfig/:$PKG_CONFIG_PATH  pkg-config --libs libgit2-glib-1.0

-L/home/pedrum/src/gitg.master/libgit2/lib -L/home/pedrum/src/gitg.master/libgit2-glib/lib -lgit2-glib-1.0 -lgit2 -lgio-2.0 -lgirepository-1.0 -lgobject-2.0 -lglib-2.0
Comment 16 Amit Mendapara 2015-09-03 09:31:55 UTC
I am having exactly the same issue on my Arch linux based system since last few versions for gitg. Right now I am using gitg 3.17.1.

I can't share my repository but I think it happens when you create branches from old revisions do some rebase and merge on another branches and then try to switch to a different branch from gitg ui (just click on a branch in branches list) causing segfault.

I'll try to prepare a sample repository.
Comment 17 donny 2015-09-23 20:57:48 UTC
I also have branches (not master) in one repository that crashes on gitg_lanes_next.

I made gitg not to crash by changing .git/config 

from

(...)
[gitg]
        mainline = refs/heads/master

to

(...)
[gitg]
        mainline = ""


I can't send a repo now because I don't know how to get rid of sensitive data without deleting refs/heads/master (I used script similair to one in Comment 6).
Comment 18 jessevdk@gmail.com 2015-09-27 13:15:29 UTC
I could finally reproduce this, thanks everyone for helping to track this down. I pushed a fix on both master and gnome-3-18 and it should be fixed in the next release. Until then, please use the workaround from donny.
Comment 19 Amit Mendapara 2015-09-28 07:00:18 UTC
Donny's workaround doesn't solve the issue for me. It's still crashing, waiting for the official fix.

BTW, you can test with this repository:

 $ git clone https://github.com/twbs/bootstrap.git
 $ cd bootstrap
 $ gitg

and select `Remotes -> Origin -> v4-dev` branch.

Testing on arch linux, gitg 3.17.1.
Comment 20 pedrum 2016-04-26 17:33:22 UTC
I'm no longer seeing this issue with gitg 3.20.0.