Skip Menu |

This queue is for tickets about the Control-CLI CPAN distribution.

Report information
The Basics
Id: 80237
Status: resolved
Priority: 0/
Queue: Control-CLI

People
Owner: LSTEVENS [...] cpan.org
Requestors: rodrigo.olmos [...] gmail.com
Cc:
AdminCc:

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



Subject: telnet connect timeout
Date: Wed, 17 Oct 2012 11:57:01 +0200
To: bug-Control-CLI [...] rt.cpan.org
From: Rodrigo Olmos <rodrigo.olmos [...] gmail.com>
When i try to connect to a host and it's not reachable, it takes about 3 minutes until I get a timeout. I tried to change: new Control::CLI('TELNET'); to: new Control::CLI(Use => 'TELNET' , Timeout => 10); But it takes the same time until I get the timeout I'm using Control::CLI 1.03 and Net::Telnet 5.002
Hi Can you clarify the Net::Telnet version please ? The latest verson I know of is 3.03. Also, what OS are you using ? Windows or Unix ? Thanks On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote: Show quoted text
> When i try to connect to a host and it's not reachable, it takes about 3 > minutes until I get a timeout. I tried to change: > new Control::CLI('TELNET'); > to: > new Control::CLI(Use => 'TELNET' , Timeout => 10); > But it takes the same time until I get the timeout > I'm using Control::CLI 1.03 and Net::Telnet 5.002
Subject: Re: [rt.cpan.org #80237] telnet connect timeout
Date: Thu, 18 Oct 2012 11:33:14 +0200
To: bug-Control-CLI [...] rt.cpan.org
From: Rodrigo Olmos <rodrigo.olmos [...] gmail.com>
Sorry, the correct version in my system is 3.03. It's Windows XP SP3. Now I've tried three different Perl installations on the same system: ActivePerl 5.8.9 --> 3 minutes ActivePerl 5.16.1 --> 3 minutes Cygwin Perl 5.14.2 --> works fine (times out after 10 seconds) The Net::Telnet and Control::CLI versions are the same in the three of them. 2012/10/17 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > Hi > Can you clarify the Net::Telnet version please ? > The latest verson I know of is 3.03. > Also, what OS are you using ? Windows or Unix ? > Thanks > > On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote:
> > When i try to connect to a host and it's not reachable, it takes about 3 > > minutes until I get a timeout. I tried to change: > > new Control::CLI('TELNET'); > > to: > > new Control::CLI(Use => 'TELNET' , Timeout => 10); > > But it takes the same time until I get the timeout > > I'm using Control::CLI 1.03 and Net::Telnet 5.002
> > > >
Hi Rodrigo Thanks for your reply. Yes, in fact on my XP laptop I always get 20 seconds connection timeout no matter what I set the module timeout to; so this is the same problem you have but as 20secs is not far off the 10secs timeout I normally use, I never noticed it before. However on on a Solaris machine the module behaves correctly (also on Cygwin perl as you state) and whatever timeout is defined in the module this also applies to the connection timeout. Had to do some digging; my module relies on Net::Telnet for Telnet access, which in turn relies on IO:Socket:INET. So all I'm doing is passing on the timeout setting to Net::Telnet. Turns out that IO::Socket::INET has no connection timeout handling (well, the code is there but commented out; go figure..!; see http://stackoverflow.com/questions/3570440/perl-how-to-get-iosocketinet-timeout-after-x-seconds ). The author of Net::Telnet must have been well aware of this, as his module, as a workaround, wraps the Socket connection call in an eval block and sets an alarm to the configured timeout. Now this eval/alarm code works fine on any unix system, but simply does not work on Win32 Activestate distribution (I'm using v5.12.3). Infact the problem is to be found in ActiveSate's release notes where it clearly states that signals are unsupported by the Win32 API and the alarm() function is not implemented. The more general problem is that "Windows does not have signals. POSIX systems like Linux have signals"; so for example Strawberry Perl for Win32 will have exactly the same problem as ActiveState. So, I'm afraid I don't see how I can plaster over all these underlying deficiencies; I guess one could open the connection in a thread and then kill the thread if the connection is not established within the timeout period; but I'm not comfortable introducing thread dependency in my module as this would likely limit it's use under older Perl distributions. However this is one option you could investigate in your own code. Now, in your case, you said you were getting 3 minute timeouts (slightly worse than my 20 secs!); so I had a look at that. Given that, as described above, no Perl connection timeout is enforced under Win32, it must follow that the Windows API timeouts are in force. From a bit more digging: http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters TcpInitialRTT: Defines what the initial time-out settings are for new connections. This number in seconds is doubled each time it retransmits before timing a connection out. Defaults to 3. TcpMaxConnectRetransmissions: Defines the number of retransmissions before timing a connection out. Defaults to 2. On my XP laptop, neither of the above Keys is set in my Registry; so I get the following default timeout: 3+6+12=21 secs. I guess on your machine you might have the above keys set to something else. Hope this helps Best regards Ludovico Stevens On Thu Oct 18 05:33:54 2012, rodrigo.olmos@gmail.com wrote: Show quoted text
> Sorry, the correct version in my system is 3.03. > It's Windows XP SP3. Now I've tried three different Perl installations on > the same system: > ActivePerl 5.8.9 --> 3 minutes > ActivePerl 5.16.1 --> 3 minutes > Cygwin Perl 5.14.2 --> works fine (times out after 10 seconds) > > The Net::Telnet and Control::CLI versions are the same in the three of
them. Show quoted text
> > 2012/10/17 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > Hi > > Can you clarify the Net::Telnet version please ? > > The latest verson I know of is 3.03. > > Also, what OS are you using ? Windows or Unix ? > > Thanks > > > > On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote:
> > > When i try to connect to a host and it's not reachable, it takes
about 3 Show quoted text
> > > minutes until I get a timeout. I tried to change: > > > new Control::CLI('TELNET'); > > > to: > > > new Control::CLI(Use => 'TELNET' , Timeout => 10); > > > But it takes the same time until I get the timeout > > > I'm using Control::CLI 1.03 and Net::Telnet 5.002
> > > > > > > >
Subject: Re: [rt.cpan.org #80237] telnet connect timeout
Date: Tue, 23 Oct 2012 11:42:12 +0200
To: bug-Control-CLI [...] rt.cpan.org
From: Rodrigo Olmos <rodrigo.olmos [...] gmail.com>
Thanks Ludovico, I tried the registry setting solution and it worked. The TcpMaxConnectRetransmissions was set to 5 in my system, I don't know why. Setting it to 2 and rebooting worked fine. I think this is a better solution to changing anything in the Perl modules as any other applications in my system would have the same problem. Rodrigo 2012/10/21 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > Hi Rodrigo > > Thanks for your reply. > Yes, in fact on my XP laptop I always get 20 seconds connection timeout > no matter what I set the module timeout to; so this is the same problem > you have but as 20secs is not far off the 10secs timeout I normally use, > I never noticed it before. > However on on a Solaris machine the module behaves correctly (also on > Cygwin perl as you state) and whatever timeout is defined in the module > this also applies to the connection timeout. > Had to do some digging; my module relies on Net::Telnet for Telnet > access, which in turn relies on IO:Socket:INET. So all I'm doing is > passing on the timeout setting to Net::Telnet. > Turns out that IO::Socket::INET has no connection timeout handling > (well, the code is there but commented out; go figure..!; see > > http://stackoverflow.com/questions/3570440/perl-how-to-get-iosocketinet-timeout-after-x-seconds > ). > The author of Net::Telnet must have been well aware of this, as his > module, as a workaround, wraps the Socket connection call in an eval > block and sets an alarm to the configured timeout. Now this eval/alarm > code works fine on any unix system, but simply does not work on Win32 > Activestate distribution (I'm using v5.12.3). > Infact the problem is to be found in ActiveSate's release notes where it > clearly states that signals are unsupported by the Win32 API and the > alarm() function is not implemented. The more general problem is that > "Windows does not have signals. POSIX systems like Linux have signals"; > so for example Strawberry Perl for Win32 will have exactly the same > problem as ActiveState. > So, I'm afraid I don't see how I can plaster over all these underlying > deficiencies; I guess one could open the connection in a thread and then > kill the thread if the connection is not established within the timeout > period; but I'm not comfortable introducing thread dependency in my > module as this would likely limit it's use under older Perl > distributions. However this is one option you could investigate in your > own code. > > Now, in your case, you said you were getting 3 minute timeouts (slightly > worse than my 20 secs!); so I had a look at that. Given that, as > described above, no Perl connection timeout is enforced under Win32, it > must follow that the Windows API timeouts are in force. From a bit more > digging: > > http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx > > HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip \Parameters > > TcpInitialRTT: Defines what the initial time-out settings are for new > connections. This number in seconds is doubled each time it retransmits > before timing a connection out. Defaults to 3. > > TcpMaxConnectRetransmissions: Defines the number of retransmissions > before timing a connection out. Defaults to 2. > > On my XP laptop, neither of the above Keys is set in my Registry; so I > get the following default timeout: 3+6+12=21 secs. > I guess on your machine you might have the above keys set to something > else. > > Hope this helps > Best regards > Ludovico Stevens > > > On Thu Oct 18 05:33:54 2012, rodrigo.olmos@gmail.com wrote:
> > Sorry, the correct version in my system is 3.03. > > It's Windows XP SP3. Now I've tried three different Perl installations on > > the same system: > > ActivePerl 5.8.9 --> 3 minutes > > ActivePerl 5.16.1 --> 3 minutes > > Cygwin Perl 5.14.2 --> works fine (times out after 10 seconds) > > > > The Net::Telnet and Control::CLI versions are the same in the three of
> them.
> > > > 2012/10/17 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> > >
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > > > Hi > > > Can you clarify the Net::Telnet version please ? > > > The latest verson I know of is 3.03. > > > Also, what OS are you using ? Windows or Unix ? > > > Thanks > > > > > > On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote:
> > > > When i try to connect to a host and it's not reachable, it takes
> about 3
> > > > minutes until I get a timeout. I tried to change: > > > > new Control::CLI('TELNET'); > > > > to: > > > > new Control::CLI(Use => 'TELNET' , Timeout => 10); > > > > But it takes the same time until I get the timeout > > > > I'm using Control::CLI 1.03 and Net::Telnet 5.002
> > > > > > > > > > > >
> > > >
Problem understood but located in underlying modules on MSWin32. Provided workaround
Hi Just thought I'd give you heads up that I found a way to implement a connection_timeout in the latest version 1.05 of my module. I'm now setting up the socket myself (I do this to also have IPv6 support) and then passing it to Net::Telnet or Net::SSH2 as a filehandle; so I'm now able to enforce a connection_timeout. Best regards Ludovico Stevens On Tue Oct 23 05:42:54 2012, rodrigo.olmos@gmail.com wrote: Show quoted text
> Thanks Ludovico, > I tried the registry setting solution and it worked. > The TcpMaxConnectRetransmissions was set to 5 in my system, I don't > know > why. Setting it to 2 and rebooting worked fine. I think this is a > better > solution to changing anything in the Perl modules as any other > applications > in my system would have the same problem. > Rodrigo > > 2012/10/21 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> >
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > Hi Rodrigo > > > > Thanks for your reply. > > Yes, in fact on my XP laptop I always get 20 seconds connection > > timeout > > no matter what I set the module timeout to; so this is the same > > problem > > you have but as 20secs is not far off the 10secs timeout I normally > > use, > > I never noticed it before. > > However on on a Solaris machine the module behaves correctly (also on > > Cygwin perl as you state) and whatever timeout is defined in the > > module > > this also applies to the connection timeout. > > Had to do some digging; my module relies on Net::Telnet for Telnet > > access, which in turn relies on IO:Socket:INET. So all I'm doing is > > passing on the timeout setting to Net::Telnet. > > Turns out that IO::Socket::INET has no connection timeout handling > > (well, the code is there but commented out; go figure..!; see > > > > http://stackoverflow.com/questions/3570440/perl-how-to-get- > > iosocketinet-timeout-after-x-seconds > > ). > > The author of Net::Telnet must have been well aware of this, as his > > module, as a workaround, wraps the Socket connection call in an eval > > block and sets an alarm to the configured timeout. Now this > > eval/alarm > > code works fine on any unix system, but simply does not work on Win32 > > Activestate distribution (I'm using v5.12.3). > > Infact the problem is to be found in ActiveSate's release notes where > > it > > clearly states that signals are unsupported by the Win32 API and the > > alarm() function is not implemented. The more general problem is that > > "Windows does not have signals. POSIX systems like Linux have > > signals"; > > so for example Strawberry Perl for Win32 will have exactly the same > > problem as ActiveState. > > So, I'm afraid I don't see how I can plaster over all these > > underlying > > deficiencies; I guess one could open the connection in a thread and > > then > > kill the thread if the connection is not established within the > > timeout > > period; but I'm not comfortable introducing thread dependency in my > > module as this would likely limit it's use under older Perl > > distributions. However this is one option you could investigate in > > your > > own code. > > > > Now, in your case, you said you were getting 3 minute timeouts > > (slightly > > worse than my 20 secs!); so I had a look at that. Given that, as > > described above, no Perl connection timeout is enforced under Win32, > > it > > must follow that the Windows API timeouts are in force. From a bit > > more > > digging: > > > > http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx > > > > HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip > > \Parameters > > > > TcpInitialRTT: Defines what the initial time-out settings are for new > > connections. This number in seconds is doubled each time it > > retransmits > > before timing a connection out. Defaults to 3. > > > > TcpMaxConnectRetransmissions: Defines the number of retransmissions > > before timing a connection out. Defaults to 2. > > > > On my XP laptop, neither of the above Keys is set in my Registry; so > > I > > get the following default timeout: 3+6+12=21 secs. > > I guess on your machine you might have the above keys set to > > something > > else. > > > > Hope this helps > > Best regards > > Ludovico Stevens > > > > > > On Thu Oct 18 05:33:54 2012, rodrigo.olmos@gmail.com wrote:
> > > Sorry, the correct version in my system is 3.03. > > > It's Windows XP SP3. Now I've tried three different Perl > > > installations on > > > the same system: > > > ActivePerl 5.8.9 --> 3 minutes > > > ActivePerl 5.16.1 --> 3 minutes > > > Cygwin Perl 5.14.2 --> works fine (times out after 10 seconds) > > > > > > The Net::Telnet and Control::CLI versions are the same in the three > > > of
> > them.
> > > > > > 2012/10/17 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> > > >
> > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > > > > > Hi > > > > Can you clarify the Net::Telnet version please ? > > > > The latest verson I know of is 3.03. > > > > Also, what OS are you using ? Windows or Unix ? > > > > Thanks > > > > > > > > On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote:
> > > > > When i try to connect to a host and it's not reachable, it > > > > > takes
> > about 3
> > > > > minutes until I get a timeout. I tried to change: > > > > > new Control::CLI('TELNET'); > > > > > to: > > > > > new Control::CLI(Use => 'TELNET' , Timeout => 10); > > > > > But it takes the same time until I get the timeout > > > > > I'm using Control::CLI 1.03 and Net::Telnet 5.002
> > > > > > > > > > > > > > > >
> > > > > > > >
Subject: Re: [rt.cpan.org #80237] telnet connect timeout
Date: Wed, 4 Sep 2013 11:06:38 +0200
To: bug-Control-CLI [...] rt.cpan.org
From: Rodrigo Olmos <rodrigo.olmos [...] gmail.com>
Thanks, I'm going to try it. 2013/8/28 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > Hi > > Just thought I'd give you heads up that I found a way to implement a > connection_timeout in the latest version 1.05 of my module. > I'm now setting up the socket myself (I do this to also have IPv6 support) > and then passing it to Net::Telnet or Net::SSH2 as a filehandle; so I'm now > able to enforce a connection_timeout. > > Best regards > Ludovico Stevens > > On Tue Oct 23 05:42:54 2012, rodrigo.olmos@gmail.com wrote:
> > Thanks Ludovico, > > I tried the registry setting solution and it worked. > > The TcpMaxConnectRetransmissions was set to 5 in my system, I don't > > know > > why. Setting it to 2 and rebooting worked fine. I think this is a > > better > > solution to changing anything in the Perl modules as any other > > applications > > in my system would have the same problem. > > Rodrigo > > > > 2012/10/21 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> > >
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > > > Hi Rodrigo > > > > > > Thanks for your reply. > > > Yes, in fact on my XP laptop I always get 20 seconds connection > > > timeout > > > no matter what I set the module timeout to; so this is the same > > > problem > > > you have but as 20secs is not far off the 10secs timeout I normally > > > use, > > > I never noticed it before. > > > However on on a Solaris machine the module behaves correctly (also on > > > Cygwin perl as you state) and whatever timeout is defined in the > > > module > > > this also applies to the connection timeout. > > > Had to do some digging; my module relies on Net::Telnet for Telnet > > > access, which in turn relies on IO:Socket:INET. So all I'm doing is > > > passing on the timeout setting to Net::Telnet. > > > Turns out that IO::Socket::INET has no connection timeout handling > > > (well, the code is there but commented out; go figure..!; see > > > > > > http://stackoverflow.com/questions/3570440/perl-how-to-get- > > > iosocketinet-timeout-after-x-seconds > > > ). > > > The author of Net::Telnet must have been well aware of this, as his > > > module, as a workaround, wraps the Socket connection call in an eval > > > block and sets an alarm to the configured timeout. Now this > > > eval/alarm > > > code works fine on any unix system, but simply does not work on Win32 > > > Activestate distribution (I'm using v5.12.3). > > > Infact the problem is to be found in ActiveSate's release notes where > > > it > > > clearly states that signals are unsupported by the Win32 API and the > > > alarm() function is not implemented. The more general problem is that > > > "Windows does not have signals. POSIX systems like Linux have > > > signals"; > > > so for example Strawberry Perl for Win32 will have exactly the same > > > problem as ActiveState. > > > So, I'm afraid I don't see how I can plaster over all these > > > underlying > > > deficiencies; I guess one could open the connection in a thread and > > > then > > > kill the thread if the connection is not established within the > > > timeout > > > period; but I'm not comfortable introducing thread dependency in my > > > module as this would likely limit it's use under older Perl > > > distributions. However this is one option you could investigate in > > > your > > > own code. > > > > > > Now, in your case, you said you were getting 3 minute timeouts > > > (slightly > > > worse than my 20 secs!); so I had a look at that. Given that, as > > > described above, no Perl connection timeout is enforced under Win32, > > > it > > > must follow that the Windows API timeouts are in force. From a bit > > > more > > > digging: > > > > > > http://technet.microsoft.com/en-us/library/cc739819(WS.10).aspx > > > > > > HKEY_LOCAL_MACHINE \SYSTEM \CurrentControlSet \Services: \Tcpip > > > \Parameters > > > > > > TcpInitialRTT: Defines what the initial time-out settings are for new > > > connections. This number in seconds is doubled each time it > > > retransmits > > > before timing a connection out. Defaults to 3. > > > > > > TcpMaxConnectRetransmissions: Defines the number of retransmissions > > > before timing a connection out. Defaults to 2. > > > > > > On my XP laptop, neither of the above Keys is set in my Registry; so > > > I > > > get the following default timeout: 3+6+12=21 secs. > > > I guess on your machine you might have the above keys set to > > > something > > > else. > > > > > > Hope this helps > > > Best regards > > > Ludovico Stevens > > > > > > > > > On Thu Oct 18 05:33:54 2012, rodrigo.olmos@gmail.com wrote:
> > > > Sorry, the correct version in my system is 3.03. > > > > It's Windows XP SP3. Now I've tried three different Perl > > > > installations on > > > > the same system: > > > > ActivePerl 5.8.9 --> 3 minutes > > > > ActivePerl 5.16.1 --> 3 minutes > > > > Cygwin Perl 5.14.2 --> works fine (times out after 10 seconds) > > > > > > > > The Net::Telnet and Control::CLI versions are the same in the three > > > > of
> > > them.
> > > > > > > > 2012/10/17 Ludovico Stevens via RT <bug-Control-CLI@rt.cpan.org> > > > >
> > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=80237 > > > > > > > > > > > Hi > > > > > Can you clarify the Net::Telnet version please ? > > > > > The latest verson I know of is 3.03. > > > > > Also, what OS are you using ? Windows or Unix ? > > > > > Thanks > > > > > > > > > > On Wed Oct 17 05:57:41 2012, rodrigo.olmos@gmail.com wrote:
> > > > > > When i try to connect to a host and it's not reachable, it > > > > > > takes
> > > about 3
> > > > > > minutes until I get a timeout. I tried to change: > > > > > > new Control::CLI('TELNET'); > > > > > > to: > > > > > > new Control::CLI(Use => 'TELNET' , Timeout => 10); > > > > > > But it takes the same time until I get the timeout > > > > > > I'm using Control::CLI 1.03 and Net::Telnet 5.002
> > > > > > > > > > > > > > > > > > > >
> > > > > > > > > > > >
> > > >