Can't locate loadable object for module main in @INC
Asked Answered
E

3

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?

Extraordinary answered 20/1, 2017 at 16:16 Comment(5)
It means the binary component of the module (the .so) can't be found. How did you install MyHandler::ModPerl20?Expositor
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.Extraordinary
What is the loadable Object 'main' for a PerResponseHandler in mod_perl?Extraordinary
After restarting apache. Does this error appear again?Stratocracy
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.Extraordinary
E
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.

Extraordinary answered 28/4, 2017 at 11:52 Comment(1)
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!Shreve
T
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.

Tulley answered 28/1, 2017 at 20:32 Comment(3)
@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?Extraordinary
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.Tulley
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 objectExtraordinary
E
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.

Extraordinary answered 28/4, 2017 at 11:52 Comment(1)
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!Shreve
R
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.

Rendarender answered 31/1, 2017 at 10:1 Comment(1)
How can one check IO-Modules? What exactly does this mean?Extraordinary

© 2022 - 2024 — McMap. All rights reserved.