nayakgi / perl-compiler

Automatically exported from code.google.com/p/perl-compiler
Other
0 stars 0 forks source link

SUPER on run-time loaded IO::Socket does not find compiled IO::Handle->autoflush #340

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?

> perlcc -O3 -v2 -r -e 'eval q/use Net::DNS/; my $new = 
"IO::Socket::INET6"->can("new") or die "new"; my $inet = 
$new->("IO::Socket::INET6", LocalAddr => q/localhost/, Proto => 'udp', 
LocalPort => undef); print ref($inet)."\n" '
/usr/local/cpanel/3rdparty/perl/514/bin/perlcc: Calling 
/usr/local/cpanel/3rdparty/perl/514/bin/perl 
-I/root/.dotfiles/perl-must-have/lib -I/root/perl5/lib/perl5/ 
-I/usr/local/cpanel -MO=C,-O2,-opcctr7zw.c -e 'eval q/use Net::DNS/; my $new = 
"IO::Socket::INET6"->can("new") or die "new"; my $inet = 
$new->("IO::Socket::INET6", LocalAddr => q/localhost/, Proto => udp, LocalPort 
=> undef); print ref($inet)."\n" '
/usr/local/cpanel/3rdparty/perl/514/bin/perlcc: Running code ./a.out
Out of memory!

What is the expected output? 
> perl -e 'eval q/use Net::DNS/; my $new = "IO::Socket::INET6"->can("new") or 
die "new"; my $inet = $new->("IO::Socket::INET6", LocalAddr => q/localhost/, 
Proto => 'udp', LocalPort => undef); print ref($inet)."\n" '
IO::Socket::INET6

What do you see instead?
out of memory....

Please use labels and text to provide additional information.

Original issue reported on code.google.com by nicolas....@gmail.com on 16 May 2014 at 4:57

GoogleCodeExporter commented 9 years ago
Only on cpanel perl, not on other perls. 
Even tested with the same versions of Net::DNS (0.74) and IO::Socket::INET6 
(2.72), 
but I guess that our cpanel Net::DNS is a rogue version (not 0.74), which the 
compiler cannot detect as such.

Use a valid Net::DNS

Original comment by reini.urban on 16 May 2014 at 5:24

GoogleCodeExporter commented 9 years ago
The problem really is SUPER which behaves differently when the module is 
run-time loaded, even if the @ISA is correct and the %INC is clean.

Original comment by reini.urban on 16 May 2014 at 7:51

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 16 May 2014 at 7:52

GoogleCodeExporter commented 9 years ago

Original comment by reini.urban on 16 May 2014 at 7:54

GoogleCodeExporter commented 9 years ago
even when trying a dirty patch to force to call
IO::Handle::autoflush( $sock, 1 ) instead of $sock->autoflush(1);
it fails with an undefined method

Undefined subroutine &IO::Handle::autoflush

looks like that the problem might not come from SUPER but from the fact that 
IO::Handle is not completely loaded ?

Original comment by nicolas....@gmail.com on 16 May 2014 at 8:50

GoogleCodeExporter commented 9 years ago
same warning when compiled with -uIO::Handle
Undefined subroutine &IO::Handle::autoflush

Original comment by nicolas....@gmail.com on 16 May 2014 at 8:51

GoogleCodeExporter commented 9 years ago
the only quick n dirty patch is to force IO::Handle to be reloaded...
delete $INC{'IO/Handle.pm'};
eval q/use IO::Handle; 1/;

Original comment by nicolas....@gmail.com on 16 May 2014 at 9:00

GoogleCodeExporter commented 9 years ago
I've got two ideas which I will try 
1. re-building the mro_meta ISA cache in init2

+  if ($PERL510 and $fullname =~ /^(.*)::ISA$/) {
+    my $stashname = $1;
+    $init2->add( sprintf("mro_method_changed_in(GvHV(gv_fetchpv(%s, 
GV_NOTQUAL, SVt_PVHV)));",
+                         cstring($stashname.'::')));
+  }

2. checking included package which were not properly dumped (such as 
IO::Socket::INET6)
rename %include_package to %mark_package and add a %dumped_package, and walk 
missing entries sauch as in -fwalk-all and oldmaster

Original comment by reini.urban on 17 May 2014 at 6:11

GoogleCodeExporter commented 9 years ago
method 2 is tested in branch inc-i340

commit 6bdaf60417176aebe26d2ab98ae4d95d37cf5f67
Author: Reini Urban <rurban@cpanel.net>
Date:   Mon May 19 10:36:26 2014 -0500

    C 1.46_02: max 3x walkall, recursively dump included but not yet dumped packages

    at inc_cleanup()
    rename %saved to %dumped_package,
    fixes issue 340 where IO::Socket::INET6 and its deps are not being dumped,
    but this change looks problematic.

Original comment by reini.urban on 19 May 2014 at 3:43

GoogleCodeExporter commented 9 years ago
With commit b263d620cda1a5ca8b23b188918d5a585542291a
Author: Reini Urban <rurban@cpanel.net>
Date:   Mon May 19 11:06:47 2014 -0500

    C: improve walkall, skip core packages

    Still: inc-340 causes these -O3 regressions: 45 68

Original comment by reini.urban on 19 May 2014 at 4:34

GoogleCodeExporter commented 9 years ago
With commit 5af34746b92d505be9b84229c816b22573731de4
Author: Reini Urban <rurban@cpanel.net>
Date:   Mon May 19 12:04:37 2014 -0500

    C inc-i340: improve skip_pkg logic

    and observe -fno-warnings.

    fixes the 45 and 64 regressions,
    but breaks (on 5.18):
      200 run-time utf8 hek
    and 46 (-fstash) on 5.14 (hek asserts)

and adds a XS dependency to an empty prog

Original comment by reini.urban on 19 May 2014 at 9:40

GoogleCodeExporter commented 9 years ago
With commit de20f987e97437e4be4ef2fda94b5c898864544d
Author: Reini Urban <rurban@cpanel.net>
Date:   Tue May 20 11:11:40 2014 -0500

    C inc-i340: fix -fstash regressions but still not good enough

    all 5.14 tests pass now, 5.18 200 also,
    but we got many testcore regressions

Next I'll switch to -fwalkall done in the walker, not at the end (as in 
oldmaster)
and to the inc_cleanup against %dumped_packages not %innclude_packages.

Original comment by reini.urban on 20 May 2014 at 4:17

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
Note that lazy-loading a module which changes the warnings mask will segfault, 
as we store the warnings bits statically with -O3. You need to use -O2 then.

Original comment by reini.urban on 21 May 2014 at 5:57

GoogleCodeExporter commented 9 years ago
Or skip warnings with -Uwarnings

Original comment by reini.urban on 23 May 2014 at 2:03

GoogleCodeExporter commented 9 years ago
Fixed with commit 5e5760dab8fe4a9f714c3250e5d27c1f843b650b in master

Original comment by reini.urban on 23 May 2014 at 8:53