You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Stefan Profanter <ca...@s.profanter.me> on 2012/09/28 15:07:47 UTC

apache2 + mod_perl + Catalyst + Session = Segmentation fault

Hi!

 

Posted this question already on Catalyst Mailing List, but got no answer yet
and I think this problem is caused by mod_perl somewhere.

 

I programmed a Catalyst Application which uses mod_perl and apache2 in
production mode.

 

The Catalyst App runs fine in debug mode ("Started with own script on port
3000").

Another Catalyst application programmed some months ago works perfect with
nearly the same configuration and runs also parallel even on the same
apache2 (also with same Session Plugins).

 

The first time, I access the site everything works fine. But after login,
only the first page opens, each second try to open another page results in a
Segmentation Fault. Even pages which don't require login.

If I then disable or delete the Cookies, the Site works again. So my guess
is that there is somewhere a problem with Session handling.

 

Disabling the first application in apache doesn't change anything.

 

Can you help me finding out what causes the SegFault (Debug infos see
above)?

 

Thanks a lot!!!

Stefan

 

--------------------------------------

 

 

Here ist the backtrace from gdb and apache2 which I got so far:

 

Core was generated by `/usr/sbin/apache2 -k start'.

Program terminated with signal 11, Segmentation fault.

#0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>,

    network_order=-1547829216, res=<value optimized out>) at
Storable.xs:3873

3873            return newSVpv(mbase, MBUF_SIZE());

(gdb) bt

#0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>,

    network_order=-1547829216, res=<value optimized out>) at
Storable.xs:3873

#1  do_store (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>,

    network_order=-1547829216, res=<value optimized out>) at
Storable.xs:3833

#2  0x00002b608bf0856b in XS_Storable_mstore (my_perl=0x2b60a36b94c0,
cv=<value optimized out>) at Storable.xs:6427

#3  0x00002b6085e54045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10

#4  0x00002b6085e52336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#5  0x00002b6085e864a8 in ?? () from /usr/lib/libperl.so.5.10

#6  0x00002b6085e52336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#7  0x00002b6085df9548 in Perl_call_sv () from /usr/lib/libperl.so.5.10

#8  0x00002b608bf05e18 in array_call (my_perl=0x2b60a36b94c0,
cxt=0x2b60a23c3590, sv=<value optimized out>, type=<value optimized out>,

    pkg=0x2b609de41580) at Storable.xs:1889

#9  store_hook (my_perl=0x2b60a36b94c0, cxt=0x2b60a23c3590, sv=<value
optimized out>, type=<value optimized out>, pkg=0x2b609de41580)

    at Storable.xs:2984

#10 store_blessed (my_perl=0x2b60a36b94c0, cxt=0x2b60a23c3590, sv=<value
optimized out>, type=<value optimized out>, pkg=0x2b609de41580)

    at Storable.xs:3342

#11 0x00002b608bf08067 in store (my_perl=0x2b60a36b94c0, cxt=0x2b60a23c3590,
sv=0x2b60a3b45dc0) at Storable.xs:3630

#12 0x00002b608bf08085 in store (my_perl=0x2b60a36b94c0, cxt=<value
optimized out>, sv=0x2b60a3b45d90) at Storable.xs:3632

#13 0x00002b608bf09987 in store_hash (my_perl=0x2b60a36b94c0,
cxt=0x2b60a23c3590, hv=0x2b60a3b45d78) at Storable.xs:2425

#14 0x00002b608bf05c8f in store_blessed (my_perl=0x2b60a36b94c0,
cxt=0x2b60a23c3590, sv=<value optimized out>, type=32,

    pkg=<value optimized out>) at Storable.xs:3390

#15 0x00002b608bf08067 in store (my_perl=0x2b60a36b94c0, cxt=0x2b60a23c3590,
sv=0x2b60a3b45d78) at Storable.xs:3630

#16 0x00002b608bf08085 in store (my_perl=0x2b60a36b94c0, cxt=<value
optimized out>, sv=0x2b60a3b45d48) at Storable.xs:3632

#17 0x00002b608bf09987 in store_hash (my_perl=0x2b60a36b94c0,
cxt=0x2b60a23c3590, hv=0x2b60a3b45bf8) at Storable.xs:2425

#18 0x00002b608bf08085 in store (my_perl=0x2b60a36b94c0, cxt=<value
optimized out>, sv=0x2b60a3b45bf8) at Storable.xs:3632

#19 0x00002b608bf0837d in do_store (my_perl=0x2b60a36b94c0, f=<value
optimized out>, sv=0x2b60a3b45bf8, optype=<value optimized out>,

    network_order=-1548414208, res=<value optimized out>) at
Storable.xs:3821

#20 0x00002b608bf0856b in XS_Storable_mstore (my_perl=0x2b60a36b94c0,
cv=<value optimized out>) at Storable.xs:6427

#21 0x00002b6085e54045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10

#22 0x00002b6085e52336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#23 0x00002b6085df98cf in Perl_call_sv () from /usr/lib/libperl.so.5.10

#24 0x00002b6085b7f2f6 in modperl_callback () from
/usr/lib/apache2/modules/mod_perl.so

#25 0x00002b6085b7fa3a in modperl_callback_run_handlers () from
/usr/lib/apache2/modules/mod_perl.so

#26 0x00002b6085b8001f in modperl_callback_per_dir () from
/usr/lib/apache2/modules/mod_perl.so

#27 0x00002b6085b7999f in ?? () from /usr/lib/apache2/modules/mod_perl.so

#28 0x00002b6085b79d06 in modperl_response_handler () from
/usr/lib/apache2/modules/mod_perl.so

#29 0x00002b60815ef320 in ap_run_handler (r=0x2b60a3b04328) at
/build/buildd/apache2-2.2.14/server/config.c:159

#30 0x00002b60815f2c88 in ap_invoke_handler (r=0x2b60a3b04328) at
/build/buildd/apache2-2.2.14/server/config.c:373

#31 0x00002b6081600878 in ap_process_request (r=0x2b60a3b04328) at
/build/buildd/apache2-2.2.14/modules/http/http_request.c:282

#32 0x00002b60815fd728 in ap_process_http_connection (c=0x2b60a3af81a8) at
/build/buildd/apache2-2.2.14/modules/http/http_core.c:190

#33 0x00002b60815f6ed8 in ap_run_process_connection (c=0x2b60a3af81a8) at
/build/buildd/apache2-2.2.14/server/connection.c:43

#34 0x00002b6081605847 in child_main (child_num_arg=<value optimized out>)

    at /build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:662

#35 0x00002b6081605b5a in make_child (s=0x2b609d15a938, slot=0) at
/build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:758

#36 0x00002b6081605e8b in startup_children (_pconf=<value optimized out>,
plog=<value optimized out>, s=<value optimized out>)

    at /build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:776

#37 ap_mpm_run (_pconf=<value optimized out>, plog=<value optimized out>,
s=<value optimized out>)

    at /build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:997

#38 0x00002b60815db350 in main (argc=3, argv=0x7ffffb3ac528) at
/build/buildd/apache2-2.2.14/server/main.c:742

(gdb)

 

 

 

And here another backtrace:

 

 

Program terminated with signal 11, Segmentation fault.

#0  mbuf2sv (my_perl=0x2afddd67e2a0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>, network_order=-793735616,
res=<value optimized out>)

    at Storable.xs:3873

3873            return newSVpv(mbase, MBUF_SIZE());

(gdb) bt

#0  mbuf2sv (my_perl=0x2afddd67e2a0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>, network_order=-793735616,
res=<value optimized out>)

    at Storable.xs:3873

#1  do_store (my_perl=0x2afddd67e2a0, f=<value optimized out>, sv=<value
optimized out>, optype=<value optimized out>, network_order=-793735616,
res=<value optimized out>)

    at Storable.xs:3833

#2  0x00002afddb3b156b in XS_Storable_mstore (my_perl=0x2afddd67e2a0,
cv=<value optimized out>) at Storable.xs:6427

#3  0x00002afdd52fd045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10

#4  0x00002afdd52fb336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#5  0x00002afdd532f4a8 in ?? () from /usr/lib/libperl.so.5.10

#6  0x00002afdd52fb336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#7  0x00002afdd52a2548 in Perl_call_sv () from /usr/lib/libperl.so.5.10

#8  0x00002afddb3aee18 in array_call (my_perl=0x2afddd67e2a0,
cxt=0x2afde5b98ca0, sv=<value optimized out>, type=<value optimized out>,
pkg=0x2afdde173f58) at Storable.xs:1889

#9  store_hook (my_perl=0x2afddd67e2a0, cxt=0x2afde5b98ca0, sv=<value
optimized out>, type=<value optimized out>, pkg=0x2afdde173f58) at
Storable.xs:2984

#10 store_blessed (my_perl=0x2afddd67e2a0, cxt=0x2afde5b98ca0, sv=<value
optimized out>, type=<value optimized out>, pkg=0x2afdde173f58) at
Storable.xs:3342

#11 0x00002afddb3b1067 in store (my_perl=0x2afddd67e2a0, cxt=0x2afde5b98ca0,
sv=0x2afdec10e6f0) at Storable.xs:3630

#12 0x00002afddb3b1085 in store (my_perl=0x2afddd67e2a0, cxt=<value
optimized out>, sv=0x2afdec10e6c0) at Storable.xs:3632

#13 0x00002afddb3b2987 in store_hash (my_perl=0x2afddd67e2a0,
cxt=0x2afde5b98ca0, hv=0x2afdec10e6a8) at Storable.xs:2425

#14 0x00002afddb3aec8f in store_blessed (my_perl=0x2afddd67e2a0,
cxt=0x2afde5b98ca0, sv=<value optimized out>, type=32, pkg=<value optimized
out>) at Storable.xs:3390

#15 0x00002afddb3b1067 in store (my_perl=0x2afddd67e2a0, cxt=0x2afde5b98ca0,
sv=0x2afdec10e6a8) at Storable.xs:3630

#16 0x00002afddb3b1085 in store (my_perl=0x2afddd67e2a0, cxt=<value
optimized out>, sv=0x2afdec10e678) at Storable.xs:3632

#17 0x00002afddb3b2987 in store_hash (my_perl=0x2afddd67e2a0,
cxt=0x2afde5b98ca0, hv=0x2afdec10e528) at Storable.xs:2425

#18 0x00002afddb3b1085 in store (my_perl=0x2afddd67e2a0, cxt=<value
optimized out>, sv=0x2afdec10e528) at Storable.xs:3632

#19 0x00002afddb3b137d in do_store (my_perl=0x2afddd67e2a0, f=<value
optimized out>, sv=0x2afdec10e528, optype=<value optimized out>,
network_order=-334385616, res=<value optimized out>)

    at Storable.xs:3821

#20 0x00002afddb3b156b in XS_Storable_mstore (my_perl=0x2afddd67e2a0,
cv=<value optimized out>) at Storable.xs:6427

#21 0x00002afdd52fd045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10

#22 0x00002afdd52fb336 in Perl_runops_standard () from
/usr/lib/libperl.so.5.10

#23 0x00002afdd52a28cf in Perl_call_sv () from /usr/lib/libperl.so.5.10

#24 0x00002afdd50282f6 in modperl_callback () from
/usr/lib/apache2/modules/mod_perl.so

---Type <return> to continue, or q <return> to quit---

#25 0x00002afdd5028a3a in modperl_callback_run_handlers () from
/usr/lib/apache2/modules/mod_perl.so

#26 0x00002afdd502901f in modperl_callback_per_dir () from
/usr/lib/apache2/modules/mod_perl.so

#27 0x00002afdd502299f in ?? () from /usr/lib/apache2/modules/mod_perl.so

#28 0x00002afdd5022d06 in modperl_response_handler () from
/usr/lib/apache2/modules/mod_perl.so

#29 0x00002afdd0a98320 in ap_run_handler (r=0x2afdec0cd018) at
/build/buildd/apache2-2.2.14/server/config.c:159

#30 0x00002afdd0a9bc88 in ap_invoke_handler (r=0x2afdec0cd018) at
/build/buildd/apache2-2.2.14/server/config.c:373

#31 0x00002afdd0aa9878 in ap_process_request (r=0x2afdec0cd018) at
/build/buildd/apache2-2.2.14/modules/http/http_request.c:282

#32 0x00002afdd0aa6728 in ap_process_http_connection (c=0x2afdec0c0e98) at
/build/buildd/apache2-2.2.14/modules/http/http_core.c:190

#33 0x00002afdd0a9fed8 in ap_run_process_connection (c=0x2afdec0c0e98) at
/build/buildd/apache2-2.2.14/server/connection.c:43

#34 0x00002afdd0aae847 in child_main (child_num_arg=<value optimized out>)
at /build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:662

#35 0x00002afdd0aaeb5a in make_child (s=0x2afddd602938, slot=7) at
/build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:758

#36 0x00002afdd0aaf7e4 in perform_idle_server_maintenance (_pconf=<value
optimized out>, plog=<value optimized out>, s=<value optimized out>)

    at /build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:893

#37 ap_mpm_run (_pconf=<value optimized out>, plog=<value optimized out>,
s=<value optimized out>) at
/build/buildd/apache2-2.2.14/server/mpm/prefork/prefork.c:1097

#38 0x00002afdd0a84350 in main (argc=3, argv=0x7ffff9c37f18) at
/build/buildd/apache2-2.2.14/server/main.c:742

 

---------------

 

My system configuration:

 

UBUNTU Server:

Ubuntu 10.04.4 LTS

 

APACHE:

Server version: Apache/2.2.14 (Ubuntu)

Server built:   Mar  5 2012 16:42:17

apache2                                              2.2.14-5ubuntu8.9
Apache HTTP Server metapackage

apache2-doc                                     2.2.14-5ubuntu8.9
Apache HTTP Server documentation

apache2-mpm-prefork                2.2.14-5ubuntu8.9
Apache HTTP Server - traditional non-threade

apache2-threaded-dev                2.2.14-5ubuntu8.9
Apache development headers - threaded MPM

apache2-utils                                     2.2.14-5ubuntu8.9
utility programs for webservers

apache2.2-bin                                  2.2.14-5ubuntu8.9
Apache HTTP Server common binary files

apache2.2-common                      2.2.14-5ubuntu8.9
Apache HTTP Server common files

libapache2-mod-perl2                  2.0.4-6ubuntu1
Integration of perl with the Apache2 web ser

libapache2-mod-perl2-dev        2.0.4-6ubuntu1
Integration of perl with the Apache2 web ser

libapache2-mod-php5                  5.3.2-1ubuntu4.18
server-side, HTML-embedded scripting languag

libapache2-reload-perl                 0.10-2
Reload Perl modules when changed on disk

 

PERL:

This is perl, v5.10.1 (*) built for x86_64-linux-gnu-thread-multi

 

CATALYST perl modules:

Catalyst                  The Elegant MVC Web Application Framework
5.90015

Catalyst::Action::Deserialize
1.05

Catalyst::Action::Deserialize::Callback
1.05

Catalyst::Action::Deserialize::Data::Serializer
1.05

Catalyst::Action::Deserialize::JSON
1.05

Catalyst::Action::Deserialize::JSON::XS
1.05

Catalyst::Action::Deserialize::View
1.05

Catalyst::Action::Deserialize::XML::Simple
1.05

Catalyst::Action::Deserialize::YAML
1.05

Catalyst::Action::DeserializeMultiPart
1.05

Catalyst::Action::REST
1.05

Catalyst::Action::REST::ForBrowsers
1.05

Catalyst::Action::RenderView
0.16

Catalyst::Action::RenderView::ErrorHandler
0.100165

Catalyst::Action::RenderView::ErrorHandler::Action
0.100165

Catalyst::Action::RenderView::ErrorHandler::Action::Email
0.04

Catalyst::Action::RenderView::ErrorHandler::Action::Log
0.100165

Catalyst::Action::Role::ACL

Catalyst::Action::Serialize
1.05

Catalyst::Action::Serialize::Callback
1.05

Catalyst::Action::Serialize::Data::Serializer
1.05

Catalyst::Action::Serialize::JSON
1.05

Catalyst::Action::Serialize::JSON::XS
1.05

Catalyst::Action::Serialize::JSONP
1.05

Catalyst::Action::Serialize::View
1.05

Catalyst::Action::Serialize::XML::Simple
1.05

Catalyst::Action::Serialize::YAML
1.05

Catalyst::Action::Serialize::YAML::HTML
1.05

Catalyst::Action::SerializeBase
1.05

Catalyst::ActionRole::ACL User role-based authorization action class
0.07

Catalyst::Authentication::Store::DBIx::Class

                          Catalyst Auth storage using DBIx::Class
0.1503

Catalyst::Component::InstancePerContext
0.001001

Catalyst::Controller::ActionRole
0.15

Catalyst::Controller::CGIBin
0.034

Catalyst::Controller::HTML::FormFu
0.09003

Catalyst::Controller::REST
1.05

Catalyst::Controller::SOAP
1.23

Catalyst::Controller::WrapCGI
0.034

Catalyst::Devel
1.36

Catalyst::Engine::Apache  Catalyst engines for mod_perl 1.3, 1.99, 2.x
1.16

Catalyst::Engine::Apache2
1.16

Catalyst::Engine::Apache2::MP19
1.16

Catalyst::Engine::Apache2::MP20
1.16

Catalyst::Engine::Apache::MP13
1.16

Catalyst::Helper
1.36

Catalyst::Helper::Model::DBIC::Schema
0.59

Catalyst::Helper::View::Email
0.31

Catalyst::Helper::View::Email::Template
0.31

Catalyst::Model::DBIC::Schema

                          DBIx::Class model for Catalyst
0.59

Catalyst::Plugin::Authentication

                          Authentication support for Catalyst
0.10018

Catalyst::Plugin::Authorization::ACL

                          ACL support for Catalyst
0.15

Catalyst::Plugin::Authorization::Roles

                          RBAC support for Catalyst
0.09

Catalyst::Plugin::Cache::Memcached::Fast
0.14

Catalyst::Plugin::Compress::Zlib
0.06

Catalyst::Plugin::ConfigLoader

Catalyst::Plugin::I18N    I18N plugin for Catalyst
0.10

Catalyst::Plugin::I18N::DBI
0.2.5

Catalyst::Plugin::I18N::PathPrefix
0.07

Catalyst::Plugin::I18N::Request
0.07

Catalyst::Plugin::Session Session support "parent" plugin for Catalyst
0.32

Catalyst::Plugin::Session::State::Cookie

                          Cookie driver for Catalyst sessions
0.17

Catalyst::Plugin::Session::Store::FastMmap

                          FastMmap storage for Catalyst sessions
0.16

Catalyst::Plugin::Session::Store::File
0.18

Catalyst::Plugin::Session::Store::Memcached

                          Memcached storage for Catalyst sessions
0.04

Catalyst::Plugin::Session::Test::Store
123

Catalyst::Plugin::Static::Simple

Catalyst::Plugin::Unicode::Encoding
1.5

Catalyst::Plugin::UploadProgress

Catalyst::Request::REST
1.05

Catalyst::Request::REST::ForBrowsers
1.05

Catalyst::Runtime
5.90015

Catalyst::Test
undef

Catalyst::TraitFor::Request::REST
1.05

Catalyst::TraitFor::Request::REST::ForBrowsers
1.05

Catalyst::View::Email
0.31

Catalyst::View::Email::Template
0.31

Catalyst::View::TT        The Elegant MVC Web Application Framework
0.38

CatalystX::Component::Traits
0.16

CatalystX::GlobalContext
0.034

CatalystX::I18N
1.10

CatalystX::RoleApplicator
0.005


Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by Perrin Harkins <pe...@elem.com>.
On Fri, Sep 28, 2012 at 12:33 PM, demerphq <de...@gmail.com> wrote:
> Maybe look at Sereal as an alternative to Storable.
>
> https://github.com/Sereal/Sereal/
> http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
> http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm

Wow, faster than JSON::XS?  Impressive!

- Perrin

Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by Ævar Arnfjörð Bjarmason <av...@gmail.com>.
On Tue, Nov 13, 2012 at 3:48 PM, demerphq <de...@gmail.com> wrote:
> On 13 November 2012 15:23, Ævar Arnfjörð Bjarmason <av...@gmail.com> wrote:
>> On Sat, Sep 29, 2012 at 1:08 PM, Stefan Profanter
>> <ca...@s.profanter.me> wrote:
>>>> >
>>>> > Looks like you are using Storable to stream out cookies?  Looks like
>>>> > something in there is causing Storable to puke.  I see things like
>>>> > array_call, store_blessed, store_hash... So I'm guessing your passing
>>>> > Storable some kind of object?  Does it have any recursive parts?
>>>> >
>>>> > I googled "perl storable seg fault" and it looks like people have
>>>> > gotten Storable to seg fault before.  I'm not sure if the stack trace
>>>> > is reading objects or writing them.  Maybe you can glean from other's
>>>> > what makes Storable segfault.
>>>> >
>>>> > First figure out if its reading or writing that causes the problem,
>>>> > then try to figure out what part of the object is so upsetting.
>>>> >
>>>> >> 3873            return newSVpv(mbase, MBUF_SIZE());
>>>> >
>>>> >
>>>> > Hum... any chance that is really really big?
>>>
>>> Yes, you were right.
>>> I stored a DBIX::ResultSet->single Object in session and it seems this
>>> caused the SegFault. Now I stored only the ID instead of whole object and it
>>> works.
>>>
>>>>
>>>> Maybe look at Sereal as an alternative to Storable.
>>>>
>>>> https://github.com/Sereal/Sereal/
>>>> http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
>>>> http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm
>>>>
>>>
>>> This seems interesting! Do you know by chance how Catalyst::Plugin::Session
>>> can be set to use Seareal instead of Storable?
>>
>> I don't have experience with that Catalyst plugin but for e.g.
>> Apache::Session we've been using Data::FlexSerializer to migrate away
>> from Sereal.
>
> He meant "from Storable (to Sereal)"

Yes, sorry about that brainfart :)

Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by demerphq <de...@gmail.com>.
On 13 November 2012 15:23, Ævar Arnfjörð Bjarmason <av...@gmail.com> wrote:
> On Sat, Sep 29, 2012 at 1:08 PM, Stefan Profanter
> <ca...@s.profanter.me> wrote:
>>> >
>>> > Looks like you are using Storable to stream out cookies?  Looks like
>>> > something in there is causing Storable to puke.  I see things like
>>> > array_call, store_blessed, store_hash... So I'm guessing your passing
>>> > Storable some kind of object?  Does it have any recursive parts?
>>> >
>>> > I googled "perl storable seg fault" and it looks like people have
>>> > gotten Storable to seg fault before.  I'm not sure if the stack trace
>>> > is reading objects or writing them.  Maybe you can glean from other's
>>> > what makes Storable segfault.
>>> >
>>> > First figure out if its reading or writing that causes the problem,
>>> > then try to figure out what part of the object is so upsetting.
>>> >
>>> >> 3873            return newSVpv(mbase, MBUF_SIZE());
>>> >
>>> >
>>> > Hum... any chance that is really really big?
>>
>> Yes, you were right.
>> I stored a DBIX::ResultSet->single Object in session and it seems this
>> caused the SegFault. Now I stored only the ID instead of whole object and it
>> works.
>>
>>>
>>> Maybe look at Sereal as an alternative to Storable.
>>>
>>> https://github.com/Sereal/Sereal/
>>> http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
>>> http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm
>>>
>>
>> This seems interesting! Do you know by chance how Catalyst::Plugin::Session
>> can be set to use Seareal instead of Storable?
>
> I don't have experience with that Catalyst plugin but for e.g.
> Apache::Session we've been using Data::FlexSerializer to migrate away
> from Sereal.

He meant "from Storable (to Sereal)"

Yves

-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by Ævar Arnfjörð Bjarmason <av...@gmail.com>.
On Sat, Sep 29, 2012 at 1:08 PM, Stefan Profanter
<ca...@s.profanter.me> wrote:
>> >
>> > Looks like you are using Storable to stream out cookies?  Looks like
>> > something in there is causing Storable to puke.  I see things like
>> > array_call, store_blessed, store_hash... So I'm guessing your passing
>> > Storable some kind of object?  Does it have any recursive parts?
>> >
>> > I googled "perl storable seg fault" and it looks like people have
>> > gotten Storable to seg fault before.  I'm not sure if the stack trace
>> > is reading objects or writing them.  Maybe you can glean from other's
>> > what makes Storable segfault.
>> >
>> > First figure out if its reading or writing that causes the problem,
>> > then try to figure out what part of the object is so upsetting.
>> >
>> >> 3873            return newSVpv(mbase, MBUF_SIZE());
>> >
>> >
>> > Hum... any chance that is really really big?
>
> Yes, you were right.
> I stored a DBIX::ResultSet->single Object in session and it seems this
> caused the SegFault. Now I stored only the ID instead of whole object and it
> works.
>
>>
>> Maybe look at Sereal as an alternative to Storable.
>>
>> https://github.com/Sereal/Sereal/
>> http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
>> http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm
>>
>
> This seems interesting! Do you know by chance how Catalyst::Plugin::Session
> can be set to use Seareal instead of Storable?

I don't have experience with that Catalyst plugin but for e.g.
Apache::Session we've been using Data::FlexSerializer to migrate away
from Sereal.

AW: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by Stefan Profanter <ca...@s.profanter.me>.
> >
> > Looks like you are using Storable to stream out cookies?  Looks like
> > something in there is causing Storable to puke.  I see things like
> > array_call, store_blessed, store_hash... So I'm guessing your passing
> > Storable some kind of object?  Does it have any recursive parts?
> >
> > I googled "perl storable seg fault" and it looks like people have
> > gotten Storable to seg fault before.  I'm not sure if the stack trace
> > is reading objects or writing them.  Maybe you can glean from other's
> > what makes Storable segfault.
> >
> > First figure out if its reading or writing that causes the problem,
> > then try to figure out what part of the object is so upsetting.
> >
> >> 3873            return newSVpv(mbase, MBUF_SIZE());
> >
> >
> > Hum... any chance that is really really big?

Yes, you were right.
I stored a DBIX::ResultSet->single Object in session and it seems this
caused the SegFault. Now I stored only the ID instead of whole object and it
works.

> 
> Maybe look at Sereal as an alternative to Storable.
> 
> https://github.com/Sereal/Sereal/
> http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
> http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm
> 

This seems interesting! Do you know by chance how Catalyst::Plugin::Session
can be set to use Seareal instead of Storable?

Thank you!!!


Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by demerphq <de...@gmail.com>.
On 28 September 2012 17:10, Andy Colson <an...@squeakycode.net> wrote:
>
> On 09/28/2012 08:07 AM, Stefan Profanter wrote:
>>
>> Hi!
>>
>> Posted this question already on Catalyst Mailing List, but got no answer
>> yet and I think this problem is caused by mod_perl somewhere.
>>
>> I programmed a Catalyst Application which uses mod_perl and apache2 in
>> production mode.
>>
>> The Catalyst App runs fine in debug mode (“Started with own script on port
>> 3000”).
>>
>> Another Catalyst application programmed some months ago works perfect with
>> nearly the same configuration and runs also parallel even on the same
>> apache2 (also with same Session Plugins).
>>
>> The first time, I access the site everything works fine. But after login,
>> only the first page opens, each second try to open another page results in a
>> Segmentation Fault. Even pages which don’t require login.
>>
>> If I then disable or delete the Cookies, the Site works again. So my guess
>> is that there is somewhere a problem with Session handling.
>>
>> Disabling the first application in apache doesn’t change anything.
>>
>> Can you help me finding out what causes the SegFault (Debug infos see
>> above)?
>>
>> Thanks a lot!!!
>>
>> Stefan
>>
>> --------------------------------------
>>
>> Here ist the backtrace from gdb and apache2 which I got so far:
>>
>> Core was generated by `/usr/sbin/apache2 -k start'.
>>
>> Program terminated with signal 11, Segmentation fault.
>>
>> #0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
>> optimized out>, optype=<value optimized out>,
>>
>>      network_order=-1547829216, res=<value optimized out>) at
>> Storable.xs:3873
>>
>> 3873            return newSVpv(mbase, MBUF_SIZE());
>>
>> (gdb) bt
>>
>> #0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
>> optimized out>, optype=<value optimized out>,
>>
>>      network_order=-1547829216, res=<value optimized out>) at
>> Storable.xs:3873
>>
>> #1  do_store (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value
>> optimized out>, optype=<value optimized out>,
>>
>>      network_order=-1547829216, res=<value optimized out>) at
>> Storable.xs:3833
>>
>> #2  0x00002b608bf0856b in XS_Storable_mstore (my_perl=0x2b60a36b94c0,
>> cv=<value optimized out>) at Storable.xs:6427
>>
>> #3  0x00002b6085e54045 in Perl_pp_entersub () from
>> /usr/lib/libperl.so.5.10
>>
>
>
> Looks like you are using Storable to stream out cookies?  Looks like
> something in there is causing Storable to puke.  I see things like
> array_call, store_blessed, store_hash... So I'm guessing your passing
> Storable some kind of object?  Does it have any recursive parts?
>
> I googled "perl storable seg fault" and it looks like people have gotten
> Storable to seg fault before.  I'm not sure if the stack trace is reading
> objects or writing them.  Maybe you can glean from other's what makes
> Storable segfault.
>
> First figure out if its reading or writing that causes the problem, then try
> to figure out what part of the object is so upsetting.
>
>> 3873            return newSVpv(mbase, MBUF_SIZE());
>
>
> Hum... any chance that is really really big?


Maybe look at Sereal as an alternative to Storable.

https://github.com/Sereal/Sereal/
http://search.cpan.org/~smueller/Sereal-Decoder/lib/Sereal/Decoder.pm
http://search.cpan.org/~smueller/Sereal-Encoder/lib/Sereal/Encoder.pm

cheers,
Yves


-- 
perl -Mre=debug -e "/just|another|perl|hacker/"

Re: apache2 + mod_perl + Catalyst + Session = Segmentation fault

Posted by Andy Colson <an...@squeakycode.net>.
On 09/28/2012 08:07 AM, Stefan Profanter wrote:
> Hi!
>
> Posted this question already on Catalyst Mailing List, but got no answer yet and I think this problem is caused by mod_perl somewhere.
>
> I programmed a Catalyst Application which uses mod_perl and apache2 in production mode.
>
> The Catalyst App runs fine in debug mode (“Started with own script on port 3000”).
>
> Another Catalyst application programmed some months ago works perfect with nearly the same configuration and runs also parallel even on the same apache2 (also with same Session Plugins).
>
> The first time, I access the site everything works fine. But after login, only the first page opens, each second try to open another page results in a Segmentation Fault. Even pages which don’t require login.
>
> If I then disable or delete the Cookies, the Site works again. So my guess is that there is somewhere a problem with Session handling.
>
> Disabling the first application in apache doesn’t change anything.
>
> Can you help me finding out what causes the SegFault (Debug infos see above)?
>
> Thanks a lot!!!
>
> Stefan
>
> --------------------------------------
>
> Here ist the backtrace from gdb and apache2 which I got so far:
>
> Core was generated by `/usr/sbin/apache2 -k start'.
>
> Program terminated with signal 11, Segmentation fault.
>
> #0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value optimized out>, optype=<value optimized out>,
>
>      network_order=-1547829216, res=<value optimized out>) at Storable.xs:3873
>
> 3873            return newSVpv(mbase, MBUF_SIZE());
>
> (gdb) bt
>
> #0  mbuf2sv (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value optimized out>, optype=<value optimized out>,
>
>      network_order=-1547829216, res=<value optimized out>) at Storable.xs:3873
>
> #1  do_store (my_perl=0x2b60a36b94c0, f=<value optimized out>, sv=<value optimized out>, optype=<value optimized out>,
>
>      network_order=-1547829216, res=<value optimized out>) at Storable.xs:3833
>
> #2  0x00002b608bf0856b in XS_Storable_mstore (my_perl=0x2b60a36b94c0, cv=<value optimized out>) at Storable.xs:6427
>
> #3  0x00002b6085e54045 in Perl_pp_entersub () from /usr/lib/libperl.so.5.10
>


Looks like you are using Storable to stream out cookies?  Looks like something in there is causing Storable to puke.  I see things like array_call, store_blessed, store_hash... So I'm guessing your passing Storable some kind of object?  Does it have any recursive parts?

I googled "perl storable seg fault" and it looks like people have gotten Storable to seg fault before.  I'm not sure if the stack trace is reading objects or writing them.  Maybe you can glean from other's what makes Storable segfault.

First figure out if its reading or writing that causes the problem, then try to figure out what part of the object is so upsetting.

> 3873            return newSVpv(mbase, MBUF_SIZE());

Hum... any chance that is really really big?

-Andy