in reply to perl Segmentation fault (with Storable?)

It is in fact in Storable. Something is going wrong in XS_Storable_pstore() in the XS shared object. Stay tuned..

<update>

Changing your script to

#!/usr/bin/perl use strict; use warnings; use lib "$ENV{PWD}"; use myConfig; # create the objecto for write the db our $c_config = myConfig->new(); # add default to the configuration db $c_config->add_default ( default => 'aa' ); $c_config->_write_configuration();

produces the following output:

### _write_configuration - store start ### _write_configuration - return ### DESTROY - start ### _write_configuration - store start Segmentation fault

The segfault is triggered only if store() is called in the DESTROY during global destruction. It occurs in Storable.xs in do_store()

static int do_store( pTHX_ PerlIO *f, SV *sv, int optype, int network_order, SV **res) { dSTCXT; <--- here int status; ...
in the macro dSTCXT which resolves to
SV *perinterp_sv = *hv_fetch(PL_modglobal, MY_VERSION, sizeof(MY_VERSION)-1, TRUE); stcxt_t * cxt = ((perinterp_sv && SvIOK(perinterp_sv) && SvIVX(perinte +rp_sv) ? (stcxt_t *)SvPVX(SvRV(INT2PTR(SV*,SvIVX(perinterp_sv)))) : (stcx +t_t *) 0));

It doesn't occur with the following script:

#!/usr/bin/perl use strict; use warnings; use lib "$ENV{PWD}"; use myConfig; # create the objecto for write the db our $c_config = myConfig->new(); # add default to the configuration db $c_config->add_default ( default => 'aa' ); undef $c_config;

Seems like during global destruction some things needed are already gone.

</update>

--shmem

_($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                              /\_¯/(q    /
----------------------------  \__(m.====·.(_("always off the crowd"))."·
");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}

Replies are listed 'Best First'.
Re^2: perl Segmentation fault (with Smart::Comments?)
by grinder (Bishop) on Nov 21, 2007 at 07:36 UTC
    It is in fact in Storable

    But don't you find it curious that just nearby there's a magical Damian module being used? Does commenting that out make the problem go away?

    • another intruder with the mooring in the heart of the Perl

      Do you mean Smart::Comments? No, commenting that out doesn't make any difference.

      I ask because there are *two* Damian modules involved ;-)

      --shmem

      _($_=" "x(1<<5)."?\n".q·/)Oo.  G°\        /
                                    /\_¯/(q    /
      ----------------------------  \__(m.====·.(_("always off the crowd"))."·
      ");sub _{s./.($e="'Itrs `mnsgdq Gdbj O`qkdq")=~y/"-y/#-z/;$e.e && print}