FAQ
Good evening,

I updated heaps of modules on my dev server last night, and my
app broke horribly. Various errors in the log, common one being:

Caught exception in engine "Wrong Content-Length value: xxxx"

I reverted to a backup and updated modules in small batches. The
error returned when updating
Catalyst::Plugin::Session::State::URI v0.14.

The change notes indicate a couple things I probably should
focus on:

- Fix behaviour when debug is turned on by wrapping prepare_path
rather than prepare_action (RT#56753).
- Fix for loading the session ID with a cookie for some actions
and Session::State::URI for others (RT#57620)

I'm guessing the error is due to the change from prepare_action
to prepare_path but I don't know enough about the C::Engine
internals to figure out what the real problem is. Or maybe it's
not even a problem with C::Engine, and that's just where
exception gets thrown.

During my testing I determined the issue happens when running
under both myapp_server and myapp_fastcgi. (So I don't think
it's an issue specific to C::Engine::HTTP or C::Engine::FastCGI.)

Can anyone help with the debug process from here? What should I
try next? What other info should I provide?

Plugin list is:

__PACKAGE__->setup(qw/
ConfigLoader
AutoCRUD
Static::Simple
Params::Nested
I18N
Unicode::Encoding
Cache::HTTP

Session
Session::Store::DBIC
Session::State::Cookie
Session::State::URI

Authentication
Authorization::Roles
Authorization::ACL
RequireSSL

Cache
/);


Just using C::P::Session::State::URI v0.13 for now is fine. But
I'd like to get this solved before pushing changes to production.

Thanks,
Charlie

--
? Charlie Garrison <charlie@garrison.com.au>
? Garrison Computer Services <http://www.garrison.com.au>

() ascii ribbon campaign - against html e-mail
/\ www.asciiribbon.org - against proprietary attachments
? http://www.ietf.org/rfc/rfc1855.txt

Search Discussions

  • Ash Berlin at Aug 19, 2010 at 12:17 pm

    On 19 Aug 2010, at 13:07, Charlie Garrison wrote:
    Good evening,

    I updated heaps of modules on my dev server last night, and my app broke horribly. Various errors in the log, common one being:

    Caught exception in engine "Wrong Content-Length value: xxxx"

    I see this error occasionally when I restart a server and the client is in the middle of a request and retries. Does this error happen every time? Including once you close the browser and using lwp-request etc.?

    -ash
    I reverted to a backup and updated modules in small batches. The error returned when updating Catalyst::Plugin::Session::State::URI v0.14.

    The change notes indicate a couple things I probably should focus on:

    - Fix behaviour when debug is turned on by wrapping prepare_path
    rather than prepare_action (RT#56753).
    - Fix for loading the session ID with a cookie for some actions
    and Session::State::URI for others (RT#57620)

    I'm guessing the error is due to the change from prepare_action to prepare_path but I don't know enough about the C::Engine internals to figure out what the real problem is. Or maybe it's not even a problem with C::Engine, and that's just where exception gets thrown.

    During my testing I determined the issue happens when running under both myapp_server and myapp_fastcgi. (So I don't think it's an issue specific to C::Engine::HTTP or C::Engine::FastCGI.)

    Can anyone help with the debug process from here? What should I try next? What other info should I provide?

    Plugin list is:

    __PACKAGE__->setup(qw/
    ConfigLoader
    AutoCRUD
    Static::Simple
    Params::Nested
    I18N
    Unicode::Encoding
    Cache::HTTP

    Session
    Session::Store::DBIC
    Session::State::Cookie
    Session::State::URI

    Authentication
    Authorization::Roles
    Authorization::ACL
    RequireSSL

    Cache
    /);


    Just using C::P::Session::State::URI v0.13 for now is fine. But I'd like to get this solved before pushing changes to production.

    Thanks,
    Charlie
  • Charlie Garrison at Aug 19, 2010 at 3:47 pm
    Good morning,

    On 19/08/10 at 1:17 PM +0100, Ash Berlin
    wrote:
    Caught exception in engine "Wrong Content-Length value: xxxx"

    I see this error occasionally when I restart a server and the
    client is in the middle of a request and retries. Does this
    error happen every time? Including once you close the browser
    and using lwp-request etc.?
    I've tested with different clients and different servers; the
    behavior is consistent. I upgrade to C::P::Session::State::URI
    v0.14 and the problem starts. I downgrade to
    C::P::Session::State::URI v0.13 and the problem goes away.

    I failed to mention in my original message; the problem
    manifests with POST requests. I'm not sure whether GET requests
    are immune, but POST requests with size >0 will always fail.

    At this point I don't know whether to approach this as bug with
    C::P::Session::State::URI or with my app. Or how to determine
    which it might be. I can dive into the debugger, but I was
    hoping someone with better knowledge of Catalyst internals might
    have some ideas where I should look first.

    Thanks,
    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt
  • Bryan Opfer at Aug 19, 2010 at 4:12 pm

    I've tested with different clients and different servers; the behavior is
    consistent. I upgrade to C::P::Session::State::URI v0.14 and the problem
    starts. I downgrade to C::P::Session::State::URI v0.13 and the problem goes
    away.

    I failed to mention in my original message; the problem manifests with POST
    requests. I'm not sure whether GET requests are immune, but POST requests
    with size >0 will always fail.
    I have the same exact behavior in my app after upgrading to 0.14. So,
    I don't think it is just your app. Interestingly, if I remove "param"
    from my config and use the mode where the session id is appended to
    the URI, then things work fine. But, if I use the session id in the
    param, it breaks just like your app.

    -Bryan
  • Charlie Garrison at Aug 19, 2010 at 5:12 pm
    Good morning,
    On 19/08/10 at 9:12 AM -0700, Bryan Opfer wrote:

    I have the same exact behavior in my app after upgrading to 0.14. So,
    I don't think it is just your app. Interestingly, if I remove "param"
    from my config and use the mode where the session id is appended to
    the URI, then things work fine. But, if I use the session id in the
    param, it breaks just like your app.
    We're hitting the same thing then. I've just been playing with
    C::P::Session::State::URI code and found that if I change line
    323 from:

    if ( my $sid = $c->request->param($param) ) {

    to:

    if ( my $sid = 0 ) {

    then the problem goes away. So without knowing more about Cat
    internals I would conclude that calling $c->request->param
    during `prepare_path` is creating problems elsewhere. I also tried:

    if ( my $sid = $c->request->parameters->{$param} ) {

    And that fails as well.

    I've tried following the code logic but I'm quickly getting lost
    in all the different prepare_* methods spread among Catalyst.pm
    and the different C::Engine modules.

    For now I've changed C::P::Session::State::URI with `sub
    prepare_action {...]` rather than `prepare_path` and my app is
    working. Hopefully someone with some better ideas than me can
    suggest what the proper fix is.


    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt
  • Ash Berlin at Aug 19, 2010 at 5:32 pm

    On 19 Aug 2010, at 18:12, Charlie Garrison wrote:
    Good morning,
    On 19/08/10 at 9:12 AM -0700, Bryan Opfer wrote:

    I have the same exact behavior in my app after upgrading to 0.14. So,
    I don't think it is just your app. Interestingly, if I remove "param"
    from my config and use the mode where the session id is appended to
    the URI, then things work fine. But, if I use the session id in the
    param, it breaks just like your app.
    We're hitting the same thing then. I've just been playing with C::P::Session::State::URI code and found that if I change line 323 from:

    if ( my $sid = $c->request->param($param) ) {

    to:

    if ( my $sid = 0 ) {

    then the problem goes away. So without knowing more about Cat internals I would conclude that calling $c->request->param during `prepare_path` is creating problems elsewhere. I also tried:

    if ( my $sid = $c->request->parameters->{$param} ) {
    Try changing parameters to query_parameters. It sounds like hitting params is causing it to read the body and mess things up when it comes to read the body again.

    Also if you could see to creating a (failing) regression test this would help.


    And that fails as well.

    I've tried following the code logic but I'm quickly getting lost in all the different prepare_* methods spread among Catalyst.pm and the different C::Engine modules.

    For now I've changed C::P::Session::State::URI with `sub prepare_action {...]` rather than `prepare_path` and my app is working. Hopefully someone with some better ideas than me can suggest what the proper fix is.


    Charlie
  • Charlie Garrison at Aug 19, 2010 at 6:32 pm
    Good morning,

    On 19/08/10 at 6:32 PM +0100, Ash Berlin
    wrote:
    if ( my $sid = $c->request->parameters->{$param} ) {
    Try changing parameters to query_parameters. It sounds like
    hitting params is causing it to read the body and mess things
    up when it comes to read the body again.
    Will do. And that fixes it, thanks.
    Also if you could see to creating a (failing) regression test this would help.
    I've been working on that. But apparently I don't know how to
    create a POST request with body parameters using Test::WWW::Mechanize::Catalyst.

    I'm trying to use something like this:

    $m->post_ok("http://localhost/uri/body_param",
    {content_type=>'application/x-www-form-urlencoded',content=>"body_param=value"},
    "post request");

    Any quick suggestions on what I'm doing wrong?


    Charlie

    --
    ? Charlie Garrison ? <garrison@zeta.org.au>

    O< ascii ribbon campaign - stop html mail - www.asciiribbon.org
    ? http://www.ietf.org/rfc/rfc1855.txt
  • Tomas Doran at Aug 19, 2010 at 7:14 pm

    On 19 Aug 2010, at 19:32, Charlie Garrison wrote:

    Good morning,
    On 19/08/10 at 6:32 PM +0100, Ash Berlin wrote:

    if ( my $sid = $c->request->parameters->{$param} ) {
    Try changing parameters to query_parameters. It sounds like hitting
    params is causing it to read the body and mess things up when it
    comes to read the body again.
    Will do. And that fixes it, thanks.
    Great, come grab a commit bit? :)
    Also if you could see to creating a (failing) regression test this
    would help.
    I've been working on that. But apparently I don't know how to create
    a POST request with body parameters using
    Test::WWW::Mechanize::Catalyst.

    I'm trying to use something like this:

    $m->post_ok("http://localhost/uri/body_param",
    {content_type=>'application/x-www-form-
    urlencoded',content=>"body_param=value"},
    "post request");

    Any quick suggestions on what I'm doing wrong?
    how about ->post_ok("http://localhost/uri/body_param",
    { body_param=value });

    Cheers
    t0m

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedAug 19, '10 at 12:07p
activeAug 19, '10 at 7:14p
posts8
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2021 Grokbase