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
Comments
From @chornyCreated by @chornyperl 5.27.10. "..\..\perl.exe" "-I..\..\lib" "-I..\..\lib" stacksize --core Perl Info
|
From @tonycozOn Wed, 21 Mar 2018 07:41:57 -0700, chorny wrote:
Please let me if the attached fixes it. Thanks, |
From @tonycoz0001-perl-133009-handle-the-XP-fallback-after-we-re-ready.patchFrom 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
|
The RT System itself - Status changed from 'new' to 'open' |
From @bulk88On Wed, 21 Mar 2018 20:51:43 -0700, tonyc 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 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\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\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. -- |
From @tonycozOn Thu, 22 Mar 2018 15:44:46 -0700, bulk88 wrote:
From my testing, stacksize itself failed to compile before I got to this point.
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.
I've attached an updated patch which does check that a minimal run works. Thanks. Tony |
From @tonycoz0001-perl-133009-handle-the-XP-fallback-after-we-re-ready.patchFrom 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
|
From @bulk88On Mon, 26 Mar 2018 22:28:32 -0700, tonyc wrote:
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). -- |
From @tonycozOn Wed, Mar 28, 2018 at 06:42:52AM -0700, bulk88 via RT wrote:
Thanks.
When I tested on Windows XP without the version check the child I didn't test Vista. That doesn't happen for me on Windows 7, which is where I do most of As to the exit codes, maybe it should checking for specific output Tony |
From @bulk88On Wed, 28 Mar 2018 16:44:42 -0700, tonyc 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. -- |
From @tonycozOn Thu, 29 Mar 2018 06:49:32 -0700, bulk88 wrote:
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 |
From @khwilliamsonOn 04/01/2018 07:56 PM, Tony Cook via RT wrote:
I believe that this line in the patch(es) if ($major < 6 || $major == 6 && $minor < 1) should parenthesize the stuff after the || |
From @bulk88On Sun, 01 Apr 2018 18:56:38 -0700, tonyc wrote:
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. -- |
From @tonycozOn Mon, 02 Apr 2018 07:19:52 -0700, public@khwilliamson.com wrote:
&& has higher precedence than ||. Tony |
From @tonycozOn Sun, 01 Apr 2018 18:56:38 -0700, tonyc wrote:
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 |
@tonycoz - Status changed from 'open' to 'resolved' |
Migrated from rt.perl.org#133009 (status was 'resolved')
Searchable as RT133009$
The text was updated successfully, but these errors were encountered: