9

In a mod_perl application running on ubuntu 16.04 after a certain while where everything functions fine (a few days) we get a fatal message in the errorlog:

failed to resolve handler MyHandler::ModPerl20 Can't locate loadable object for module main in @INC

MyHander::ModPerl20 is defined in a location block

<Perl>
     unshift @INC, '/path/to/my/code';
</Perl>
<Location ~ "/imp($|/)">
    SetHandler modperl
    PerlResponseHandler MyHandler::ModPerl20
</Location>

The ubuntu Perl Version is 5.22. Apache 2.4

Can this be the problem? http://blog.feature-addons.de/2016-05-15-otrs-apache-mod-perl-perl-5-22

Any ideas how to fix this? Do I really have to set up nginx/uwsgi?

Georg Mavridis
  • 2,312
  • 1
  • 15
  • 23
  • It means the binary component of the module (the .so) can't be found. How did you install MyHandler::ModPerl20? – ikegami Jan 20 '17 at 18:46
  • MyHandler::ModPerl20 is a pure Perl Handler written by me. It does not have any .so File. It does work @ the same installation without any problem for a few days. – Georg Mavridis Jan 23 '17 at 09:16
  • What is the loadable Object 'main' for a PerResponseHandler in mod_perl? – Georg Mavridis Jan 23 '17 at 09:17
  • After restarting apache. Does this error appear again? – Eugen Konkov Jan 26 '17 at 14:17
  • After restarting apache, everything is fine (This is currently the workaround we use, to restart the apache once every 24h per cron-job). But i was afraid I have made a "mistake" buried deep inside and want to know, where i have to look for errors made by me. – Georg Mavridis Jan 26 '17 at 15:58

3 Answers3

2

Make sure @INC is set up correctly, in order to find the path in which MyHandler::ModPerl20 is installed (I think what happens is that when Apache recycles some child, the one starting fresh do not have the correct @INC value, hence not finding your module anymore).

Try to add a PerlSwitches -I/your/path/for/myhandler/ in httpd.conf to see if it fixes your problem.

If that changes things, have a look at Adjusting @INC in modperl documentation to see all details.

Patrick Mevzek
  • 10,995
  • 16
  • 38
  • 54
  • 1
    @INC is set up correctly (I updated the question with the code used). Anyway how could it be functioning correctly for a few hundreds requests, and then crash with the message given? And why is the Apache/mod_perl looking for module main in my Handler? – Georg Mavridis Jan 30 '17 at 10:04
  • Because from vague memory I had a similar problem that was solved by changing how to set up @INC. The result can change depending on how Apache/its child are being started. You loose nothing by trying the `PerlSwitches` statement suggested and even putting your MyHandler::ModPerl20 perl module in one of the path hardcoded in perl default @INC on your site to see if it makes your problem disappear. – Patrick Mevzek Jan 30 '17 at 21:56
  • 1
    I cannot imagine that this is the problem, sorry :( IF the @INC gets wrong, I would get an error-message like: `failed to resolve handler 'MyHandler::ModPerl20': Can't locate MyHandler/ModPerl20.pm in @INC` and not `Can't locate loadable object` – Georg Mavridis Feb 01 '17 at 11:17
1

Changing the MPM Apache configuration from mpm_event to mpm_prefork solved my problem.

It does not explain the error message though :( Any hints on this are appreciated.

Georg Mavridis
  • 2,312
  • 1
  • 15
  • 23
  • Just had this exact same problem when upgrading Perl. It must be some kind of race condition in my module and/or mod_perl. Thanks for the tip! – kchoose2 Apr 30 '21 at 20:29
0

I have seen something similar other times, not only with SAS, but with other products as well.

I would ask your system admin to check the IO modules in your Linux server. I think they need re-installation, or maybe just check the authorizations on the relative folders.