[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

(guix git) and guile-git finalizers.

From: Mathieu Othacehe
Subject: (guix git) and guile-git finalizers.
Date: Mon, 12 Jun 2017 14:44:48 +0200
User-agent: mu4e 0.9.18; emacs 25.2.1

Hi !

While integrating (guix git) into Cuirass, I noticed unexpected
segfaults during "latest-repository-commit" evaluation.

Segfaults can be narrowed to the following lines:

--8<---------------cut here---------------start------------->8---
(use-modules (git))
(begin (libgit2-init!)
       (let ((rep (repository-open "some-git-repo")))
         (remote-fetch (remote-lookup rep "origin")))
--8<---------------cut here---------------end--------------->8---

Note that, it's not 100% reproducible, but re-executing 4 or 5 times the
above snippet is often enough to observe the segfault.

Here's the gdb backtrace I collected :

--8<---------------cut here---------------start------------->8---
#0  0x00007fffef7eb181 in git_mwindow_put_pack () from 
#1  0x00007fffef7f2897 in pack_backend(float, long double,...)(...) () from 
#2  0x00007fffef7eef72 in git_odb_free () from 
#3  0x00007fffef8134ce in git_repository.cleanup () from 
#4  0x00007fffef81351a in git_repository_free () from 
#5  0x00007ffff7b01e37 in chained_finalizer () from 
#6  0x00007ffff785170f in GC_invoke_finalizers () from 
#7  0x00007ffff7b02099 in scm_run_finalizers () from 
#8  0x00007ffff7b020f5 in finalization_thread_proc () from 
#9  0x00007ffff7af2cba in c_body () from 
#10 0x00007ffff7b680c9 in vm_debug_engine () from 
#11 0x00007ffff7b752aa in scm_call_n () from 
#12 0x00007ffff7b644e6 in catch () from 
#13 0x00007ffff7af32a0 in scm_i_with_continuation_barrier () from 
#14 0x00007ffff7af3335 in scm_c_with_continuation_barrier () from 
#15 0x00007ffff7b6310c in with_guile () from 
#16 0x00007ffff7858732 in GC_call_with_stack_base () from 
#17 0x00007ffff7b63498 in scm_with_guile () from 
#18 0x00007ffff7625454 in start_thread () from 
#19 0x00007ffff5fed7bf in clone () from 
--8<---------------cut here---------------end--------------->8---

I supposed that what happends is the following race-condition :
* (libgit2-shutdown) is called
* the finalizer %repository-free is called in an other thread.
* because shutdown has already been called the finalizer fails and

Maybe the right answer is to disable auto finalization and call
run-finalizers as described here :

However I can't find guile counterparts for those libguile functions.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]