develooper Front page | perl.perl5.porters | Postings from April 2019

Re: Storable and Leaky hooks which die

Thread Previous | Thread Next
Tony Cook
April 17, 2019 01:18
Re: Storable and Leaky hooks which die
Message ID:
On Mon, Apr 15, 2019 at 11:48:13AM +0100, Dave Mitchell wrote:
> Storage has some tests which leak, and thus cause smoke failures on blead
> when run under Address Sanitizer.
> An example of code which leaks is:
>     use Storable qw(store);
>     sub FreezeHookDies::STORABLE_freeze { die ${$_[0]} }
>     my $x = bless [], "FreezeHookDies";
>     eval { store($x, "store99"); 1 };
> I had a quick look at the source (which I'm not very familiar with)
> and decided it was non-trivial and non-obvious what the best way to fix
> it is. It's in the general category of mallocing temp buffers pointed
> to be local vars, which don't get freed if the code dies (and is caught by
> an eval).
> Since it looks too messy to fix for 5.30.0 I have, for now, with
> v5.29.9-133-g2cf7500760, skipped the leaky tests when run under ASan,
> but the skip will auto-re-enable in 5.31.x
> Dopes anyone more familiar with the internals of Storable want to have a
> go at fixing it, or at least suggest the best approach?

For some reason I'm not seeing any leaks from an ASAN build.

 ./Configure -des -Dusedevel -Accflags=-fsanitize=address -Aldflags=-fsanitize=address -DDEBUGGING -Doptimize=-O0\ -g -Dcc=/opt/gcc-8.2.0/bin/gcc

valgrind picked up a leak of the ptr table from your example which is
fixed in 1d7b2a7e3a7a0e05c254d065923488b768eb3ce0.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About