* [PATCH] git-svn: write memoized data explicitly to avoid Storable bug
@ 2010-07-18 12:17 Sergey Vlasov
2010-07-19 6:39 ` Eric Wong
2010-07-20 17:32 ` Ævar Arnfjörð Bjarmason
0 siblings, 2 replies; 5+ messages in thread
From: Sergey Vlasov @ 2010-07-18 12:17 UTC (permalink / raw)
To: git; +Cc: Eric Wong, A Large Angry SCM, Sergey Vlasov
Apparently using the Storable module during global destruction is
unsafe - there is a bug which can cause segmentation faults:
http://rt.cpan.org/Public/Bug/Display.html?id=36087
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355
The persistent memoization support introduced in commit 8bff7c538
relied on global destruction to write cached data, which was leading
to segfaults in some Perl configurations. Calling Memoize::unmemoize
in the END block forces the cache writeout to be performed earlier,
thus avoiding the bug.
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
---
git-svn.perl | 16 ++++++++++++++++
1 files changed, 16 insertions(+), 0 deletions(-)
In my case segfaults happen only when the perl-IO-Compress module is
installed - apparently the attempt to load Compress::Zlib (now
provided by IO::Compress) changes something.
This unaswered report is also suspicious:
http://thread.gmane.org/gmane.comp.version-control.git/142161
(when running ./t9151-svn-mergeinfo.sh -v, the segfault should be
visible: "error: git-svn died of signal 11").
diff --git a/git-svn.perl b/git-svn.perl
index 19d6848..c416358 100755
--- a/git-svn.perl
+++ b/git-svn.perl
@@ -3169,6 +3169,22 @@ sub has_no_changes {
LIST_CACHE => 'FAULT',
;
}
+
+ sub unmemoize_svn_mergeinfo_functions {
+ return if not $memoized;
+ $memoized = 0;
+
+ Memoize::unmemoize 'lookup_svn_merge';
+ Memoize::unmemoize 'check_cherry_pick';
+ Memoize::unmemoize 'has_no_changes';
+ }
+}
+
+END {
+ # Force cache writeout explicitly instead of waiting for
+ # global destruction to avoid segfault in Storable:
+ # http://rt.cpan.org/Public/Bug/Display.html?id=36087
+ unmemoize_svn_mergeinfo_functions();
}
sub parents_exclude {
--
1.6.0.2.321.g8406
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] git-svn: write memoized data explicitly to avoid Storable bug
2010-07-18 12:17 [PATCH] git-svn: write memoized data explicitly to avoid Storable bug Sergey Vlasov
@ 2010-07-19 6:39 ` Eric Wong
2010-07-19 16:37 ` Junio C Hamano
2010-07-20 17:32 ` Ævar Arnfjörð Bjarmason
1 sibling, 1 reply; 5+ messages in thread
From: Eric Wong @ 2010-07-19 6:39 UTC (permalink / raw)
To: Junio C Hamano; +Cc: git, A Large Angry SCM, Sergey Vlasov
Sergey Vlasov <vsu@altlinux.ru> wrote:
> Apparently using the Storable module during global destruction is
> unsafe - there is a bug which can cause segmentation faults:
>
> http://rt.cpan.org/Public/Bug/Display.html?id=36087
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355
>
> The persistent memoization support introduced in commit 8bff7c538
> relied on global destruction to write cached data, which was leading
> to segfaults in some Perl configurations. Calling Memoize::unmemoize
> in the END block forces the cache writeout to be performed earlier,
> thus avoiding the bug.
>
> Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Thanks Sergey,
Acked-by: Eric Wong <normalperson@yhbt.net>
...and pushed to git://git.bogomips.org/git-svn
--
Eric Wong
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] git-svn: write memoized data explicitly to avoid Storable bug
2010-07-19 6:39 ` Eric Wong
@ 2010-07-19 16:37 ` Junio C Hamano
0 siblings, 0 replies; 5+ messages in thread
From: Junio C Hamano @ 2010-07-19 16:37 UTC (permalink / raw)
To: Eric Wong; +Cc: Junio C Hamano, git, A Large Angry SCM, Sergey Vlasov
Eric Wong <normalperson@yhbt.net> writes:
> Thanks Sergey,
>
> Acked-by: Eric Wong <normalperson@yhbt.net>
>
> ...and pushed to git://git.bogomips.org/git-svn
Thanks all; pulled.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] git-svn: write memoized data explicitly to avoid Storable bug
2010-07-18 12:17 [PATCH] git-svn: write memoized data explicitly to avoid Storable bug Sergey Vlasov
2010-07-19 6:39 ` Eric Wong
@ 2010-07-20 17:32 ` Ævar Arnfjörð Bjarmason
2010-07-20 19:02 ` Eric Wong
1 sibling, 1 reply; 5+ messages in thread
From: Ævar Arnfjörð Bjarmason @ 2010-07-20 17:32 UTC (permalink / raw)
To: Sergey Vlasov; +Cc: git, Eric Wong, A Large Angry SCM, Junio C Hamano
On Sun, Jul 18, 2010 at 12:17, Sergey Vlasov <vsu@altlinux.ru> wrote:
> Apparently using the Storable module during global destruction is
> unsafe - there is a bug which can cause segmentation faults:
>
> http://rt.cpan.org/Public/Bug/Display.html?id=36087
> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355
I did some investigation into the upstream issue:
https://rt.cpan.org/Ticket/Display.html?id=36087#txn-806832
> The persistent memoization support introduced in commit 8bff7c538
> relied on global destruction to write cached data, which was leading
> to segfaults in some Perl configurations. Calling Memoize::unmemoize
> in the END block forces the cache writeout to be performed earlier,
> thus avoiding the bug.
Maybe I'm missing something obvious, but this seems like the wrong
solution. The core issue is that we don't want to clean up during
global destruction, but then we should just do:
sub DESTROY {
return if not $memoized;
$memoized = 0;
Memoize::unmemoize 'lookup_svn_merge';
Memoize::unmemoize 'check_cherry_pick';
Memoize::unmemoize 'has_no_changes';
}
That should work since memoize_svn_mergeinfo_functions(); is being
called in find_extra_svn_parents, which is a Git::SVN object
method. Can you try this and confirm/deny? I can't because I can't get
the original to segfault on my box when run within git-svn.
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] git-svn: write memoized data explicitly to avoid Storable bug
2010-07-20 17:32 ` Ævar Arnfjörð Bjarmason
@ 2010-07-20 19:02 ` Eric Wong
0 siblings, 0 replies; 5+ messages in thread
From: Eric Wong @ 2010-07-20 19:02 UTC (permalink / raw)
To: Ævar Arnfjörð Bjarmason
Cc: Sergey Vlasov, git, A Large Angry SCM, Junio C Hamano
Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:
> On Sun, Jul 18, 2010 at 12:17, Sergey Vlasov <vsu@altlinux.ru> wrote:
> > Apparently using the Storable module during global destruction is
> > unsafe - there is a bug which can cause segmentation faults:
> >
> > http://rt.cpan.org/Public/Bug/Display.html?id=36087
> > http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=482355
>
> I did some investigation into the upstream issue:
> https://rt.cpan.org/Ticket/Display.html?id=36087#txn-806832
>
> > The persistent memoization support introduced in commit 8bff7c538
> > relied on global destruction to write cached data, which was leading
> > to segfaults in some Perl configurations. Calling Memoize::unmemoize
> > in the END block forces the cache writeout to be performed earlier,
> > thus avoiding the bug.
>
> Maybe I'm missing something obvious, but this seems like the wrong
> solution. The core issue is that we don't want to clean up during
> global destruction, but then we should just do:
>
> sub DESTROY {
> return if not $memoized;
> $memoized = 0;
>
> Memoize::unmemoize 'lookup_svn_merge';
> Memoize::unmemoize 'check_cherry_pick';
> Memoize::unmemoize 'has_no_changes';
> }
I haven't looked at this issue in-depth, but I believe the problem is
triggered due to Memoize::Storable trying to use Storable::nstore
in its own DESTROY function. So trying to do the same in our own
DESTROY would be just as bad.
> That should work since memoize_svn_mergeinfo_functions(); is being
> called in find_extra_svn_parents, which is a Git::SVN object
> method. Can you try this and confirm/deny? I can't because I can't get
> the original to segfault on my box when run within git-svn.
I wasn't able to reproduce the segfault on my systems, either, but
it seems plausible it would only happen on some systems.
--
Eric Wong
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2010-07-20 19:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-07-18 12:17 [PATCH] git-svn: write memoized data explicitly to avoid Storable bug Sergey Vlasov
2010-07-19 6:39 ` Eric Wong
2010-07-19 16:37 ` Junio C Hamano
2010-07-20 17:32 ` Ævar Arnfjörð Bjarmason
2010-07-20 19:02 ` Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).