Skip Menu |

This queue is for tickets about the Dist-Zilla-Plugin-Test-Compile CPAN distribution.

Report information
The Basics
Id: 88783
Status: resolved
Priority: 0/
Queue: Dist-Zilla-Plugin-Test-Compile

People
Owner: ether [...] cpan.org
Requestors: CHORNY [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 2.032



Subject: generated test sometimes hangs on Windows
As I see from my cpantesters smokes, it hangs repeatedly in case some dependency is missing. Hangings when all dependencies are met are rare and not 100% repeatable. -- Alexandr Ciornii, http://chorny.net
On 2013-09-18 07:10:22, CHORNY wrote: Show quoted text
> As I see from my cpantesters smokes, it hangs repeatedly in case some > dependency is missing. Hangings when all dependencies are met are rare > and not 100% repeatable.
Some sort of diagnostic information would be helpful. What distributions/versions are you seeing this problem with? There was a version of the plugin out for a few days that was problematic on mswin32, but that issue has been resolved now, as far as I'm aware. When http://grep.cpan.me/ is back up I can try to track down dists still using such versions (there may be a few left after my last sweep a few weeks ago), but a reference to a dist that is still showing issues will be helpful.
On Wed Sep 18 12:25:56 2013, ETHER wrote: Show quoted text
> On 2013-09-18 07:10:22, CHORNY wrote:
> > As I see from my cpantesters smokes, it hangs repeatedly in case some > > dependency is missing. Hangings when all dependencies are met are > > rare > > and not 100% repeatable.
> > Some sort of diagnostic information would be helpful. What > distributions/versions are you seeing this problem with? There was a > version of the plugin out for a few days that was problematic on > mswin32, but that issue has been resolved now, as far as I'm aware.
Pinto-Action-Doc-0.001, 00-compile.t generated by version 2.027 1..2 binmode() on unopened filehandle GEN0 at t/00-compile.t line 28. (hangs) MooseX-Role-Net-OpenSSH-0.001, 00-compile.t generated by version 2.030 1..1 (hangs) test hangs on waitpid, I check pid manually, it belongs to cmd.exe and exists. -- Alexandr Ciornii, http://chorny.net
Show quoted text
> test hangs on waitpid, I check pid manually, it belongs to cmd.exe and > exists.
I wonder if it would help to bypass the shell here. I'm afraid my win32-fu is not that high...
I released 2.031 which bypasses the shell/cmd.exe by passing the command and args as separate list elements... but I expect it will be several days before we know if this helped.
On Thu Sep 19 00:53:00 2013, ETHER wrote: Show quoted text
> I released 2.031 which bypasses the shell/cmd.exe by passing the > command and args as separate list elements... but I expect it will be > several days before we know if this helped.
I just used WWW-Shorten-SCK repository to test this by adding "use No::Such::Module;". It does not help. This solution works if ($^O eq 'MSWin32' and !$ENV{AUTHOR_TESTING}) { my $output = qx{$^X -Mblib -e"require q[$lib]" 2>&1 <nul}; #<nul will prevent witing input warn $output if $output; } It you need to drop output from STDOUT and get only output from STDERR, add ">nul" to the end. qx can return list, so @warnings can be filled from it. -- Alexandr Ciornii, http://chorny.net
I can submit a patch and test it, just need to know if STDOUT should be dropped. -- Alexandr Ciornii, http://chorny.net
Subject: Re: [rt.cpan.org #88783] generated test sometimes hangs on Windows
Date: Thu, 19 Sep 2013 09:13:14 -0700
To: Alexandr Ciornii via RT <bug-Dist-Zilla-Plugin-Test-Compile [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Thu, Sep 19, 2013 at 11:13:40AM -0400, Alexandr Ciornii via RT wrote: Show quoted text
> I just used WWW-Shorten-SCK repository to test this by adding "use No::Such::Module;". It does not help.
Doh! :( Show quoted text
> This solution works > if ($^O eq 'MSWin32' and !$ENV{AUTHOR_TESTING}) { > my $output = qx{$^X -Mblib -e"require q[$lib]" 2>&1 <nul}; #<nul will prevent witing input > warn $output if $output; > } > > It you need to drop output from STDOUT and get only output from STDERR, add ">nul" to the end. qx can return list, so @warnings can be filled from it.
Ok, I'll look at this tonight. David Golden also graciously whipped up a "Capture::Tinier" that I can embed into the test, which I'll also be considering as a replacement -- https://gist.github.com/dagolden/6618205 thanks very much for your assistance debugging this!
I just pushed this test branch -- https://github.com/karenetheridge/dist-zilla-plugin-test-compile/tree/topic/win32_debugging If convenient, could you run 'perl test-compile.t' and let me know what happens? git clone git@github.com:karenetheridge/dist-zilla-plugin-test-compile.git cd dist-zilla-plugin-test-compile git checkout topic/win32_debugging perl test-compile.t This is using new code that has stdin reading from /dev/null, rather than using a gensym, so if the process tries to read from stdin it should not hang.
Mithaldu was able to do some debugging, and made some very interesting discoveries: 16:26 <@ether> Mithaldu: are you still awake? 16:26 < Mithaldu> fsvo awake 16:26 <@ether> I just pushed this test branch -- https://github.com/karenetheridge/dist-zilla-plugin-test-compile/tree/topic/win32_debugging 16:26 <+dipsy> [ karenetheridge/dist-zilla-plugin-test-compile · GitHub ] 16:27 <@ether> or, copy/paste from the last message in https://rt.cpan.org/Ticket/Display.html?id=88783 16:27 <+dipsy> [ Bug #88783 for Dist-Zilla-Plugin-Test-Compile: generated test sometimes hangs on Windows ] 16:27 < Mithaldu> useful, thank you :) 16:29 < Mithaldu> ether: so which part of this is not supposed to be changed? 16:29 < Mithaldu> also, it doesn't hang for me 16:32 < Mithaldu> ether: ok wait 16:32 < Mithaldu> so if i read your ticket comment right the issue happens when Foo.pm opens STDIN and tries to read from it until it gets EOF 16:32 < Mithaldu> is that the right ballpark? 16:32 <@ether> one commit back is the change I made that I hope will work 16:33 <@ether> yes I think so 16:33 <@ether> I didn't think that any processes woudl be reading from stdin, but apparently something is 16:33 < Mithaldu> see, i need that code 16:33 < Mithaldu> i need to test the hang 16:33 < Mithaldu> on which modules does this happen? 16:33 < Mithaldu> ok, i see 16:34 <@ether> chorny said "I just used WWW-Shorten-SCK repository to test this by adding "use No::Such::Module;". It does not help. " 16:34 <@ether> so I suppose he just added that line to one of the modules in the dist? 16:34 <@ether> which is what I'm simulating with Foo.pm 16:35 < Mithaldu> man, his information is really awkwardly unfocused 16:36 <@ether> it doesn't seem like the failure is always repeatable, either :( 16:38 < Mithaldu> i'm trying with the SCK thing he mentioned 16:40 <@xdg> ether, read the second bullet in the "BUGS" section of perlfork 16:42 <@ether> pseudo-processes being what we get in win32? 16:42 * ether reads the doc from the beginning; ok, this is just about emulation, not normal forks, so yeah 16:42 < Mithaldu> fork under windows gives you threads 16:43 < Mithaldu> but open3 doesn't fork on windows i think 16:43 < Mithaldu> so i don't understand why that's relevant 16:43 <@xdg> ether, fork on windows does what the document describes and IPC::Open3 uses fork internally 16:43 <@xdg> forks on windows are "pseudo-threads" 16:43 <@ether> I could always just drop the idea of using separate processes for testing on windows -- it may generate different errors, and mask others, but at least it shouldn't go kaboom 16:44 <@xdg> Capture::Tinier 16:44 <@ether> if ($^O eq 'MSWin32') { use_module($_) foreach @modules } 16:44 < Mithaldu> xdg: open3 doesn't 16:44 <@ether> xdg: or that. yes. :) 16:45 < Mithaldu> (i know this because i actually see the child process) 16:47 <@xdg> ah. 16:47 < Mithaldu> ether: i'll try to reproduce this with the two modules he pointed out 16:47 <@xdg> In any case, Capture::Tiny(ier) doesn't try to read from a pipe, which simplifies the IPC 16:47 <@ether> I just pushed an update, bypassing cmd.exe (which I already released yesterday; I copied this test from a different build that was created before that change.) 16:48 < Mithaldu> well that's not gonna help me help you, because i can't reproduce the error case yet :P 16:51 < Mithaldu> ok, reproduced 16:51 < Mithaldu> awesome 16:51 <@xdg> Mithaldu++ 16:51 <@ether> o/ 16:51 < Mithaldu> just downloaded this: http://cpan.metacpan.org/authors/id/T/TR/TRCJR/MooseX-Role-Net-OpenSSH-0.001.tar.gz 16:51 <+dipsy> urgh. long url. Try http://tinyurl.com/mt3fvum 16:51 < Mithaldu> and then make tested without having openssh 16:52 <@ether> I smell some new unit tests that I should be adding :) 16:52 < Mithaldu> open my $stdin, '<', File::Spec->devnull or die $!; 16:52 < Mithaldu> doesn't help 16:53 < Mithaldu> interestingly 16:53 < Mithaldu> perl -Ilib t\00-compile.t 16:53 <@ether> it's frustrating having the extra step in between for testing - I can't just put up a -TRIAL dist and see what the smokers say - I have to wait until people actually use the plugin to build their dists, and then find out about it secondhand... so having a test that I can actually use myself to reproduce these issues will be VERY helpful 16:53 < Mithaldu> ^- that works 16:53 < Mithaldu> prove -l t/* 16:53 < Mithaldu> ^- hangs 16:53 < Mithaldu> so the issue is processes wrapping around further outside 16:53 < Mithaldu> and i remember things like that 16:53 <@ether> prove closes stdout, iirc 16:54 <@ether> (well, Test::Harness actually..) 16:54 < Mithaldu> but i don't remember any details 16:54 < Mithaldu> it's more of a deja vu 16:54 < Mithaldu> anyhow, i'll mess with this and see what happens 16:54 < Mithaldu> xdg: where is tinier? 16:54 <@xdg> ether, if that's true then Capture::Tinier might be too tiny 16:54 < Mithaldu> ok, got tinier 16:54 < Mithaldu> trying that 16:55 < Mithaldu> ether: yes, i'm working on that :) 16:55 <@xdg> Mithaldu, you got it? If not: https://gist.github.com/dagolden/6618205 16:55 <@ether> tinier: https://gist.github.com/dagolden/6618205 16:55 <@ether> too slow 16:55 <+dipsy> [ 00-xdg-compile.t ] 16:55 <+dipsy> [ 00-xdg-compile.t ] 16:55 <@xdg> It was sort of a joke name, but with real intent 16:56 <@xdg> It's Capture::Tiny stripped of all the tee-ing, layer mgmt, and dealing with weirdly modified existing handles 16:56 <@ether> dammit, we should just get it into core :) 16:57 <@xdg> I do notice a line there about "# WIN32 hangs on tee without STDIN copied" 16:57 < Mithaldu> xdg: yes got it 16:57 <@xdg> shouldn't matter for Tinier, but it's indicative of the sort of problems we hit on Windows with process stuff 16:58 * ether sees that Meerkat is a real thing ;) 16:58 <@xdg> it is now 16:58 <@xdg> :-) 16:59 < Mithaldu> .... what the fuck 17:00 <@ether> that sounds ominous 17:00 < Mithaldu> deleting blib\arch\auto\MooseX\Role\Net\OpenSSH\.exists stops prove -l -v t/* from hanging 17:01 <@ether> ! 17:01 <@ether> I didn't think anything at runtime looked at .exists files 17:02 < Mithaldu> blib/arch/auto/MooseX/Role/Net/OpenSSH/.exists 17:02 <@xdg> o_O 17:02 < Mithaldu> blib/lib/MooseX/Role/Net/OpenSSH.pm 17:02 < Mithaldu> t/00-compile.t 17:02 < Mithaldu> i run 17:02 < Mithaldu> prove -l -v t/* 17:02 < Mithaldu> and it hangs 17:02 < Mithaldu> i delete the .exists 17:02 < Mithaldu> and the test doesn't hang 17:02 < Mithaldu> let's see how many bits i can delete from OpenSSH.pm 17:03 <@xdg> what is generating .exists? 17:03 < Mithaldu> dzil 17:03 < Mithaldu> or eumm 17:03 < Mithaldu> unclear 17:03 <@xdg> if it's in blib, it's not dzil 17:03 <@xdg> eumm or a lib it's using to copy to blib 17:03 * xdg chdirs 17:04 <@xdg> eumm 17:04 <@xdg> I'm going to skim source 17:04 < Mithaldu> thanks 17:05 <@xdg> it's just getting touched by the makefile so it can have a dependency on the directory, which otherwise doesn't work well 17:06 <@xdg> (that's my tl;dr summary of a comment in the source) 17:08 * xdg afk 17:09 < Mithaldu> aHA 17:11 < Mithaldu> ether: https://github.com/wchristian/winhangtest 17:11 <+dipsy> [ wchristian/winhangtest · GitHub ] 17:11 < Mithaldu> still making it smaller 17:13 <@ether> if $stderr isn't an IO::Handle there isn't a problem? wut? 17:13 <@ether> this is getting stranger and stranger 17:14 <@ether> in the meantime I'm whipping up a capture_tinier branch 17:14 < Mithaldu> my ( $stdout, $stderr, $rc ) = capture { system( qq{$^X -Mblib -e"require q[MooseX/Role/Net/OpenSSH.pm]"} ) }; 17:15 < Mithaldu> this don't freeze and prints all the right things 17:15 < Mithaldu> so, tinier is the right path 17:16 < Mithaldu> output of: 17:16 < Mithaldu> warn "\n$rc - $stdout - $stderr\n"; 17:16 < Mithaldu> 512 - - Can't locate Not/Exists.pm in @INC (@ 17:16 < Mithaldu> etc. 17:17 <@ether> woo 17:18 < Mithaldu> and i got tinier working 17:18 < Mithaldu> ether: https://github.com/wchristian/winhangtest/blob/master/t/00-compile.t 17:18 <+dipsy> [ winhangtest/t/00-compile.t at master · wchristian/winhangtest · GitHub ] 17:18 < Mithaldu> enjoy 17:18 < Mithaldu> also 17:19 < Mithaldu> do test that on linux to see if it blows up :) 17:19 < Mithaldu> xdg: splendid work, thanks a bunch! 17:19 <@ether> thank you so much to you both 17:19 < Mithaldu> who needs sleep when he can make cpan happy? :D 17:20 <@ether> so the "ssh library doesn't exist" issue was a red herring? 17:20 < Mithaldu> totally 17:20 <@ether> I'm wondering if there's something I can put into a .pm file to be tested that will tickle the right error 17:20 < Mithaldu> actually, let me try something dumb 17:21 < Mithaldu> ok 17:21 < Mithaldu> if i replace use Not::Exists; in OpenSSH.pm with "die 1;", then it doesn't hang 17:22 < Mithaldu> so this is some weird interaction between the child process failing to load a dep, and whatever prove invokes 17:22 < Mithaldu> and the .exists file 17:22 < Mithaldu> those are the three puzzle pieces 17:23 <@ether> I do do a perl Makefile.PL; make from within my tests.. 17:23 <@ether> only right now I only have passing tests, because of the PITA that is Test::Tester 17:23 <@ether> and using it might further alter the harness in undesirable ways 17:24 <@ether> Mithaldu: thanks so much 17:25 < Mithaldu> i'm unclear on the implications of what you're saying 17:25 <@ether> I'd like to be able to have this particular type of test failure in the plugin's tests 17:25 <@ether> so I can put up a -TRIAL release and see results right away 17:25 < Mithaldu> yeah, that's gonna be tricky 17:25 <@ether> but that means capturing the test results in a way that the thing doing the testing doesn't also fail 17:25 <@ether> which generally implies Test::Tester 17:26 <@ether> which I have fought with before, and mostly beaten into submission, but it does funny things with the harness so I don't trust it too much 17:26 < Mithaldu> well 17:26 < Mithaldu> a test failure is freezing 17:26 < Mithaldu> that is dang hard to do anything with 17:26 < Mithaldu> i wouldn't bother 17:26 < Mithaldu> you're removing open3, which is the source of the immediate problem 17:28 < Mithaldu> none of the code in my perl dir should even touch .exists 17:28 <@ether> and hopefully the last (ha ha!) :)
2.032 has been released, switching back from open3() to capture().
On Thu Sep 19 21:05:35 2013, ETHER wrote: Show quoted text
> 2.032 has been released, switching back from open3() to capture().
Although Dist-Zilla-Plugin-Test-Compile own tests fail on Windows ( http://www.cpantesters.org/cpan/report/c36e2df3-6bf9-1014-b43d-7f72db05e747 ), the generated test does not hang. -- Alexandr Ciornii, http://chorny.net
Subject: Re: [rt.cpan.org #88783] generated test sometimes hangs on Windows
Date: Fri, 20 Sep 2013 15:24:27 -0700
To: Alexandr Ciornii via RT <bug-Dist-Zilla-Plugin-Test-Compile [...] rt.cpan.org>
From: Karen Etheridge <ether [...] cpan.org>
On Fri, Sep 20, 2013 at 03:38:40PM -0400, Alexandr Ciornii via RT wrote: Show quoted text
> Although Dist-Zilla-Plugin-Test-Compile own tests fail on Windows ( http://www.cpantesters.org/cpan/report/c36e2df3-6bf9-1014-b43d-7f72db05e747 ), the generated test does not hang.
Ah yes, I haven't changed this dist yet to generate its own tests with the version about to be released; I'll make that change tonight (as well as reverting to using open3 again, but with waitpid in the right place).
On 2013-09-20 15:24:39, ETHER wrote: Show quoted text
> On Fri, Sep 20, 2013 at 03:38:40PM -0400, Alexandr Ciornii via RT > wrote:
> > Although Dist-Zilla-Plugin-Test-Compile own tests fail on Windows ( > > http://www.cpantesters.org/cpan/report/c36e2df3-6bf9-1014-b43d- > > 7f72db05e747 ), the generated test does not hang.
> > Ah yes, I haven't changed this dist yet to generate its own tests with > the > version about to be released
sorry, red herring; I did not look at the report closely enough. But I will fix.
I am optimistically closing this as resolved, with much hope in my heart. :)