Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Storable CPAN distribution.

Report information
The Basics
Id: 97316
Status: open
Priority: 0/
Queue: Storable

People
Owner: Nobody in particular
Requestors: NWELLNHOF [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



Subject: Memory leak when dying in freeze hook
Download (untitled) / with headers
text/plain 544b
The following program reports an increased refcount after trying to serialize an object which has a freeze hook that dies. Tested under 2.41 and 2.51. #!/usr/bin/perl use strict; use warnings; use Storable qw( freeze ); use Devel::Refcount qw( refcount ); package TestClass; sub new { my $class = shift; return bless({}, $class); } sub STORABLE_freeze { die; } package main; my $obj = TestClass->new; print("refcount before: ", refcount($obj), "\n"); eval { freeze($obj); }; print("refcount after: ", refcount($obj), "\n");
Download (untitled) / with headers
text/plain 235b
Fixed in core with [perl #121928] commit 65206418858b753c29362aa9d53c8e04a02030b5 Author: Alex Solovey <a.solovey@gmail.com> Date: Wed May 21 16:27:14 2014 +1000 Which is on cpan with RURBAN/Storable-3.05_04.tar.gz -- Reini Urban
Download (untitled) / with headers
text/plain 357b
On Thu Feb 02 06:35:41 2017, RURBAN wrote: Show quoted text
> Fixed in core with [perl #121928] > commit 65206418858b753c29362aa9d53c8e04a02030b5 > Author: Alex Solovey <a.solovey@gmail.com> > Date: Wed May 21 16:27:14 2014 +1000 > > Which is on cpan with RURBAN/Storable-3.05_04.tar.gz
In fact should be even fixed with the default 2.51 from CPAN also. -- Reini Urban
Download (untitled) / with headers
text/plain 956b
This is a different issue. With Storable 3.05_04, I still get: refcount before: 1 do_store (optype=0, netorder=0) ** allocating mbase of 8192 bytes init_store_context magic_write on fd=-1 ok (magic_write byteorder = 0x12345678 [8], I4 L4 P4 D8) store (0x9ef0ac0) storing 0x9ef0ac0 tag #0, type 3... store_blessed, type 3, class "TestClass" pkg_can for TestClass->STORABLE_freeze not cached yet TestClass->STORABLE_freeze: 0x9f0aa84 store_hook, classname "TestClass", tagged #0 about to call STORABLE_freeze on class TestClass array_call (cloning=0) refcount after: 2 Note the lack of debug message after "array_call". In store_hook, we have: ref = newRV_inc(sv); /* Temporary reference */ av = array_call(aTHX_ ref, hook, clone); /* @a = $object->STORABLE_freeze($c SvREFCNT_dec(ref); /* Reclaim temporary reference */ Then, in array_call, call_sv is invoked without G_EVAL which seems to explain the leak.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.