Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

stacksize in Storable failure on Windows XP #16472

Closed
p5pRT opened this issue Mar 21, 2018 · 16 comments
Closed

stacksize in Storable failure on Windows XP #16472

p5pRT opened this issue Mar 21, 2018 · 16 comments

Comments

@p5pRT
Copy link

p5pRT commented Mar 21, 2018

Migrated from rt.perl.org#133009 (status was 'resolved')

Searchable as RT133009$

@p5pRT
Copy link
Author

p5pRT commented Mar 21, 2018

From @chorny

Created by @chorny

perl 5.27.10.
In case of Windows XP write_limits is called before directory change
and creation.

"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize --core
lib/Storable/Limit.pm No such file or directory at stacksize line 207.
Using defaults for older Win32
gmake[1]​: *** [Makefile​:284​: lib\Storable\Limit.pm] Error 2
gmake[1]​: Leaving directory
'C​:/strawberry_build/build/perl_core/perl-5.27.10/dist/Storable'
gmake​: *** [GNUmakefile​:1605​: ..\lib\Storable\Limit.pm] Error 2

Perl Info

Flags:
    category=library
    severity=low
    module=Storable

Site configuration information for perl 5.14.0:

Configured by 1 at Thu Jun  9 02:04:07 2011.

Summary of my perl5 (revision 5 version 14 subversion 0) configuration:

  Platform:
    osname=MSWin32, osvers=4.0, archname=MSWin32-x86-multi-thread
    uname='Win32 strawberryperl 5.14.0.0.beta_1 #1 Thu Jun  9 01:53:47
2011 i386'
    config_args='undef'
    hint=recommended, useposix=true, d_sigaction=undef
    useithreads=define, usemultiplicity=define
    useperlio=define, d_sfio=undef, uselargefiles=define, usesocks=undef
    use64bitint=undef, use64bitall=undef, uselongdouble=undef
    usemymalloc=n, bincompat5005=undef
  Compiler:
    cc='gcc', ccflags =' -s -O2 -DWIN32  -DPERL_TEXTMODE_SCRIPTS
-DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTEXT -DPERL_IMPLICIT_SYS
-fno-strict-aliasing -mms-bitfields',
    optimize='-s -O2',
    cppflags='-DWIN32'
    ccversion='', gccversion='4.4.3', gccosandvers=''
    intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=1234
    d_longlong=undef, longlongsize=8, d_longdbl=define, longdblsize=12
    ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='long
long', lseeksize=8
    alignbytes=8, prototype=define
  Linker and Libraries:
    ld='g++', ldflags ='-s -L"C:\strawberry514\perl\lib\CORE"
-L"C:\strawberry514\c\lib"'
    libpth=C:\strawberry514\c\lib C:\strawberry514\c\i686-w64-mingw32\lib
    libs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool -lcomdlg32
-ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid -lws2_32
-lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    perllibs=-lmoldname -lkernel32 -luser32 -lgdi32 -lwinspool
-lcomdlg32 -ladvapi32 -lshell32 -lole32 -loleaut32 -lnetapi32 -luuid
-lws2_32 -lmpr -lwinmm -lversion -lodbc32 -lodbccp32 -lcomctl32
    libc=, so=dll, useshrplib=true, libperl=libperl514.a
    gnulibc_version=''
  Dynamic Linking:
    dlsrc=dl_win32.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' '
    cccdlflags=' ', lddlflags='-mdll -s
-L"C:\strawberry514\perl\lib\CORE" -L"C:\strawberry514\c\lib"'

Locally applied patches:



@INC for perl 5.14.0:
    C:/strawberry514/perl/site/lib/MSWin32-x86-multi-thread
    C:/strawberry514/perl/site/lib
    C:/strawberry514/perl/vendor/lib
    C:/strawberry514/perl/lib
    .


Environment for perl 5.14.0:
    HOME (unset)
    LANG (unset)
    LANGUAGE (unset)
    LD_LIBRARY_PATH (unset)
    LOGDIR (unset)
    PATH=C:\Program
Files\Far\;C:\Prg\PHP\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program
Files\ATI Technologies\ATI.ACE\Core-Static;C:\strawberry514\c\bin;C:\strawberry514\perl\site\bin;C:\strawberry514\perl\bin;C:\Program
Files\TortoiseHg\;C:\Program Files\MySQL\MySQL Server
5.5\bin;c:\util\;C:\Prg\Subversion\bin;C:\Program
Files\TortoiseSVN\bin;D:\vagrant\vagrant\bin;C:\Program
Files\Skype\Phone\;d:\Prg\Git\cmd;C:\Prg\TortoiseGit\bin;
    PERL_BADLANG (unset)
    PERL_JSON_BACKEND=JSON::XS
    PERL_YAML_BACKEND=YAML
    SHELL (unset)


-- 
Alexandr Ciornii, http://chorny.net

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2018

From @tonycoz

On Wed, 21 Mar 2018 07​:41​:57 -0700, chorny wrote​:

perl 5.27.10.
In case of Windows XP write_limits is called before directory change
and creation.

"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize --core
lib/Storable/Limit.pm No such file or directory at stacksize line 207.
Using defaults for older Win32
gmake[1]​: *** [Makefile​:284​: lib\Storable\Limit.pm] Error 2
gmake[1]​: Leaving directory
'C​:/strawberry_build/build/perl_core/perl-5.27.10/dist/Storable'
gmake​: *** [GNUmakefile​:1605​: ..\lib\Storable\Limit.pm] Error 2

Please let me if the attached fixes it.

Thanks,
Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2018

From @tonycoz

0001-perl-133009-handle-the-XP-fallback-after-we-re-ready.patch
From 0e39a28e5e7b97d5b25485ea1156439a275573a4 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 22 Mar 2018 11:48:29 +1100
Subject: (perl #133009) handle the XP fallback after we're ready to write

---
 dist/Storable/stacksize | 16 +++++++++-------
 win32/GNUmakefile       |  5 +++--
 win32/makefile.mk       |  5 +++--
 3 files changed, 15 insertions(+), 11 deletions(-)

diff --git a/dist/Storable/stacksize b/dist/Storable/stacksize
index 54cd947c53..bb768f73e0 100644
--- a/dist/Storable/stacksize
+++ b/dist/Storable/stacksize
@@ -33,13 +33,6 @@ if (is_miniperl()) {
 }
 my $prefix = "";
 if ($^O eq "MSWin32") {
-    require Win32;
-    my ($str, $major, $minor) = Win32::GetOSVersion();
-    if ($major < 6 || $major == 6 && $minor < 1) {
-	print "Using defaults for older Win32\n";
-	write_limits(500, 256);
-	exit;
-    }
     # prevent Windows popping up a dialog each time we overflow
     # the stack
     require Win32API::File;
@@ -78,6 +71,15 @@ if ($ENV{PERL_CORE}) {
 -d "lib" or mkdir "lib";
 -d "lib/Storable" or mkdir "lib/Storable";
 
+if ($^O eq "MSWin32") {
+    require Win32;
+    my ($str, $major, $minor) = Win32::GetOSVersion();
+    if ($major < 6 || $major == 6 && $minor < 1) {
+	print "Using defaults for older Win32\n";
+	write_limits(500, 256);
+	exit;
+    }
+}
 my ($n, $good, $bad, $found) =
     (65000, 100, $bad1, undef);
 print "probe for max. stack sizes...\n" unless QUIET;
diff --git a/win32/GNUmakefile b/win32/GNUmakefile
index 7e464fa3cb..3f7bd2fed3 100644
--- a/win32/GNUmakefile
+++ b/win32/GNUmakefile
@@ -1600,8 +1600,9 @@ Extensions_realclean :
 PostExt : ..\lib\Storable\Limit.pm
 
 # we need the exe, perl(ver).dll, and the Exporter, Storable, Win32 extensions
-# rebasePE covers just about that, including adjustment for static builds
-..\lib\Storable\Limit.pm : rebasePE
+# rebasePE most of that, including adjustment for static builds, so we
+# just need non-xs extensions
+..\lib\Storable\Limit.pm : rebasePE Extensions_nonxs
 	$(PLMAKE) -C ..\dist\Storable lib\Storable\Limit.pm
 	if not exist ..\lib\Storable mkdir ..\lib\Storable
 	copy ..\dist\Storable\lib\Storable\Limit.pm ..\lib\Storable\Limit.pm
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 80bd6e8544..d7b007846a 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1552,8 +1552,9 @@ PostExt : ..\lib\Storable\Limit.pm
 	$(NOOP)
 
 # we need the exe, perl(ver).dll, and the Exporter, Storable, Win32 extensions
-# rebasePE covers just about that, including adjustment for static builds
-..\lib\Storable\Limit.pm : rebasePE
+# rebasePE most of that, including adjustment for static builds, so we
+# just need non-xs extensions
+..\lib\Storable\Limit.pm : rebasePE Extensions_nonxs
 	cd ..\dist\Storable && $(MAKE) lib\Storable\Limit.pm
 	if not exist ..\lib\Storable mkdir ..\lib\Storable
 	copy ..\dist\Storable\lib\Storable\Limit.pm ..\lib\Storable\Limit.pm
-- 
2.14.1.windows.1

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2018

The RT System itself - Status changed from 'new' to 'open'

@p5pRT
Copy link
Author

p5pRT commented Mar 22, 2018

From @bulk88

On Wed, 21 Mar 2018 20​:51​:43 -0700, tonyc wrote​:

On Wed, 21 Mar 2018 07​:41​:57 -0700, chorny wrote​:

perl 5.27.10.
In case of Windows XP write_limits is called before directory change
and creation.

"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize --core
lib/Storable/Limit.pm No such file or directory at stacksize line 207.
Using defaults for older Win32
gmake[1]​: *** [Makefile​:284​: lib\Storable\Limit.pm] Error 2
gmake[1]​: Leaving directory
'C​:/strawberry_build/build/perl_core/perl-5.27.10/dist/Storable'
gmake​: *** [GNUmakefile​:1605​: ..\lib\Storable\Limit.pm] Error 2

Please let me if the attached fixes it.

Thanks,
Tony

I didn't test your patch, but I came to same conclusion, stacksize.pl needs either Extensions_nonxs target as a dep, or an alternative thing I tried but it got murky and I abandoned the idea was executing buildcustomize.pl inside a full perl process, but XSLoader which Win32API​::File or Cwd​:: use, can't just be @​INC buildcustomize.pl included, it is a generated .pm, not copied .pm. So that would mean moving XSLoader from Extensions_nonxs target to Dynaloader target, and I gave up at that point due to complexity.

The reason this was misdiagnosed was stacksize.pl doesn't separate OS errors (SEGV) from perl errors, like this one (Extensions_nonxs target not yet built).


C​:\perl521\src\dist\Storable>C​:\perl521\src\perl.exe -I..\..\lib\auto -I..\..\li
b -MStorable=dclone -e"my $t; $Storable​::recursion_limit = -1; $t=[$t] for 1..65
000;dclone($t);"
Can't locate Carp.pm in @​INC (you may need to install the Carp module) (@​INC con
tains​: ..\..\lib\auto ..\..\lib C​:/perl521/src/lib) at ..\..\lib/Storable.pm lin
e 57.
BEGIN failed--compilation aborted at ..\..\lib/Storable.pm line 68.
Compilation failed in require.
BEGIN failed--compilation aborted.

C​:\perl521\src\dist\Storable>


Another problem, I didn't fully diagnose it but


C​:\perl521\src\dist\Storable>gmake lib\Storable\Limit.pm
C​:\perl521\src\miniperl.exe "-I..\..\lib" -MExtUtils​::Command -e mkpath -- ..\..
\lib
"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize
probe for max. stack sizes...
Storable​: determining recursion limit​: 65000 too big, try less 32550 ...
Storable​: determining recursion limit​: 32550 too big, try less 16325 ...
Storable​: determining recursion limit​: 16325 too big, try less 8213 ...
Storable​: determining recursion limit​: 8213 too big, try less 4157 ...
Storable​: determining recursion limit​: 4157 too big, try less 2129 ...
Storable​: determining recursion limit​: 2129 too big, try less 1115 ...
Storable​: determining recursion limit​: 1115 too big, try less 608 ...
Storable​: determining recursion limit​: 608 too big, try less 354 ...
Storable​: determining recursion limit​: 354 too big, try less 227 ...
Storable​: determining recursion limit​: 227 too big, try less 164 ...
Storable​: determining recursion limit​: 164 too big, try less 132 ...
Storable​: determining recursion limit​: 132 too big, try less 116 ...
Storable​: determining recursion limit​: 116 too big, try less 108 ...
Storable​: determining recursion limit​: 108 too big, try less 104 ...
Storable​: determining recursion limit​: 104 too big, try less 102 ...
Storable​: determining recursion limit​: 102 too big, try less 101 ...
Storable​: determining recursion limit​: 101 too big, try less 101 ...
MAX_DEPTH = 100
Storable​: determining recursion limit​: 50 too big, try less 50 ...
MAX_DEPTH_HASH = 50

C​:\perl521\src\dist\Storable>set PERL_CORE=1

C​:\perl521\src\dist\Storable>del lib\Storable\Limit.pm

C​:\perl521\src\dist\Storable>gmake lib\Storable\Limit.pm
C​:\perl521\src\miniperl.exe "-I..\..\lib" -MExtUtils​::Command -e mkpath -- ..\..
\lib
"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize
probe for max. stack sizes...
Storable​: determining recursion limit​: 65000 too big, try less 32550 ...
Storable​: determining recursion limit​: 32550 too big, try less 16325 ...
Storable​: determining recursion limit​: 16325 too big, try less 8213 ...
Storable​: determining recursion limit​: 8213 too big, try less 4157 ...
Storable​: determining recursion limit​: 4157 passed, try more 6185 ...
Storable​: determining recursion limit​: 6185 passed, try more 7199 ...
Storable​: determining recursion limit​: 7199 too big, try less 6692 ...
Storable​: determining recursion limit​: 6692 passed, try more 6945 ...
Storable​: determining recursion limit​: 6945 too big, try less 6819 ...
Storable​: determining recursion limit​: 6819 too big, try less 6756 ...
Storable​: determining recursion limit​: 6756 passed, try more 6787 ...
Storable​: determining recursion limit​: 6787 passed, try more 6803 ...
Storable​: determining recursion limit​: 6803 passed, try more 6811 ...
Storable​: determining recursion limit​: 6811 passed, try more 6815 ...
Storable​: determining recursion limit​: 6815 too big, try less 6813 ...
Storable​: determining recursion limit​: 6813 passed, try more 6814 ...
Storable​: determining recursion limit​: 6814 passed, try more 6814 ...
MAX_DEPTH = 6814
Storable​: determining recursion limit​: 3000 passed, try more 3000 ...
MAX_DEPTH_HASH = 3000

C​:\perl521\src\dist\Storable>


The code really isn't good at detecting build process bugs. If I poison the -e string to always die in sub cmd in stacksize.pl, stacksize.pl doesn't figure it out. Stacksize.pl should try at level 1 of depth, and that HAS to always pass or bail out totally and never generate Limit.pm. Not try downwards till it hits zero/one level.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 27, 2018

From @tonycoz

On Thu, 22 Mar 2018 15​:44​:46 -0700, bulk88 wrote​:

I didn't test your patch, but I came to same conclusion, stacksize.pl
needs either Extensions_nonxs target as a dep, or an alternative thing
I tried but it got murky and I abandoned the idea was executing
buildcustomize.pl inside a full perl process, but XSLoader which
Win32API​::File or Cwd​:: use, can't just be @​INC buildcustomize.pl
included, it is a generated .pm, not copied .pm. So that would mean
moving XSLoader from Extensions_nonxs target to Dynaloader target, and
I gave up at that point due to complexity.

The reason this was misdiagnosed was stacksize.pl doesn't separate OS
errors (SEGV) from perl errors, like this one (Extensions_nonxs target
not yet built).

--------------------------------
C​:\perl521\src\dist\Storable>C​:\perl521\src\perl.exe -I..\..\lib\auto
-I..\..\li
b -MStorable=dclone -e"my $t; $Storable​::recursion_limit = -1; $t=[$t]
for 1..65
000;dclone($t);"
Can't locate Carp.pm in @​INC (you may need to install the Carp module)
(@​INC con
tains​: ..\..\lib\auto ..\..\lib C​:/perl521/src/lib) at
..\..\lib/Storable.pm lin
e 57.
BEGIN failed--compilation aborted at ..\..\lib/Storable.pm line 68.
Compilation failed in require.
BEGIN failed--compilation aborted.

C​:\perl521\src\dist\Storable>
--------------------------------

From my testing, stacksize itself failed to compile before I got to this point.

Another problem, I didn't fully diagnose it but

------------------------------------
C​:\perl521\src\dist\Storable>gmake lib\Storable\Limit.pm
C​:\perl521\src\miniperl.exe "-I..\..\lib" -MExtUtils​::Command -e
mkpath -- ..\..
\lib
"..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize
probe for max. stack sizes...
Storable​: determining recursion limit​: 65000 too big, try less 32550
...
Storable​: determining recursion limit​: 32550 too big, try less 16325
...
Storable​: determining recursion limit​: 16325 too big, try less 8213
...
Storable​: determining recursion limit​: 8213 too big, try less 4157 ...
Storable​: determining recursion limit​: 4157 too big, try less 2129 ...
Storable​: determining recursion limit​: 2129 too big, try less 1115 ...
Storable​: determining recursion limit​: 1115 too big, try less 608 ...
Storable​: determining recursion limit​: 608 too big, try less 354 ...
Storable​: determining recursion limit​: 354 too big, try less 227 ...
Storable​: determining recursion limit​: 227 too big, try less 164 ...
Storable​: determining recursion limit​: 164 too big, try less 132 ...
Storable​: determining recursion limit​: 132 too big, try less 116 ...
Storable​: determining recursion limit​: 116 too big, try less 108 ...
Storable​: determining recursion limit​: 108 too big, try less 104 ...
Storable​: determining recursion limit​: 104 too big, try less 102 ...
Storable​: determining recursion limit​: 102 too big, try less 101 ...
Storable​: determining recursion limit​: 101 too big, try less 101 ...
MAX_DEPTH = 100
Storable​: determining recursion limit​: 50 too big, try less 50 ...
MAX_DEPTH_HASH = 50

I could see this happening if Storable itself (or Exporter, Carp) was unbuilt or broken.

The extra test in the new patch should catch that and prevent stacksize "succeeding" erroneously.

The code really isn't good at detecting build process bugs. If I
poison the -e string to always die in sub cmd in stacksize.pl,
stacksize.pl doesn't figure it out. Stacksize.pl should try at level 1
of depth, and that HAS to always pass or bail out totally and never
generate Limit.pm. Not try downwards till it hits zero/one level.

I've attached an updated patch which does check that a minimal run works.

Thanks.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 27, 2018

From @tonycoz

0001-perl-133009-handle-the-XP-fallback-after-we-re-ready.patch
From df9f6b65223c421502325a2a09cea85eaabde469 Mon Sep 17 00:00:00 2001
From: Tony Cook <tony@develop-help.com>
Date: Thu, 22 Mar 2018 11:48:29 +1100
Subject: [PATCH] (perl #133009) handle the XP fallback after we're ready to
 write

Also, check we can use Storable before trying to probe recursion
limits.
---
 dist/Storable/stacksize | 30 ++++++++++++++++++++++--------
 win32/GNUmakefile       |  5 +++--
 win32/makefile.mk       |  5 +++--
 3 files changed, 28 insertions(+), 12 deletions(-)

diff --git a/dist/Storable/stacksize b/dist/Storable/stacksize
index 54cd947c53..2d786b44d5 100644
--- a/dist/Storable/stacksize
+++ b/dist/Storable/stacksize
@@ -33,13 +33,6 @@ if (is_miniperl()) {
 }
 my $prefix = "";
 if ($^O eq "MSWin32") {
-    require Win32;
-    my ($str, $major, $minor) = Win32::GetOSVersion();
-    if ($major < 6 || $major == 6 && $minor < 1) {
-	print "Using defaults for older Win32\n";
-	write_limits(500, 256);
-	exit;
-    }
     # prevent Windows popping up a dialog each time we overflow
     # the stack
     require Win32API::File;
@@ -78,6 +71,15 @@ if ($ENV{PERL_CORE}) {
 -d "lib" or mkdir "lib";
 -d "lib/Storable" or mkdir "lib/Storable";
 
+if ($^O eq "MSWin32") {
+    require Win32;
+    my ($str, $major, $minor) = Win32::GetOSVersion();
+    if ($major < 6 || $major == 6 && $minor < 1) {
+	print "Using defaults for older Win32\n";
+	write_limits(500, 256);
+	exit;
+    }
+}
 my ($n, $good, $bad, $found) =
     (65000, 100, $bad1, undef);
 print "probe for max. stack sizes...\n" unless QUIET;
@@ -131,12 +133,24 @@ sub bad {
     return $j;
 }
 
+sub array_cmd {
+    my $depth = shift;
+    return cmd($depth, '$t=[$t]', 'recursion_limit');
+}
+
 unless ($ENV{STORABLE_NOISY}) {
     # suppress Segmentation fault messages
     open STDERR, ">", File::Spec->devnull;
 }
+
+# first check we can successfully run with a minimum level
+my $cmd = array_cmd(1);
+if (system($cmd)) {
+    die "Cannot run probe, aborting...\n";
+}
+
 while (!$found) {
-    my $cmd = cmd($n, '$t=[$t]', 'recursion_limit');
+    my $cmd = array_cmd($n);
     #print "$cmd\n" unless $QUIET;
     if (system($cmd) == 0) {
         $n = good($n);
diff --git a/win32/GNUmakefile b/win32/GNUmakefile
index 7e464fa3cb..3f7bd2fed3 100644
--- a/win32/GNUmakefile
+++ b/win32/GNUmakefile
@@ -1600,8 +1600,9 @@ Extensions_realclean :
 PostExt : ..\lib\Storable\Limit.pm
 
 # we need the exe, perl(ver).dll, and the Exporter, Storable, Win32 extensions
-# rebasePE covers just about that, including adjustment for static builds
-..\lib\Storable\Limit.pm : rebasePE
+# rebasePE most of that, including adjustment for static builds, so we
+# just need non-xs extensions
+..\lib\Storable\Limit.pm : rebasePE Extensions_nonxs
 	$(PLMAKE) -C ..\dist\Storable lib\Storable\Limit.pm
 	if not exist ..\lib\Storable mkdir ..\lib\Storable
 	copy ..\dist\Storable\lib\Storable\Limit.pm ..\lib\Storable\Limit.pm
diff --git a/win32/makefile.mk b/win32/makefile.mk
index 80bd6e8544..d7b007846a 100644
--- a/win32/makefile.mk
+++ b/win32/makefile.mk
@@ -1552,8 +1552,9 @@ PostExt : ..\lib\Storable\Limit.pm
 	$(NOOP)
 
 # we need the exe, perl(ver).dll, and the Exporter, Storable, Win32 extensions
-# rebasePE covers just about that, including adjustment for static builds
-..\lib\Storable\Limit.pm : rebasePE
+# rebasePE most of that, including adjustment for static builds, so we
+# just need non-xs extensions
+..\lib\Storable\Limit.pm : rebasePE Extensions_nonxs
 	cd ..\dist\Storable && $(MAKE) lib\Storable\Limit.pm
 	if not exist ..\lib\Storable mkdir ..\lib\Storable
 	copy ..\dist\Storable\lib\Storable\Limit.pm ..\lib\Storable\Limit.pm
-- 
2.14.1.windows.1

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2018

From @bulk88

On Mon, 26 Mar 2018 22​:28​:32 -0700, tonyc wrote​:

I could see this happening if Storable itself (or Exporter, Carp) was
unbuilt or broken.

The extra test in the new patch should catch that and prevent
stacksize "succeeding" erroneously.

The code really isn't good at detecting build process bugs. If I
poison the -e string to always die in sub cmd in stacksize.pl,
stacksize.pl doesn't figure it out. Stacksize.pl should try at level
1
of depth, and that HAS to always pass or bail out totally and never
generate Limit.pm. Not try downwards till it hits zero/one level.

I've attached an updated patch which does check that a minimal run
works.

Thanks.

Tony

I tested this patch. There are 2 problems. First "die "Cannot run probe, aborting...\n";" is below "unless ($ENV{STORABLE_NOISY}) {", so that message "Cannot run probe, aborting...\n" will never be seen if it was written to the handle. The "Cannot run probe, aborting...\n" needs to execute before STDERR is silenced.

Second, why is the test not done on <Win 7? I did read https://rt-archive.perl.org/perl5/Ticket/Display.html?id=132893 but I removed the version check and it runs fine for me on XP and server 2003 64b, VC and Mingw included.

I did through experimenting find out, if I remove the set_error_mode popup suppression code, then as intended the VS "JIT debugger" popup comes up, if I click "No" in the box, the crashed perl process's exit code is 0 according to procmon, and stacksize.pl gets a 0 also, and sets the recursion limit to 65000 or 64999 since each run always "passes". If I click yes, then detach the process from VS debugger, the exit code of the process is 128. If set_error_mode() popup suppression is on (VS debugger didnt popup) the exit code of the proc is 0xc00000fd which is reasonable/expected. This shows, its undefined behavior to assume a crash proc's exit code is non-zero on all OSes. A "im alive" print after "dclone(\$t);" and switching from system to `` might be needed to prove the proc didnt crash. Exit code is just a 99% guarantee. I dont know why chorny's box hung. He never gave enough details. JIT Debugger popup he didn't see? (proc explorer provable).

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Mar 28, 2018

From @tonycoz

On Wed, Mar 28, 2018 at 06​:42​:52AM -0700, bulk88 via RT wrote​:

On Mon, 26 Mar 2018 22​:28​:32 -0700, tonyc wrote​:

I could see this happening if Storable itself (or Exporter, Carp) was
unbuilt or broken.

The extra test in the new patch should catch that and prevent
stacksize "succeeding" erroneously.

The code really isn't good at detecting build process bugs. If I
poison the -e string to always die in sub cmd in stacksize.pl,
stacksize.pl doesn't figure it out. Stacksize.pl should try at level
1
of depth, and that HAS to always pass or bail out totally and never
generate Limit.pm. Not try downwards till it hits zero/one level.

I've attached an updated patch which does check that a minimal run
works.

Thanks.

Tony

I tested this patch. There are 2 problems. First "die "Cannot run probe, aborting...\n";" is below "unless ($ENV{STORABLE_NOISY}) {", so that message "Cannot run probe, aborting...\n" will never be seen if it was written to the handle. The "Cannot run probe, aborting...\n" needs to execute before STDERR is silenced.

Thanks.

Second, why is the test not done on <Win 7? I did read https://rt-archive.perl.org/perl5/Ticket/Display.html?id=132893 but I removed the version check and it runs fine for me on XP and server 2003 64b, VC and Mingw included.

I did through experimenting find out, if I remove the set_error_mode popup suppression code, then as intended the VS "JIT debugger" popup comes up, if I click "No" in the box, the crashed perl process's exit code is 0 according to procmon, and stacksize.pl gets a 0 also, and sets the recursion limit to 65000 or 64999 since each run always "passes". If I click yes, then detach the process from VS debugger, the exit code of the process is 128. If set_error_mode() popup suppression is on (VS debugger didnt popup) the exit code of the proc is 0xc00000fd which is reasonable/expected. This shows, its undefined behavior to assume a crash proc's exit code is non-zero on all OSes. A "im alive" print after "dclone(\$t);" and switching from system to `` might be needed to prove the proc didnt crash. Exit code is just a 99% guarantee. I dont know why chorny's box hung. He never gave enough details. JIT Debugger popup he didn't see? (proc explorer provable).

When I tested on Windows XP without the version check the child
process got stuck in a loop somewhere in the runtime.

I didn't test Vista.

That doesn't happen for me on Windows 7, which is where I do most of
my Win32 testing.

As to the exit codes, maybe it should checking for specific output
rather than the exit code, though that doesn't help with the case in
this ticket, since the child process never exits.

Tony

@p5pRT
Copy link
Author

p5pRT commented Mar 29, 2018

From @bulk88

On Wed, 28 Mar 2018 16​:44​:42 -0700, tonyc wrote​:

When I tested on Windows XP without the version check the child
process got stuck in a loop somewhere in the runtime.

I didn't test Vista.

That doesn't happen for me on Windows 7, which is where I do most of
my Win32 testing.

As to the exit codes, maybe it should checking for specific output
rather than the exit code, though that doesn't help with the case in
this ticket, since the child process never exits.

Tony

What what the callstack from the VC debugger if you paused the child proc? Which VC version did you use or was this Mingw? I'm seeing somekind of nasty SEH/C++ exception/try catch/TLS bug that needs to be fixed if a perl proc can't crash and instead just hangs or worse burns infinite CPU.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented Apr 2, 2018

From @tonycoz

On Thu, 29 Mar 2018 06​:49​:32 -0700, bulk88 wrote​:

What what the callstack from the VC debugger if you paused the child
proc? Which VC version did you use or was this Mingw? I'm seeing
somekind of nasty SEH/C++ exception/try catch/TLS bug that needs to be
fixed if a perl proc can't crash and instead just hangs or worse burns
infinite CPU.

It was the gcc supplied with strawberry perl, and a 32-bit build (since my XP x64 machine failed a while back.)

I've applied my fix, with a change to check the output rather than the exit code as c8435d2.

I fixed two other dependency issues in 40507cb and bcdb10f.

Tony

@p5pRT
Copy link
Author

p5pRT commented Apr 2, 2018

From @khwilliamson

On 04/01/2018 07​:56 PM, Tony Cook via RT wrote​:

On Thu, 29 Mar 2018 06​:49​:32 -0700, bulk88 wrote​:

What what the callstack from the VC debugger if you paused the child
proc? Which VC version did you use or was this Mingw? I'm seeing
somekind of nasty SEH/C++ exception/try catch/TLS bug that needs to be
fixed if a perl proc can't crash and instead just hangs or worse burns
infinite CPU.

It was the gcc supplied with strawberry perl, and a 32-bit build (since my XP x64 machine failed a while back.)

I've applied my fix, with a change to check the output rather than the exit code as c8435d2.

I fixed two other dependency issues in 40507cb and bcdb10f.

Tony

---
via perlbug​: queue​: perl5 status​: open
https://rt-archive.perl.org/perl5/Ticket/Display.html?id=133009

I believe that this line in the patch(es)

if ($major < 6 || $major == 6 && $minor < 1)

should parenthesize the stuff after the ||

@p5pRT
Copy link
Author

p5pRT commented Apr 2, 2018

From @bulk88

On Sun, 01 Apr 2018 18​:56​:38 -0700, tonyc wrote​:

It was the gcc supplied with strawberry perl, and a 32-bit build
(since my XP x64 machine failed a while back.)

I tried "gcc version 4.9.2 (i686-posix-sjlj, built by strawberryperl.com project)" no hang running stacksize.pl. Can you try and see if it hangs for you still and what exact GCC ver u used? Mingw 3.4.5 "vista special", the oldest GCC we support I think, doesn't build blead when I tried it. Probably new breakage.

--
bulk88 ~ bulk88 at hotmail.com

@p5pRT
Copy link
Author

p5pRT commented May 23, 2018

From @tonycoz

On Mon, 02 Apr 2018 07​:19​:52 -0700, public@​khwilliamson.com wrote​:

I believe that this line in the patch(es)

if ($major < 6 || $major == 6 && $minor < 1)

should parenthesize the stuff after the ||

&& has higher precedence than ||.

Tony

@p5pRT
Copy link
Author

p5pRT commented Aug 6, 2019

From @tonycoz

On Sun, 01 Apr 2018 18​:56​:38 -0700, tonyc wrote​:

On Thu, 29 Mar 2018 06​:49​:32 -0700, bulk88 wrote​:

What what the callstack from the VC debugger if you paused the child
proc? Which VC version did you use or was this Mingw? I'm seeing
somekind of nasty SEH/C++ exception/try catch/TLS bug that needs to
be
fixed if a perl proc can't crash and instead just hangs or worse
burns
infinite CPU.

It was the gcc supplied with strawberry perl, and a 32-bit build
(since my XP x64 machine failed a while back.)

I've applied my fix, with a change to check the output rather than the
exit code as c8435d2.

I fixed two other dependency issues in
40507cb and
bcdb10f.

This was applied perl pre-5.28.0.

The stacksize probing was removed for perl 5.30.0.

This issue now is either fixed (5.28) or irrelevant (5.30).

Thanks for reporting it.

Tony

@p5pRT
Copy link
Author

p5pRT commented Aug 6, 2019

@tonycoz - Status changed from 'open' to 'resolved'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant