Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Random segfault in kh_get_off #132

Copy link
Copy link
@papandreou

Description

@papandreou
Issue body actions

I have a pretty involved setup that causes nodegit to segfault. It happens when I use https://github.com/msiebuhr/slint to lint the staged contents of a git repository backed by https://github.com/papandreou/fsplusgit which uses https://github.com/papandreou/gitfakefs which again uses nodegit :). I've tried to create a test case with fewer moving parts, but I've failed so far, so now I'm reporting it in case it points to something obvious in the nodegit code base.

Here's the gdb backtrace:

(gdb) run
Starting program: /home/andreas/.local/bin/node /home/andreas/.local/bin/slint --git slint.json
warning: no loadable sections found in added symbol-file system-supplied DSO at 0x7ffff7ffa000
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff7ff7700 (LWP 7354)]
[New Thread 0x7ffff5e75700 (LWP 7355)]
[New Thread 0x7ffff5674700 (LWP 7356)]
[New Thread 0x7ffff4e73700 (LWP 7357)]
[New Thread 0x7fffeffff700 (LWP 7358)]

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff4e73700 (LWP 7357)]
0x00007ffff66e6e0e in kh_get_off (h=0x0, key=983856) at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.h:65
65  GIT__USE_OFFMAP;
(gdb) backtrace
#0  0x00007ffff66e6e0e in kh_get_off (h=0x0, key=983856) at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.h:65
#1  0x00007ffff66e7d32 in cache_get (cache=0x7fffd80092b0, offset=983856)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:109
#2  0x00007ffff66e89b4 in packfile_unpack_delta (obj=0x7ffff4e72cf0, p=0x7fffd8009240, w_curs=0x7ffff4e72c88, curpos=0x7ffff4e72c90, delta_size=23, delta_type=GIT_OBJ_OFS_DELTA, obj_offset=984012)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:483
#3  0x00007ffff66e8bc2 in git_packfile_unpack (obj=0x7ffff4e72cf0, p=0x7fffd8009240, obj_offset=0x7ffff4e72d10)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:555
#4  0x00007ffff671b8a2 in pack_backend__read (buffer_p=0x7ffff4e72d90, len_p=0x7ffff4e72d98, type_p=0x7ffff4e72da0, backend=0x7fffd8000ed0, oid=0xeaae50)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/odb_pack.c:393
#5  0x00007ffff6724844 in git_odb_read (out=0x7ffff4e72e00, db=0x7fffd8000900, id=0xeaae50)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/odb.c:646
#6  0x00007ffff6711fc1 in git_object_lookup_prefix (object_out=0xebd5c0, repo=0x7fffe8000970, id=0xeaae50, len=40, type=GIT_OBJ_BLOB)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/object.c:177
#7  0x00007ffff67120d5 in git_object_lookup (object_out=0xebd5c0, repo=0x7fffe8000970, id=0xeaae50, type=GIT_OBJ_BLOB)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/object.c:211
#8  0x00007ffff69978e0 in GitRepo::GetBlobWork(uv_work_s*) () from /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/build/Release/nodegit.node
#9  0x00000000006ddebd in worker (arg=arg@entry=0x0) at ../deps/uv/src/unix/threadpool.c:74
#10 0x00000000006d3a0f in uv__thread_start (ctx_v=<optimized out>) at ../deps/uv/src/uv-common.c:322
#11 0x00007ffff6f9af8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
#12 0x00007ffff6cc4a0d in clone () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) up
#1  0x00007ffff66e7d32 in cache_get (cache=0x7fffd80092b0, offset=983856)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:109
109     k = kh_get(off, cache->entries, offset);
(gdb) up
#2  0x00007ffff66e89b4 in packfile_unpack_delta (obj=0x7ffff4e72cf0, p=0x7fffd8009240, w_curs=0x7ffff4e72c88, curpos=0x7ffff4e72c90, delta_size=23, delta_type=GIT_OBJ_OFS_DELTA, obj_offset=984012)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:483
483     if ((cached = cache_get(&p->bases, base_offset)) != NULL) {
(gdb) up
#3  0x00007ffff66e8bc2 in git_packfile_unpack (obj=0x7ffff4e72cf0, p=0x7fffd8009240, obj_offset=0x7ffff4e72d10)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/pack.c:555
555         error = packfile_unpack_delta(
(gdb) up
#4  0x00007ffff671b8a2 in pack_backend__read (buffer_p=0x7ffff4e72d90, len_p=0x7ffff4e72d98, type_p=0x7ffff4e72da0, backend=0x7fffd8000ed0, oid=0xeaae50)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/odb_pack.c:393
393     if ((error = pack_entry_find(&e, (struct pack_backend *)backend, oid)) < 0 ||
(gdb) up
#5  0x00007ffff6724844 in git_odb_read (out=0x7ffff4e72e00, db=0x7fffd8000900, id=0xeaae50)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/odb.c:646
646             error = b->read(&raw.data, &raw.len, &raw.type, b, id);
(gdb) up
#6  0x00007ffff6711fc1 in git_object_lookup_prefix (object_out=0xebd5c0, repo=0x7fffe8000970, id=0xeaae50, len=40, type=GIT_OBJ_BLOB)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/object.c:177
177         error = git_odb_read(&odb_obj, odb, id);
(gdb) up
#7  0x00007ffff67120d5 in git_object_lookup (object_out=0xebd5c0, repo=0x7fffe8000970, id=0xeaae50, type=GIT_OBJ_BLOB)
    at /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/vendor/libgit2/src/object.c:211
211     return git_object_lookup_prefix(object_out, repo, id, GIT_OID_HEXSZ, type);
(gdb) up
#8  0x00007ffff69978e0 in GitRepo::GetBlobWork(uv_work_s*) () from /home/andreas/work/slint/node_modules/fsplusgit/node_modules/gitfakefs/node_modules/nodegit-papandreou/build/Release/nodegit.node
(gdb) up
#9  0x00000000006ddebd in worker (arg=arg@entry=0x0) at ../deps/uv/src/unix/threadpool.c:74
74      w->work(w);
(gdb) up
#10 0x00000000006d3a0f in uv__thread_start (ctx_v=<optimized out>) at ../deps/uv/src/uv-common.c:322
322   entry(arg);
(gdb) up
#11 0x00007ffff6f9af8e in start_thread () from /lib/x86_64-linux-gnu/libpthread.so.0
(gdb) up
#12 0x00007ffff6cc4a0d in clone () from /lib/x86_64-linux-gnu/libc.so.6
(gdb) 

Let me know if there's anything else I can do to help narrow it down?

Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.