Fellow Monks,

Attention: the corrupted storable file I have was created under perl 5.6.0 / Storable 1.013 and reproduced under 5.6.2 / Storable 2.13. If don't have a 5.6 install handy, then you won't be able to reproduce the issue because the storable file isn't binary compatible with 5.8

I have a issue that shows up every couple of days. A storable file (happens to be a user profile) gets corrupted somehow and when I attempt to retrieve it, I get an "Out of memory!" error. (and I have _plenty_ of memory to spare for the small frozen structure)

This really sucks because its under mod_perl and it actually kills a httpd proccess each time the user with the "bad" profile attempts to go visit our site.

I've filled a bug here against Storable and figured I'd see if anyone has a minute to take it further than my limited C/XS skills could take me.

Here is the text from my bug report:

You can get the corrupt storable file, out-of-memory.storable, here (attached to the bug)

I've verified this issue with both perl 5.6.0 / Storable 1.013 perl 5.6.2 / Storable 2.13 I looked at the Storable.xs code in 2.13 and turned on the DEBUGME flag and reran my test retrieve code. (test.pl) #!/usr/bin/perl use Storable qw(retrieve); $Storable::DEBUGME = 1; retrieve(shift); Then ran it ./test.pl out-of-memory.storable and got this output (truncated to show the error) ** extending kbuf to -184127888 bytes (had 128) Out of memory! I tracked it down to retreive_hash() and this code KBUFCHK((STRLEN)size); /* Grow hash key read pool if needed */ Storables are created every couple of days that trigger this bug and because these are profiles and we have no way of trapping the exception, our we have users that are kill httpd processes each time they attempt to load our site until we remove the offending storable file. I've attached the 'out-of-memory.storable' file so you can easily reproduce this problem. From my basic knowledge I'm wondering if we could just ASSERT if you attempt to grow the hash key read pool if its not a positive integer. (I stress basic) :)
I'm just looking for the "proper" way to throw an exception in this test case so I can trap the exception in an eval rather than having a click happy user take down httpd process after httpd process util we remove the offending profile.

-biz-


In reply to Small Corrupted Storable Retrieve Dies With an Invalid "Out of memory!" by jbisbee

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.