FAQ
Hi folks,

Recently after upgrading all of Catalyst, I'm witnessing some weird
behaviour in some apps. I'm using Catalyst::Plugin::Session::Store::DBIC
to store my sessions, and when I have DBIC_TRACE going, I see this:

BEGIN WORK
SELECT me.id, me.session_data, me.expires FROM session me WHERE ( me.id
= ? ): 'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722'
COMMIT
UPDATE session SET expires = ? WHERE ( id = ? ): '1272443848',
'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722

Not once per request, but up to 50 times in a single request. Is this
something wrong in my code or is C::P::S::S::DBIC going nuts?

--
Ben van Staveren
phone: +62 81 70777529
email: benvanstaveren@gmail.com

Search Discussions

  • Moritz Onken at Apr 27, 2010 at 9:57 am
    I had the same problem. I boiled it down to Static::Simple. Each request
    to a static resource issued a session update. In a recent
    release of cat the handling of requests seemed to have changed.
    Try downgrading to 5.80018 which fixed it for me (which is not a good
    solution, but I have no time right know to fix it in catalyst or
    write a test).


    On Tue, 27 Apr 2010 15:42:21 +0700, Ben van Staveren
    wrote:
    Hi folks,

    Recently after upgrading all of Catalyst, I'm witnessing some weird
    behaviour in some apps. I'm using Catalyst::Plugin::Session::Store::DBIC
    to store my sessions, and when I have DBIC_TRACE going, I see this:

    BEGIN WORK
    SELECT me.id, me.session_data, me.expires FROM session me WHERE ( me.id
    = ? ): 'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722'
    COMMIT
    UPDATE session SET expires = ? WHERE ( id = ? ): '1272443848',
    'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722

    Not once per request, but up to 50 times in a single request. Is this
    something wrong in my code or is C::P::S::S::DBIC going nuts?
  • Ben van Staveren at Apr 27, 2010 at 10:07 am
    Hi Moritz,

    Yeah I just figured that one out - but that's new, never saw it do this
    before to be honest - it's not a big deal actually since in production
    Static::Simple isn't used and I let lighttpd take care of serving static
    files, but in testing it's a bit disconcerting to see it crop up all of
    a sudden :)

    Thanks! :D

    Moritz Onken wrote:
    I had the same problem. I boiled it down to Static::Simple. Each request
    to a static resource issued a session update. In a recent
    release of cat the handling of requests seemed to have changed.
    Try downgrading to 5.80018 which fixed it for me (which is not a good
    solution, but I have no time right know to fix it in catalyst or
    write a test).


    On Tue, 27 Apr 2010 15:42:21 +0700, Ben van Staveren
    wrote:
    Hi folks,

    Recently after upgrading all of Catalyst, I'm witnessing some weird
    behaviour in some apps. I'm using Catalyst::Plugin::Session::Store::DBIC
    to store my sessions, and when I have DBIC_TRACE going, I see this:

    BEGIN WORK
    SELECT me.id, me.session_data, me.expires FROM session me WHERE ( me.id
    = ? ): 'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722'
    COMMIT
    UPDATE session SET expires = ? WHERE ( id = ? ): '1272443848',
    'session:fe3baeddb6ec2d3a14b07651a8792c7b85df9722

    Not once per request, but up to 50 times in a single request. Is this
    something wrong in my code or is C::P::S::S::DBIC going nuts?
    _______________________________________________
    List: Catalyst@lists.scsys.co.uk
    Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
    Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/
    Dev site: http://dev.catalyst.perl.org/
    --
    Ben van Staveren
    phone: +62 81 70777529
    email: benvanstaveren@gmail.com

    -------------- next part --------------
    An HTML attachment was scrubbed...
    URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20100427/5835e1f9/attachment.htm
  • Matt S Trout at Apr 28, 2010 at 2:50 pm

    On Tue, Apr 27, 2010 at 05:07:36PM +0700, Ben van Staveren wrote:
    Hi Moritz,

    Yeah I just figured that one out - but that's new, never saw it do this
    before to be honest - it's not a big deal actually since in production
    Static::Simple isn't used and I let lighttpd take care of serving static
    files, but in testing it's a bit disconcerting to see it crop up all of
    a sudden :)
    Check your plugin order; this doesn't normally happen because Static::Simple
    bypasses the loading of the session. If you've tried it both before and
    after you load your session plugins, come back to us with the versions of
    all the plugins you're loading and we'll dig further.

    --
    Matt S Trout Catalyst and DBIx::Class consultancy with a clue
    Technical Director and a commit bit: http://shadowcat.co.uk/catalyst/
    Shadowcat Systems Limited
    mst (@) shadowcat.co.uk http://shadowcat.co.uk/blog/matt-s-trout/
  • Ben van Staveren at Apr 28, 2010 at 3:58 pm
    Hi Matt,
    Check your plugin order; this doesn't normally happen because Static::Simple
    bypasses the loading of the session. If you've tried it both before and
    after you load your session plugins, come back to us with the versions of
    all the plugins you're loading and we'll dig further.
    Current load order:

    use Catalyst qw/-Debug
    ConfigLoader
    Unicode
    Compress
    Authentication
    Authorization::Roles
    Session
    Session::State::Cookie
    Session::Store::DBIC
    Static::Simple/;

    This makes the "weird" happen. If I move Static::Simple to right after
    ConfigLoader, it still happens. Seeing as it happens when things go on
    with Session (e.g. Session updating itself for expiry time), it seems
    that plugin load order has no effect, unless there's some weirdness
    happening with another of those modules.

    Like I said though, for me it's not a big deal that this happens, now
    that I know what causes it, I'm not worried about this showing up on my
    app_server.pl output during development. For production DBIC_TRACE is
    forced off and Static::Simple is never loaded :)

    Thanks though :D



    --
    Ben van Staveren
    phone: +62 81 70777529
    email: benvanstaveren@gmail.com
  • Matt S Trout at Apr 28, 2010 at 5:15 pm

    On Wed, Apr 28, 2010 at 10:58:58PM +0700, Ben van Staveren wrote:
    Hi Matt,
    Check your plugin order; this doesn't normally happen because
    Static::Simple
    bypasses the loading of the session. If you've tried it both before and
    after you load your session plugins, come back to us with the versions of
    all the plugins you're loading and we'll dig further.
    Current load order:

    use Catalyst qw/-Debug
    ConfigLoader
    Unicode
    Compress
    Authentication
    Authorization::Roles
    Session
    Session::State::Cookie
    Session::Store::DBIC
    Static::Simple/;

    This makes the "weird" happen. If I move Static::Simple to right after
    ConfigLoader, it still happens. Seeing as it happens when things go on
    with Session (e.g. Session updating itself for expiry time), it seems
    that plugin load order has no effect, unless there's some weirdness
    happening with another of those modules.
    Right after ConfigLoader ... shouldn't do that.

    Honestly, the session shouldn't be UPDATEd at all in that case.
    Like I said though, for me it's not a big deal that this happens, now
    that I know what causes it, I'm not worried about this showing up on my
    app_server.pl output during development. For production DBIC_TRACE is
    forced off and Static::Simple is never loaded :)
    Which is great. But a lot of users leave Static::Simple loaded, so while
    it's not going to bother you it -will- bother them.

    So, in the name of paying karma forwards, any chance I could have the
    versions anyway please?

    --
    Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue

    http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/

    Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst
    commercial support, training and consultancy packages could help your team.
  • Moritz Onken at Apr 29, 2010 at 12:10 am

    Right after ConfigLoader ... shouldn't do that.

    Honestly, the session shouldn't be UPDATEd at all in that case.
    Like I said though, for me it's not a big deal that this happens, now
    that I know what causes it, I'm not worried about this showing up on my
    app_server.pl output during development. For production DBIC_TRACE is
    forced off and Static::Simple is never loaded :)
    Which is great. But a lot of users leave Static::Simple loaded, so while
    it's not going to bother you it -will- bother them.

    So, in the name of paying karma forwards, any chance I could have the
    versions anyway please?

    I updated all Plugins to the latest version using
    cpan> upgrade /^Catalyst/

    Still the same behaviour.

    cheers,
    mo
  • Matt S Trout at Apr 29, 2010 at 8:50 pm

    On Thu, Apr 29, 2010 at 08:10:29AM +0800, Moritz Onken wrote:
    Still the same behaviour.
    See my reply downthread for how I'd recommend trying to diagnose this.

    --
    Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue

    http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/

    Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst
    commercial support, training and consultancy packages could help your team.
  • Moritz Onken at Apr 29, 2010 at 12:34 am

    Right after ConfigLoader ... shouldn't do that.

    Honestly, the session shouldn't be UPDATEd at all in that case.
    Like I said though, for me it's not a big deal that this happens, now
    that I know what causes it, I'm not worried about this showing up on my
    app_server.pl output during development. For production DBIC_TRACE is
    forced off and Static::Simple is never loaded :)
    Which is great. But a lot of users leave Static::Simple loaded, so while
    it's not going to bother you it -will- bother them.

    So, in the name of paying karma forwards, any chance I could have the
    versions anyway please?

    I updated all Plugins to the latest version using
    cpan> upgrade /^Catalyst/

    Still the same behaviour.

    cheers,
    mo
  • Ben van Staveren at Apr 29, 2010 at 1:50 am

    Which is great. But a lot of users leave Static::Simple loaded, so while
    it's not going to bother you it -will- bother them.

    So, in the name of paying karma forwards, any chance I could have the
    versions anyway please?
    *Cough* remind me not to answer emails late at night :D

    Okay I've got the following:

    Catalyst 5.80022
    Static::Simple 0.29
    Session 0.27
    Session::Store::DBIC 0.11

    --
    Ben van Staveren
    phone: +62 81 70777529
    email: benvanstaveren@gmail.com
  • Tomas Doran at Apr 29, 2010 at 9:57 am
    On 29 Apr 2010, at 02:50, Ben van Staveren wrote:
    Which is great. But a lot of users leave Static::Simple loaded, so
    while
    it's not going to bother you it -will- bother them.

    So, in the name of paying karma forwards, any chance I could have the
    versions anyway please?
    *Cough* remind me not to answer emails late at night :D

    Okay I've got the following:

    Catalyst 5.80022
    Static::Simple 0.29
    Session 0.27
    Session::Store::DBIC 0.11
    Thanks. I'll try to look into this at the NPW hackathon this weekend.

    Cheers
    t0m
  • Ben van Staveren at Apr 29, 2010 at 3:04 pm
    Hi Tom,
    *Cough* remind me not to answer emails late at night :D

    Okay I've got the following:

    Catalyst 5.80022
    Static::Simple 0.29
    Session 0.27
    Session::Store::DBIC 0.11
    Thanks. I'll try to look into this at the NPW hackathon this weekend.
    Awesome. I'm trying to find a little spare time at $job to take a look
    at it as well but I'm pretty new to Catalyst guts (and Moose), so not
    really making much progress on fixing the problem. Learning a lot though
    so it's all good :D

    --
    Ben van Staveren
    phone: +62 81 70777529
    email: benvanstaveren@gmail.com
  • Matt S Trout at Apr 29, 2010 at 8:50 pm

    On Thu, Apr 29, 2010 at 10:04:38PM +0700, Ben van Staveren wrote:
    Hi Tom,
    *Cough* remind me not to answer emails late at night :D

    Okay I've got the following:

    Catalyst 5.80022
    Static::Simple 0.29
    Session 0.27
    Session::Store::DBIC 0.11
    Thanks. I'll try to look into this at the NPW hackathon this weekend.
    Awesome. I'm trying to find a little spare time at $job to take a look
    at it as well but I'm pretty new to Catalyst guts (and Moose), so not
    really making much progress on fixing the problem. Learning a lot though
    so it's all good :D
    I'm wondering what's creating the session in that action at all.

    A static file serve shouldn't have to bother doing it.

    Were I you I'd add some Carp::cluck calls or something in $c->session and
    friends (you're allowed to crack open your own copy of the Session.pm file
    - just copy it into lib/Catalyst/Plugin in your checkout first :)

    Doing that should show you where they're called from, which should tell us
    what inside the session code is getting hit during a static request and
    why that's happening.

    My first guess would be "the code to auto-extend session expiry is being
    triggered". But I've not dug into the code properly to see if that's it yet.

    --
    Matt S Trout - Shadowcat Systems - Perl consulting with a commit bit and a clue

    http://shadowcat.co.uk/blog/matt-s-trout/ http://twitter.com/shadowcat_mst/

    Email me now on mst (at) shadowcat.co.uk and let's chat about how our Catalyst
    commercial support, training and consultancy packages could help your team.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedApr 27, '10 at 8:42a
activeApr 29, '10 at 8:50p
posts13
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase