2

I have a Perl Catalyst application which is launched normally using the -r parameter. I have noticed 2 types of behaviour:

1) the application restarts normally on every "dummy change" of the code (by "dummy change" I mean adding a space or deleting one, smth like this)

2) the application doesn't restart (the same "dummy change"), the "Attempting to restart the server" text is displayed and the app remains blocked in this state (I have to kill it manually)

The behaviour depends on the actual code. It seems there is something related to the code which influences which behaviour acts at one moment. The behaviour is constant, i.e. the same code have one constant behaviour of 2.
The application itself seems to work fine, without any errors or warnings.

How could the code influence this behaviour? (I mean generally) What factors are related to restart mechanism?

ArtM
  • 41
  • 2

2 Answers2

1

That is because signal handling has changed in the newer version of the Oracle client. Use the "ora_connect_with_default_signals" option to restore default signal handler.

Here is how you can do it in the DBIx::Class model (MyApp::Model::DB):

connect_info => [
    'dbi:Oracle:mydb',
    'username',
    'password',
    {
        ora_connect_with_default_signals => [ 'INT' ],
    },
],

or in the config file:

<Model DBIC>
    connect_info  dbi:Oracle:mydb
    connect_info  username
    connect_info  password
    <connect_info>
        ora_connect_with_default_signals [ INT ]
    </connect_info>
</Model>
0

I have seen similar behaviour when using a standalone server via PSGI (ie plackup -r), where the server restarts once, and subsequent code changes produce the message but no restart.

However, I have never seen the built-in server myapp_server.pl -r behave in this manner. Any change to a perl module, YAML file etc triggers the restart successfully.

In the brief research I did on it at the time I did turn up this discussion of Plack and restart.

RET
  • 9,100
  • 1
  • 28
  • 33
  • It could be something related to DB connections. Further experiments revealed that the app doesn't restart if it was accessed (from the browser, for example). I suppose there could be some kind of open connections to DB which keep the app running and they don't let it restart noramlly. I'm using Catalyst::Model::DBI. Any ideas? – ArtM Aug 17 '11 at 15:40
  • That's a possibility, although I've not seen it occur with Cat apps I've written with MySQL, Informix or SQLite. If you ->disconnect from the database at the end of a request cycle (and this generally requires separating the RenderView from the end handler, if your templates access the database), does that change the behaviour? – RET Aug 17 '11 at 23:39
  • I've added an explicit *disconnect* in the *end* handler (RenderView is moved to another sub and *forward* is used). Now the DB handler gets disconnected after each request (added a debug message in the DBI model to see this). The behaviour is unchanged. If this could help, I'm using Oracle. – ArtM Aug 18 '11 at 12:16
  • We are talking about the standalone Catalyst development server, yeah? myapp_server.pl or similar? One thought: the "watching" behaviour is rooted from the current working directory where it's invoked. Are you always launching as bin/myapp_server.pl from the MyApp directory, or is MyApp/bin in your $PATH and launched from anywhere? – RET Aug 19 '11 at 06:13