[Catalyst] Troubleshooting FastCGI error

Dermot paikkos at googlemail.com
Wed Aug 13 11:08:12 BST 2008


Hi,

I have an odd problem with my tiny app. Under server script
(MyApp/script/myapp_server -d) it runs without error.  However under
fascgi I am encountering a problem with one of my controllers that
uses a FormFU. There an abridged version of the controller is pasted
below.


sub edit : Local :FormConfig('record_data/edit.yml') {
  my ($self, $c, $id) = @_;
  my $record_data = $c->model('MyAppDB::record_data')->find({'sub_id' => $id});
  unless($record_data) {
        $c->flash->{error_msg} = "Invalid submission $id -- Cannot edit";
        $c->response->redirect($c->uri_for('/submissions/list'));
        $c->detach;
  }
  my $form = $c->stash->{form};
# Update the HD and display the checkbox as checked.
  if ($record_data->sub_id->hasHD == 1) {
      my $watermarked = $form->get_field({name => 'hasHD'});
      $watermarked->checked($record_data->sub_id->hasHD);
  }
...
  if ($form->submitted_and_valid) {
        # create an entry
        # Update the validation flag on the submission
        $record_data->sub_id->update({validation_pass => 1});    #
Line 89. This line cause CascadeActions::update() error
        # Update the record_data
        $form->model->update($record_data);      # This line causes
Row::update_or_insert() error
        $c->flash->{status_msg} = 'metadata updated';
        $c->response->redirect($c->uri_for('/submissions/list'));
        $c->detach;
  }
  else {
        $form->model->default_values($record_data);
 }
 $c->stash->{template} = 'submissions/edit.tt2';
}


The controller loads the data from $c->model('MyAppDB::record_data')
fine and displays it in the form. It's when you attempt the
update/submit you get the error. So the issue seems to be with
$form->model->update($record_data);

My conf file has:

<Model::FormFu>
  stash_key form
</Model::FormFu>


The error in the http error log is:
:CascadeActions::update(): DBI Exception: DBD::SQLite::st execute
failed: unable to open database file(14) at dbdimp.c line 403 [for
Statement "UPDATE submissions SET validation_pass = ? WHERE ( id = ?
)"] at ..lib/MyApp/Controller/RecordData.pm line 89, referer: ...

DBIx::Class::Row::update_or_insert(): DBI Exception: DBD::SQLite::st
execute failed: unable to open database file(14) at dbdimp.c line 403
[for Statement "UPDATE clipData SET audio = ? WHERE ( id = ? )"] at
/usr/lib/perl5/site_perl/5.8.8/HTML/FormFu/Model/DBIC.pm line 324,


Server configuration.

DocumentRoot /var/www/MyApp/root
Alias /static  /var/www/MyApp/root/static

FastCgiServer /var/www/MyApp/script/myapp_fastcgi.pl -processes 3
Alias /motion /var/www/MyApp/script/myapp_fastcgi.pl/

Does anyone have any ideas what the problem might be? I can't see why
it might work in one environment and not the other.
Tia,
Dp.



More information about the Catalyst mailing list