BTrey has asked for the wisdom of the Perl Monks concerning the following question:

I'm trying to teach myself Dancer and using Apache and mod_fcgid on my Debian virtual server to do so. I've created a basic application called 'unite' and made some simple modifications to the automatically generated files. The issue I'm running into is that sometimes the page loads and sometimes it does not. Let me explain.

Loading the page will sometime give me an error:

Internal Server Error: The server encountered an internal error or misconfiguration and was unable to complete your request.

Checking the Apache logs, I get:

Error while loading /var/www/unite/bin/app.psgi: Attempt to reload unite.pm aborted.\nCompilation failed in require at /var/www/unite/bin/app.psgi line 8.\nBEGIN failed--compilation aborted at /var/www/unite/bin/app.psgi line 8.\n

Simply reloading the page once or twice will "fix" the issue, at least for a few page loads. If this is an Apache configuration error then it's obviously off topic here and I'll be happy to request assistance in a more appropriate forum. But since the error is a Perl module load error, I though I'd start here.

Replies are listed 'Best First'.
Re: Dancer and Apache (::Reload?)
by tye (Sage) on Dec 08, 2015 at 01:57 UTC

    Are you using Apache::Reload? Try disabling that. It does things that are a bit... hinky; so sometimes things go wrong.

    - tye        

      I wasn't aware of using it. I went through my config, including apache2.conf, everything under mods-enabled, sites.enabled, conf.d, etc. both manually and using grep and was unable to find any reference to it. However, I found package libapache2-reload-perl installed on my system. I uninstalled it, restarted Apache and haven't seen the issue reoccur. Thanks to you and the other responders.
Re: Dancer and Apache
by dsheroh (Monsignor) on Dec 08, 2015 at 09:17 UTC
    Which Dancer environment are you running in? "development" or "production"? Check the corresponding file in enviroments/ for the value of auto_reload. It should be 0, but the "attempt to reload" makes me suspect that it may be enabled.

    As for why it's happening, my theory would be that your program works fine the first time it's run in a specific apache child process, but then subsequent requests to the same child (presumably incorrectly) detect that unite.pm has changed and attempt to reload it, which fails. But that's just a half-assed theory since the details of your situation are a little sparse.

Re: Dancer and Apache
by Anonymous Monk on Dec 08, 2015 at 00:58 UTC

    If this is an Apache configuration error then it's obviously off topic here and I'll be happy to request assistance in a more appropriate forum. But since the error is a Perl module load error, I though I'd start here.

    Does it matter?

    How can I reproduce this problem?