kathmi / puttycyg

Automatically exported from code.google.com/p/puttycyg
0 stars 1 forks source link

putty cygwin closes when large flood comes from terminal #39

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Run a program that produces a bunch of output, and cygwin putty dies.

I think this is due to the cthelper buffers running out of room, or 
something like that.  It looks like the putty side of things just gets an 
FD_CLOSE from the socket, so I think the problem has to be in cthelper.

Repro:
Compile this and run it:
 #include <iostream>
 int main() { for (int i = 0;;) { std::cout << i++ << '\n'; } }
%./a.exe
[prints a bunch of growing numbers and then putty closes at around 16k]

PutTTYcyg version: 0.60
Cygwin version: 1.7.2
Windows version: windows 7

Original issue reported on code.google.com by jordan.d...@gmail.com on 6 May 2010 at 4:18

GoogleCodeExporter commented 9 years ago
Another way to reproduce this is just making a loop that produces enough 
flooding, such as "yes"

Original comment by sergtz....@gmail.com on 16 Jun 2010 at 3:37

GoogleCodeExporter commented 9 years ago
cthelper maintains non-blocking pipes to PuTTY and Cygwin and asks the select() 
function whether it can write to them without blocking. Alas, it seems that 
select() sometimes says "yes" even when the pipes are full. This may be a 
Cygwin limitation:

<blockquote 
cite="http://www.cygwin.com/faq/faq-nochunks.html#faq.api.net-functions">
The POSIX select system call can wait on a standard file handles and handles to 
sockets. The select call in Winsock can only wait on sockets. Because of this, 
the Cygwin dll does a lot of nasty stuff behind the scenes, trying to persuade 
various Winsock/Win32 functions to do what a Unix select would do.
</blockquote>

In the meantime, we can handle the EWOULDBLOCK (aka EAGAIN) case. See patch.

Original comment by shane.be...@gmail.com on 29 Jun 2010 at 3:41

Attachments:

GoogleCodeExporter commented 9 years ago
By the way: The -mno-cygwin flag was removed from GCC 4 in Cygwin 1.7. You'll 
want to install and use GCC 3. Example:

svn co http://puttycyg.googlecode.com/svn/trunk puttycyg-issue39
cd puttycyg-issue39
curl \
  'http://puttycyg.googlecode.com/issues/attachment?aid=-3085487759998918932&name=issue39-2010-06-29T081354.patch&token=22f1aa778ea2336caf6230fcd7572743' \
  | patch -p0
make CC=gcc-3 -f Makefile.maint

The resulting executables:

putty-0.60/windows/putty.exe
putty-0.60/windows/puttytel.exe
putty-0.60/windows/cthelper/cthelper.exe

Original comment by shane.be...@gmail.com on 29 Jun 2010 at 3:45

GoogleCodeExporter commented 9 years ago
Thanks for tracking this down!

I had hoped that when I found time to work on it, I would look into issue 42 as 
well.  You wouldn't happen to have an idea about that, would you?  :)

I'll try to make a beta release this weekend.

Original comment by medgar123 on 30 Jun 2010 at 9:16

GoogleCodeExporter commented 9 years ago
Any beta releases yet that fixes this issue? At the moment, I am using mintty 
but it does not have the flexibility of puttycyg.

Original comment by slack...@gmail.com on 17 Sep 2010 at 2:02

GoogleCodeExporter commented 9 years ago
@slackamp I can't help with the issue at hand, but please feel free to report 
PuTTY features you're missing in mintty at 
http://code.google.com/p/mintty/issues.

Original comment by andy.koppe on 18 Sep 2010 at 2:43

GoogleCodeExporter commented 9 years ago
Finally got around to applying this patch; seems to fix the problem.

Thanks!

Original comment by jordan.d...@gmail.com on 19 Sep 2010 at 7:28

GoogleCodeExporter commented 9 years ago
@jordan care to share your binaries?
@andy, i am missing color options but someone has already requested for it 
(issue 193).

Original comment by slack...@gmail.com on 28 Oct 2010 at 8:28

GoogleCodeExporter commented 9 years ago
Uploaded new BETA version:

http://code.google.com/p/puttycyg/downloads/detail?name=puttycyg-20101029.zip

Original comment by medgar123 on 29 Oct 2010 at 12:03

GoogleCodeExporter commented 9 years ago
Hi.  Been fighting same buffer overflow/puttycyg window crash for a while.  
Downloaded beta fix and wanted to provide feedback that the patch fixed the 
issue.  Thanks guys!

Original comment by djaege...@gmail.com on 4 Nov 2010 at 6:24

GoogleCodeExporter commented 9 years ago
Thanks for the feedback; I'll promote the BETA now. :)

Original comment by medgar123 on 4 Nov 2010 at 7:49