Skip Menu |
 

This queue is for tickets about the IO-Socket-IP CPAN distribution.

Report information
The Basics
Id: 100654
Status: resolved
Priority: 0/
Queue: IO-Socket-IP

People
Owner: Nobody in particular
Requestors: craigberry [...] mac.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.34



MIME-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
X-Spam-Status: No, score=-1.455 tagged_above=-99.9 required=10 tests=[BAYES_00=-1.9, FREEMAIL_FROM=0.001, MALFORMED_FREEMAIL=2.754, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01] autolearn=no
X-Mailer: Apple Mail (2.1993)
X-Spam-Flag: NO
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1412020025
Message-ID: <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com>
content-type: text/plain; charset="utf-8"
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
X-Spam-Score: -1.455
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 573BE2406A8 for <cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com>; Mon, 1 Dec 2014 22:22:01 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id YeWaVQjr-4fh for <cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com>; Mon, 1 Dec 2014 22:22:00 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id 46AB0240685 for <bug-IO-Socket-IP [...] rt.cpan.org>; Mon, 1 Dec 2014 22:22:00 -0500 (EST)
Received: (qmail 2602 invoked by alias); 2 Dec 2014 03:21:59 -0000
Received: from nk11p03mm-asmtpout001.mac.com (HELO nk11p03mm-asmtp001.mac.com) (17.158.232.236) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Mon, 01 Dec 2014 19:21:58 -0800
Received: from [172.16.52.2] (unknown [73.45.97.251]) by nk11p03mm-asmtp001.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTPSA id <0NFX008MLQOGKF60 [...] nk11p03mm-asmtp001.mac.com> for bug-IO-Socket-IP [...] rt.cpan.org; Tue, 02 Dec 2014 03:21:54 +0000 (GMT)
Delivered-To: cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com
Subject: [PATCH] only select for write readiness in connect
Return-Path: <craigberry [...] mac.com>
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2014-12-02_02:2014-12-01,2014-12-02,1970-01-01 signatures=0
X-RT-Mail-Extension: io-socket-ip
X-Original-To: cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com
X-Spam-Check-BY: la.mx.develooper.com
Date: Mon, 01 Dec 2014 21:21:52 -0600
X-Spam-Level:
To: bug-IO-Socket-IP [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: "Craig A. Berry" <craigberry [...] mac.com>
X-RT-Original-Encoding: ascii
X-RT-Interface: Email
Content-Length: 1693
Download (untitled) / with headers
text/plain 1.6k
When doing a non-blocking connect, IO::Socket::IP calls select with a timeout until the connection completes. However, that select call queries for ready-to-read, ready-to-write, and pending error, which doesn't really make sense as select is only documented to respond to a ready-to-write query when a non-blocking connect completes. Changing the call so it only waits for ready-to-write to be set gets t/22timeout.t passing on VMS, where it has failed since inception. The select had been returning immediately without waiting for the timeout. Yes, there is probably something buggy about the VMS implementation that causes it to respond in an incoherent way to an undocumented combination of arguments. But it responds correctly to the documented combination of arguments, and there is no downside to just using the documented combination everywhere. With this change, tests still pass on Windows and OS X as well as starting to pass on VMS. The patch itself is so simple I'll just paste it inline: --- lib/IO/Socket/IP.pm;-0 2014-11-27 08:22:08 -0600 +++ lib/IO/Socket/IP.pm 2014-11-30 20:54:47 -0600 @@ -684,7 +684,7 @@ } my $vec = ''; vec( $vec, $self->fileno, 1 ) = 1; - if( !select( $vec, $vec, $vec, $timeout ) ) { + if( !select( undef, $vec, undef, $timeout ) ) { $! = ETIMEDOUT; return undef; } [end] Possibly easier than applying the patch would be to just edit the first and third arguments to select, replacing them with undef. Show quoted text
________________________________________ Craig A. Berry mailto:craigberry@mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser
MIME-Version: 1.0
In-Reply-To: <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-1796-1417515967-844.100654-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 1604
Download (untitled) / with headers
text/plain 1.5k
On Mon Dec 01 22:22:02 2014, craigberry@mac.com wrote: Show quoted text
> When doing a non-blocking connect, IO::Socket::IP calls select with a > timeout until the connection completes. However, that select call > queries for ready-to-read, ready-to-write, and pending error, which > doesn't really make sense as select is only documented to respond to a > ready-to-write query when a non-blocking connect completes.
Yes.. It does that at least partly because of MSWin32, which unlike POSIX says, reports only a *successful* connect as ready-to-write. If the connection attempt fails, it only sents pending-error status. Show quoted text
> Changing the call so it only waits for ready-to-write to be set gets > t/22timeout.t passing on VMS, where it has failed since inception. > The select had been returning immediately without waiting for the > timeout. Yes, there is probably something buggy about the VMS > implementation that causes it to respond in an incoherent way to an > undocumented combination of arguments. But it responds correctly to > the documented combination of arguments, and there is no downside to > just using the documented combination everywhere. With this change, > tests still pass on Windows and OS X as well as starting to pass on > VMS.
Interesting that you say it still passes on Windows; I suspect therefore that perhaps some of the tests aren't properly exercising the right behaviours. Did you do that on a real MSWin32, or a Strawberry/Cygwin-related perl? Also, what happens on VMS if you only take out the read-ready, but leave it testing write-ready or pending-error states? -- Paul Evans
MIME-Version: 1.0 (Mac OS X Mail 8.1 \(1993\))
X-Spam-Status: No, score=-3.455 tagged_above=-99.9 required=10 tests=[AWL=2.000, BAYES_00=-1.9, FREEMAIL_FROM=0.001, FROM_OUR_RT=-4, MALFORMED_FREEMAIL=2.754, RCVD_IN_DNSWL_MED=-2.3, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
In-Reply-To: <rt-4.0.18-1796-1417515967-250.100654-6-0 [...] rt.cpan.org>
X-Mailer: Apple Mail (2.1993)
X-Spam-Flag: NO
X-RT-Interface: API
References: <RT-Ticket-100654 [...] rt.cpan.org> <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com> <rt-4.0.18-1796-1417515967-250.100654-6-0 [...] rt.cpan.org>
X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 suspectscore=1 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=7.0.1-1408290000 definitions=main-1412020121
X-Virus-Scanned: Debian amavisd-new at bestpractical.com
content-type: text/plain; charset="utf-8"
Message-ID: <F6BDD2F8-56E3-4F55-960C-210BD532437F [...] mac.com>
X-RT-Original-Encoding: utf-8
X-Spam-Score: -3.455
Received: from localhost (localhost [127.0.0.1]) by hipster.bestpractical.com (Postfix) with ESMTP id 08439240679 for <cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com>; Tue, 2 Dec 2014 08:28:29 -0500 (EST)
Received: from hipster.bestpractical.com ([127.0.0.1]) by localhost (hipster.bestpractical.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id H1-frW3yioZT for <cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com>; Tue, 2 Dec 2014 08:28:27 -0500 (EST)
Received: from la.mx.develooper.com (x1.develooper.com [207.171.7.70]) by hipster.bestpractical.com (Postfix) with SMTP id A1FBC2401C6 for <bug-IO-Socket-IP [...] rt.cpan.org>; Tue, 2 Dec 2014 08:28:27 -0500 (EST)
Received: (qmail 3129 invoked by alias); 2 Dec 2014 13:28:26 -0000
Received: from nk11p03mm-asmtp001.mac.com (HELO nk11p03mm-asmtp001.mac.com) (17.158.232.236) by la.mx.develooper.com (qpsmtpd/0.28) with ESMTP; Tue, 02 Dec 2014 05:28:25 -0800
Received: from [172.16.52.2] (unknown [73.45.97.251]) by nk11p03mm-asmtp001.mac.com (Oracle Communications Messaging Server 7.0.5.33.0 64bit (built Aug 27 2014)) with ESMTPSA id <0NFY00LWQIQXIH60 [...] nk11p03mm-asmtp001.mac.com> for bug-IO-Socket-IP [...] rt.cpan.org; Tue, 02 Dec 2014 13:28:14 +0000 (GMT)
Delivered-To: cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com
Subject: Re: [rt.cpan.org #100654] [PATCH] only select for write readiness in connect
Return-Path: <craigberry [...] mac.com>
X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2014-12-02_06:2014-12-02,2014-12-02,1970-01-01 signatures=0
X-Spam-Check-BY: la.mx.develooper.com
X-Original-To: cpan-bug+IO-Socket-IP [...] hipster.bestpractical.com
X-RT-Mail-Extension: io-socket-ip
Date: Tue, 02 Dec 2014 07:28:09 -0600
X-Spam-Level:
To: bug-IO-Socket-IP [...] rt.cpan.org
Content-Transfer-Encoding: quoted-printable
From: "Craig A. Berry" <craigberry [...] mac.com>
RT-Message-ID: <rt-4.0.18-4565-1417526910-1288.100654-0-0 [...] rt.cpan.org>
Content-Length: 2353
Download (untitled) / with headers
text/plain 2.2k
Show quoted text
> On Dec 2, 2014, at 4:26 AM, Paul Evans via RT <bug-IO-Socket-IP@rt.cpan.org> wrote: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=100654 > > > On Mon Dec 01 22:22:02 2014, craigberry@mac.com wrote:
>> When doing a non-blocking connect, IO::Socket::IP calls select with a >> timeout until the connection completes. However, that select call >> queries for ready-to-read, ready-to-write, and pending error, which >> doesn't really make sense as select is only documented to respond to a >> ready-to-write query when a non-blocking connect completes.
> > Yes.. It does that at least partly because of MSWin32, which unlike POSIX says, reports only a *successful* connect as ready-to-write. If the connection attempt fails, it only sents pending-error status. >
>> Changing the call so it only waits for ready-to-write to be set gets >> t/22timeout.t passing on VMS, where it has failed since inception. >> The select had been returning immediately without waiting for the >> timeout. Yes, there is probably something buggy about the VMS >> implementation that causes it to respond in an incoherent way to an >> undocumented combination of arguments. But it responds correctly to >> the documented combination of arguments, and there is no downside to >> just using the documented combination everywhere. With this change, >> tests still pass on Windows and OS X as well as starting to pass on >> VMS.
> > Interesting that you say it still passes on Windows; I suspect therefore that perhaps some of the tests aren't properly exercising the right behaviours. Did you do that on a real MSWin32, or a Strawberry/Cygwin-related perl?
Windows 7 Pro, recent blead built from scratch using MSVC110 (Visual Studio 2012). But I think you're right that the test isn't really testing what happens when the connect fails while waiting in the select. It might be pretty hard to test that scenario reliably. Show quoted text
> Also, what happens on VMS if you only take out the read-ready, but leave it testing write-ready or pending-error states?
VMS passes the test with only ready-to-read passed as undef and the other two left in, so I'm fine with doing that instead. Show quoted text
________________________________________ Craig A. Berry mailto:craigberry@mac.com "... getting out of a sonnet is much more difficult than getting in." Brad Leithauser
MIME-Version: 1.0
In-Reply-To: <rt-4.0.18-4565-1417526910-1288.100654-0-0 [...] rt.cpan.org>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <RT-Ticket-100654 [...] rt.cpan.org> <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com> <rt-4.0.18-1796-1417515967-250.100654-6-0 [...] rt.cpan.org> <F6BDD2F8-56E3-4F55-960C-210BD532437F [...] mac.com> <rt-4.0.18-4565-1417526910-1288.100654-0-0 [...] rt.cpan.org>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-2679-1417565350-600.100654-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 249
Download (untitled) / with headers
text/plain 249b
On Tue Dec 02 08:28:30 2014, craigberry@mac.com wrote: Show quoted text
> VMS passes the test with only ready-to-read passed as undef and the > other two left in, so I'm fine with doing that instead.
Just uploaded 0.34 to CPAN, containing this fix. -- Paul Evans
MIME-Version: 1.0
In-Reply-To: <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com>
X-Mailer: MIME-tools 5.504 (Entity 5.504)
Content-Disposition: inline
X-RT-Interface: Web
References: <CAA829CA-D31B-413A-95A8-A2C302EED27B [...] mac.com>
Content-Type: text/plain; charset="utf-8"
Message-ID: <rt-4.0.18-28911-1417790042-1193.100654-0-0 [...] rt.cpan.org>
Content-Transfer-Encoding: binary
X-RT-Original-Encoding: utf-8
X-RT-Encrypt: 0
X-RT-Sign: 0
Content-Length: 33
Released as 0.34 -- Paul Evans


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.