[Catalyst] Hangs in RenderView in "end"

Gunnar Strand gunnarstrand at yahoo.com
Sun Jun 28 06:35:02 GMT 2009


Hi,

I am new to the Catalyst framework and am running Catalyst on Kubuntu Linux using the built-in server with the TT view and DBIC database backend.

My problem is that sometimes the "end" sub in Root.pm hangs. All it has is the RenderView action (as generated by Catalyst), so I assume that is the culprit.

If I return the same template as was previously displayed on the page, then it hangs. There appears to be other occasions as well, but I haven't found any pattern yet.

Here is an example output from the terminal:

[info] *** Request 11 (0.000/s) [5758] [Sun Jun 28 08:11:16 2009] ***
[debug] Body Parameters are:
.-------------------------------------+--------------------------------------.
| Parameter                           | Value                                |
+-------------------------------------+--------------------------------------+
| Create                              | Create user                          |
| password                            | x                                    |
| username                            | kalle                                |
| verify_password                     | y                                    |
'-------------------------------------+--------------------------------------'
[debug] "POST" request for "users/create" from "127.0.0.1"
[debug] Path is "users/create"
[debug] Found sessionid "29eee4bdb13bf24aa256c7dfebd87a5816ee5bc9" in cookie
[debug] Restored session "29eee4bdb13bf24aa256c7dfebd87a5816ee5bc9"
[debug] Rendering template "users/create_form.tt2"
[info] Request took 795.658106s (0.001/s)
.------------------------------------------------------------+-----------.
| Action                                                     | Time      |
+------------------------------------------------------------+-----------+
| /users/create                                              | 0.005603s |
| /end                                                       | 795.6377s |
|  -> Cupper::View::TT->process                              | 795.6356s |
'------------------------------------------------------------+-----------'

As you can see, "end" has hanged in 795 seconds, and this output was not printed until AFTER I hit "Stop" in Firefox. Below is the code in users/create:

sub create : Local : ActionClass('Restricted') {
  my ( $self, $c ) = @_;

  # Retrieve the values from the form
  my $username        = $c->request->params->{username};
  my $password        = $c->request->params->{password};
  my $verify_password = $c->request->params->{verify_password};

  if ( ! $username || 4 < length $username ) {
    $c->stash->{error_msg} = $c->localize('User name must be at least 5 characters long.');
    $c->stash->{template} = 'users/create_form.tt2';
    return;    
  }

  if ( $password ne $verify_password ) {
    $c->stash->{error_msg} = $c->localize('Passwords does not match.');
    $c->stash->{template} = 'users/create_form.tt2';
    return;    
  }

  # Create the user
  my $user = $c->model('DB::Users')->create(
                                            {
                                              user_id  => 1,
                                              username => $username,
                                              password => $password,
                                            }
                                          );

  # Store new model object in stash
  $c->stash->{template} = 'users/list.tt2';
}


This particular request should take the "$password ne $verify_password" path and return the user to the "users/create_form" function.

Here is the content of the "Restricted" action:

sub execute {
  my $self = shift;
  my ( $controller, $c, $test ) = @_;

  unless ( $c->user_exists() ) {
    warn "BEFORE redirect";
    $c->forward('/users/login_form');
    warn "AFTER redirect";
    return;
  }
  $self->NEXT::execute(@_);
}


I am unable to run a debugger on the catalyst server (I get a segmantation fault), so it is difficult to find exactly where 
problem is.

Any help is appreciated.

KR,
Gunnar



      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20090627/f292aecd/attachment.htm


More information about the Catalyst mailing list