Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I'm working on a Catalyst project involving DB usage and I've noticed a strange and probably buggy behaviour when using the built-in HTTP server engine.
Firstly, here are version details: Perl 5.10 on Linux (SuSE), Catalyst v5.80032, Catalyst::Model::DBI v0.28, Oracle 10g on a remote server
I have reduced my issue to the simplest one: I have built an absolutely new Catalyst application (just "catalyst.pl MyApp") + TT view, then I have added a new Catalyst::Model::DBI model:
./script/dummy_create.pl model DB DBI dbi:Oracle:DUMMYThe config from the model:
__PACKAGE__->config( dsn => 'dbi:Oracle:DUMMY', username => 'dummyuser', password => 'dummypass', options => { AutoCommit => 1 }, );
And only one method in the 'DB.pm' model:
sub dummyMethod { my ( $self, $id ) = @_; my $r = $self->dbh->selectrow_hashref("SELECT id, name FROM us +ers WHERE id = $id"); return $r; }
Inside the 'index' action of the Root.pm controller I just put a call to this dummyMethod() and the result is dump'ed
sub index :Path :Args(0) { my ( $self, $c ) = @_; my $data = $c->model("DB")->dummyMethod(12); $c->stash->{data} = Data::Dump::pp($data); $c->stash->{template} = 'homepage.tt2'; }
Now about the behaviour. Everything works fine (I mean it's possible to access the application as it should, it returns the dump'ed data and so on) except the restarting procedure. If I launch the application and I do not access it at all, then Catalyst is restarting the application correctly on every code change. If I launch the app and I access it at least once, Catalyst will not be able to restart the app if a change in the code is made, it just prints out:
Attempting to restart the serverand is waiting in this state.
I have to kill the perl processes manually to be able to launch again my app. When I'm not using database connections (a self-sufficient standalone app), it is restarting correctly every time
So, what do you think? am I doing smth wrong? or a Catalyst bug? or maybe a Catalyst::Model::DBI bug? any ideas?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: built-in Catalyst server restarting issue
by Your Mother (Archbishop) on Nov 07, 2011 at 14:50 UTC | |
by art84 (Initiate) on Nov 07, 2011 at 16:14 UTC | |
by AbrekUS (Acolyte) on Jul 06, 2012 at 17:31 UTC |