How do you debug mod_perl2 module without restarting?

Environment: Apache / 2.2.11 (Win32) mod_apreq2-20051231 / 2.6.2-dev mod_perl / 2.0.4-dev Perl / v5.10.0

The situation is very similar to what is described in this message list , except that you are on win32.

I have this in httpd.conf:

PerlModule Apache2::Reload
PerlInitHandler Apache2::Reload
PerlSetVar ReloadAll Off
PerlSetVar ReloadModules "MyPackage::*"

... as well as just a mod-perl script.

I have a script that uses the MyPackage module and it works.

I will break the module and reload the script. The error is useful by telling the line where I broke the module.

(If I restart again at this moment, and he only tells me the "Undefined routine & ModPerl :: ROOT :: ModPerl :: Registry ..." because he could not load the file first, but in any case the following behavior still occurs .)

I canceled the gap and touched the script file to reload the module and reload. Now he says:

Attempt to reload MyPackage/Foo.pm aborted.
Compilation failed in require at E:/dev/test.pl line 4.

And even if I touch the script and the module, I cannot get it to restart correctly, except for restarting the web server.

Violation of the script itself (as opposed to the module) works fine: correct errors and changing it back leads to the fact that it works again on reboot.

After each of these things, I restarted the web server before testing:

  • I tried to make a trace, but that it continues to fail on is the version of ModPerl / RegistryCooker.pm 204, which is just eval {} s whole script.

  • I tried to change the "use warnings" FATAL => 'all' "just" use warnings "in the script and module. It doesn't matter.

  • $ SIG {__ DIE__}. . (, , , .)

  • , MaxRequestsPerChild 0, ThreadsPerChild 1, . MaxRequestsPerChild 1, , - :

    Child 7072: Process exiting because it reached MaxRequestsPerChild. Signaling the parent to restart a new child process.
    Parent: Received restart signal -- Restarting the server.
    

    , , .

  • httpd , -X "", ( 3 .) -. -. httpd -X . - , . , -X , httpd -?. , win32 MPM?

  • :

    , , , unloaded , (, BEGIN) .

    . " script", , "my $var" , , , .

mod_perl2 - (, MaxRequestsPerChild , )?

+3
1

sub script, , :

package MyPackage::Foo;
no warnings 'redefine';

, - .

+2

Source: https://habr.com/ru/post/1703060/


All Articles