Skip Menu |
 

This queue is for tickets about the Net-Telnet CPAN distribution.

Report information
The Basics
Id: 78419
Status: rejected
Priority: 0/
Queue: Net-Telnet

People
Owner: Nobody in particular
Requestors: beryllium [...] shaddybaddah.name
Cc:
AdminCc:

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



Subject: read error: Connection reset by peer at... unbuffered reads problematic
Date: Tue, 17 Jul 2012 13:54:35 +1000
To: bug-Net-Telnet [...] rt.cpan.org
From: Shaddy Baddah <beryllium [...] shaddybaddah.name>
Download (untitled) / with headers
text/plain 1.1k
Hi, I have an application that uses Net::Telnet to authenticate against a server by telnet. Unfortunately, dependent on the target server, I encounter: read error: Connection reset by peer at... It is true that the telnet server forces the connection closed. Unfortunately when it does this my application is unable to read the final lines of response from the server, due to this issue. I had a look through Telnet.pm and note that the main system call for reading back the data is sysread(): $nread = sysread $self, $s->{buf}, $s->{blksize}, $read_pos; and from the documentation [http://perldoc.perl.org/functions/sysread.html] I note that: "It bypasses buffered IO". This to me would account for the problem I am facing. I'm not suggesting using it is an error. In fact, I am fairly confident there is a good reason for its use. However, I think it is a bug that a check and read of any final data sent by the remote peer has not been implemented; if possible with the sysread() implementation; or otherwise, not to just use buffered I/O in a way that allows for coverage of all data sent back. -- Thanks, Shaddy
Download (untitled) / with headers
text/plain 249b
The note in the Perl doc about sysread "bypasses buffered IO" is a problem when mixing buffered and unbuffered I/O. Net::Telnet only reads from the object using sysread(). All data will be read by sysread() up to eof, timeout, or some other error.
Subject: Re: [rt.cpan.org #78419] read error: Connection reset by peer at... unbuffered reads problematic
Date: Sun, 16 Dec 2012 21:55:24 +1100
To: bug-Net-Telnet [...] rt.cpan.org
From: Shaddy Baddah <beryllium [...] shaddybaddah.name>
Download (untitled) / with headers
text/plain 1.3k
Hi, On 16/12/12 15:09, Jay Rogers via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=78419> > > The note in the Perl doc about sysread "bypasses buffered IO" is a > problem when mixing buffered and unbuffered I/O. Net::Telnet only reads > from the object using sysread(). All data will be read by sysread() up > to eof, timeout, or some other error.
Yes, I understand. But what I am claiming is this... no, not all data is read. I believe the eof is given a higher priority over data that has been received first, but based on timing, has not been read. So what I mean is, data arrives, but thread has not looped back to sysread(). In between, the remote peer closes the connection (hard up against sending the final output), and when sysread() is finally executed, the eof overrides the received data. Further, I am claiming this does not happen with buffered I/O. The eof is queued behind the final data received. I make this claim because the regular telnet client outputs this final bit of data (so obviously reads it) before exiting. This does not seem possible with sysread(). I say seem, because my experimentation, and understanding of sysread() has led me to that conclusion. To be fair, I think the onus is on me to generate a test case that can demonstrate Net::Telnet failing to read that final data. If I get some free time soon, I'll try and generate such a test. -- Regards, Shaddy
Thanks for your feedback. Yes a test case would help demonstrate the problem.


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.