Return-Path: X-Original-To: apmail-perl-modperl-cvs-archive@www.apache.org Delivered-To: apmail-perl-modperl-cvs-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C41E610F90 for ; Thu, 6 Feb 2014 14:29:54 +0000 (UTC) Received: (qmail 41410 invoked by uid 500); 6 Feb 2014 14:29:54 -0000 Delivered-To: apmail-perl-modperl-cvs-archive@perl.apache.org Received: (qmail 41250 invoked by uid 500); 6 Feb 2014 14:29:48 -0000 Mailing-List: contact modperl-cvs-help@perl.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: dev@perl.apache.org List-Id: Delivered-To: mailing list modperl-cvs@perl.apache.org Received: (qmail 41218 invoked by uid 99); 6 Feb 2014 14:29:46 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 14:29:46 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 06 Feb 2014 14:29:44 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 62AD02388AA6; Thu, 6 Feb 2014 14:29:23 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1565275 - /perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm Date: Thu, 06 Feb 2014 14:29:23 -0000 To: modperl-cvs@perl.apache.org From: stevehay@apache.org X-Mailer: svnmailer-1.0.9 Message-Id: <20140206142923.62AD02388AA6@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: stevehay Date: Thu Feb 6 14:29:23 2014 New Revision: 1565275 URL: http://svn.apache.org/r1565275 Log: Fix t/apache/subprocess.t on Windows, using httpd-2.4.x. This test fails every time for me, but not with httpd-2.2.x, which I don't understand. Debugging, if you start up the server, then add a break point in APR's read_with_timeout() (in readwrite.c) and walk through the function each time it is hit then the test passes. Without debugging it puts a "APR::PerlIO::read: (70007) The timeout specified has expired" error in the error_log and fails all tests. Presumably it is trying to read from the process spawned in subprocess.pm before the pipe is ready to be read from, and the delay in manually debugging fixes that. The comments in read_data() in subprocess.pm note that a delay is indeed required, and is achieved by select() in the non-PerlIO case (which I imagine nobody uses now anyway) or a apr_wait_for_io_or_timeout() call from apr_file_read() in the PerlIO case. However, whilst that remark is true of the *nix implementation of apr_file_read() (in file_io/unix/readwrite.c), it is not true of the Win32 version (in file_io/win32/readwrite.c). Thus, adding a short sleep() fixes it on Win32. What I don't understand is why this wasn't necessary with httpd-2.2.x. The file_io/win32/readwrite.c file is identical in the two versions I'm using (httpd-2.4.6 vs httpd-2.2.25; apr-1.4.8 in both). Modified: perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm Modified: perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm URL: http://svn.apache.org/viewvc/perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm?rev=1565275&r1=1565274&r2=1565275&view=diff ============================================================================== --- perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm (original) +++ perl/modperl/branches/httpd24threading/t/response/TestApache/subprocess.pm Thu Feb 6 14:29:23 2014 @@ -149,18 +149,21 @@ sub read_data { # # PerlIO-based pipe fh on the other hand does the select # internally via apr_wait_for_io_or_timeout() in - # apr_file_read(). But you cannot call select() on the + # apr_file_read() (on *nix, but not on Win32). + # But you cannot call select() on the # PerlIO-based, because its fileno() returns (-1), remember that # apr_file_t is an opaque object, and on certain platforms # fileno() is different from unix # # so we use the following wrapper: if we are under perlio we just - # go ahead and read the data, if we are under non-perlio we first + # go ahead and read the data, but with a short sleep first on Win32; + # if we are under non-perlio we first # select for a few secs. (XXX: is 10 secs enough?) # # btw: we use perlIO only for perl 5.7+ # if (APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED() || $sel->can_read(10)) { + sleep(1) if $^O eq 'MSWin32' && APR::PerlIO::PERLIO_LAYERS_ARE_ENABLED(); @data = wantarray ? (<$fh>) : <$fh>; }