Nessesarius / mintty

Automatically exported from code.google.com/p/mintty
GNU General Public License v3.0
0 stars 0 forks source link

Window randomly left open #215

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. open mintty, with bash as shell
2. execute some process
3. exit bash

What is the expected output? What do you see instead?
expected:
mintty closes itself automatically
instead:
mintty don't close itself (sometimes)

What versions of mintty, Cygwin/MSYS, and Windows are you using?
0.8.2
Windows 7 x64
$ uname -a
CYGWIN_NT-6.1-WOW64 1.7.6(0.230/5/3) 2010-08-16 16:06 i686 Cygwin

Original issue reported on code.google.com by xue...@gmail.com on 2 Sep 2010 at 1:04

GoogleCodeExporter commented 8 years ago
Yep, I've seen this too. In tests, in happens perhaps 1 in 20 times for me. How 
often do you get this?

Presumably there's something not quite right with the SIGCHLD handling. The 
workaround is to just press another key or the close button. I hope you haven't 
seen it refuse to close completely?

Original comment by andy.koppe on 2 Sep 2010 at 6:28

GoogleCodeExporter commented 8 years ago
perhaps 1/10
>> The workaround is to just press another key or the close button. I hope you 
haven't seen it refuse to close completely
same here

Original comment by xue...@gmail.com on 3 Sep 2010 at 3:03

GoogleCodeExporter commented 8 years ago
Should be fixed in r1003 on trunk.

Original comment by andy.koppe on 3 Sep 2010 at 8:34

GoogleCodeExporter commented 8 years ago
Merged fix to 0.8 branch.

Original comment by andy.koppe on 5 Sep 2010 at 9:17

GoogleCodeExporter commented 8 years ago

Original comment by andy.koppe on 5 Sep 2010 at 9:17

GoogleCodeExporter commented 8 years ago
this problem is back again since 0.9.1 (not sure about exact version)

Original comment by moo.wej...@gmail.com on 12 Nov 2010 at 7:28

GoogleCodeExporter commented 8 years ago
Not for me, so here's a bunch of questions:

Are you getting all the same symptoms as before, i.e. it happens intermittently 
and pressing any key or the close button closes the window? What versions of 
Windows, Cygwin, and mintty are you using? How did you install mintty, how are 
you invoking it, and with what commnd line arguments? What were you running 
before the issue occurred?

Also note that there's one situation where the window is kept open 
deliberately: if the child process exits with status 255. That's used to signal 
failure to execute the child process command, but it's also returned by ssh to 
indicate connection failure. Others might use it too. On exit, bash returns the 
status of the last invoked command, so if your last command was a failed ssh 
connection, the mintty window would stay open. Could it have been that?

Original comment by andy.koppe on 13 Nov 2010 at 7:11

GoogleCodeExporter commented 8 years ago
yep. it's exactly like before. random, pressing any key or close button works 
will close it

Windows XP sp3 with all latest patch
mintty 0.9.1
C:\app\cygwin\bin\mintty.exe -
started from windows shortcut
C:\app\cygwin\bin

mintty is always installed fro cygwin setup.exe

Original comment by xue...@gmail.com on 18 Nov 2010 at 3:03

GoogleCodeExporter commented 8 years ago
by using C:\app\cygwin\bin\mintty.exe -, it's only bash there, no ssh child, i 
press ctrl+d to exit bash but mintty idle there
ctrl+d should have clean the exit close, no?

Original comment by xue...@gmail.com on 18 Nov 2010 at 3:05

GoogleCodeExporter commented 8 years ago
Just in case there's been a mishap with setup.exe, please double-check the 
mintty version by clicking the About button in the options dialog. Please also 
confirm your Cygwin version with "uname -a".

If the last command you ran in bash before pressing ^D finished with exit code 
255, the window will stay open; otherwise it should close.

Original comment by andy.koppe on 18 Nov 2010 at 8:43

GoogleCodeExporter commented 8 years ago
CYGWIN_NT-5.1 pc 1.7.7(0.230/5/3) 2010-08-31 09:58 i686 Cygwin
i'm sure it's 0.9.1, i check about button the first time

btw, is it possible that ssh might return non-zero even if i exit it 
successfully? by pressing ctrl+d.

using 0.9.2, i'll see if it happens again and make sure to remember what i did 
before it.

Original comment by xue...@gmail.com on 18 Nov 2010 at 8:49

GoogleCodeExporter commented 8 years ago
Thanks.

From 'man ssh': ssh exits with the exit status of the remote command or with 
255 if an error occurred.

So if your last command in your remote bash exited with status 255, ssh will 
exit with status 255 too.

In r1077, I've changed the meaning of the --hold=never command line option so 
that the window will no longer stay open even if the exit code is 255. A build 
of this is attached. Could you use it with the --hold=never option added to 
your mintty shortcut (before the '-'), and see whether you still encounter this 
issue?

Original comment by andy.koppe on 18 Nov 2010 at 1:28

GoogleCodeExporter commented 8 years ago
can't run your exe
---------------------------
mintty.exe - 无法找到入口
---------------------------
无法定位程序输入点 _feinitialise 于动态链接库 cygwin1.dll 上。 
---------------------------
确定   
---------------------------

Original comment by xue...@gmail.com on 19 Nov 2010 at 6:39

GoogleCodeExporter commented 8 years ago
Apologies, I'd built that on a Cygwin 1.7.8 snapshot, which apparently pulls in 
a new DLL entry point. New attempt attached.

Original comment by andy.koppe on 19 Nov 2010 at 7:22

Attachments:

GoogleCodeExporter commented 8 years ago
C:\app\cygwin\bin\mintty.exe --hold=never -

---------------------------
mintty
---------------------------
mintty svn-trunk-r1077
(C) 2010 Andy Koppe
License GPLv3+: GNU GPL version 3 or later
There is no warranty, to the extent permitted by law.

Thanks to Simon Tatham and the other contributors for their
great work on PuTTY, which mintty is largely based on. Thanks
also to Thomas Wolff and Chris Sutcliffe for lots of testing and
advice, and to KDE's Oxygen team for the program icon.

Please report bugs or request enhancements through the
issue tracker on the mintty project page located at
http://mintty.googlecode.com.

---------------------------
确定   
---------------------------

it's reproduced , what can i do to help

Original comment by xue...@gmail.com on 21 Nov 2010 at 3:09

GoogleCodeExporter commented 8 years ago
Thanks. I'll need to prepare an instrumented version. Might be a few days 
though.

Original comment by andy.koppe on 22 Nov 2010 at 1:15

GoogleCodeExporter commented 8 years ago
I've tweaked the exit handling a bit more. Can you give the attached version a 
try?

I'm not really sure how to get further info about this actually. Can you 
describe in a bit more detail in what sort of situation the problem happens? Is 
it triggered by any particular commands? Can you reproduce it the issue by just 
opening lots of mintty windows and immediately ^D-ing them?

Original comment by andy.koppe on 30 Nov 2010 at 9:48

Attachments:

GoogleCodeExporter commented 8 years ago
Any more sightings of this in 0.9.3 or later?

Original comment by andy.koppe on 21 Dec 2010 at 6:46

GoogleCodeExporter commented 8 years ago
still reproduced in 0.9.3 and mintty-svn-trunk-r1080, wonder what info i should 
provide to help

Original comment by xue...@gmail.com on 22 Dec 2010 at 1:16

GoogleCodeExporter commented 8 years ago
I was able to reproduce an intermittent issue by trying to close dozens of 
minttys at the same time. Apparently Cygwin doesn't always deliver the SIGCHLD 
signal when the child process finishes. That only seems to happen when the 
/dev/windows device representing the Windows message queue is involved. It's 
the same with rxvt in native mode, but not in X11 mode (where it doesn't use 
/dev/windows).

Hence I've redesigned exit handling yet again for 0.9.5, so as not to rely on 
SIGCHLD. Please let me know how you get on with that.

Original comment by andy.koppe on 28 Dec 2010 at 10:51

GoogleCodeExporter commented 8 years ago
Broken for 0.9.5. To repo, just run "notepad&disown;exit"

Original comment by dan.cola...@gmail.com on 3 Jan 2011 at 12:15

GoogleCodeExporter commented 8 years ago
It's not very random if it happens every time, is it? ;) A new issue seems in 
order.

Following the redesign in 0.9.5, mintty only closes once a pty read returns EOF 
and the child process is gone. The background process keeps the pty open after 
the shell exits. So what you're seeing is by design, and it does make some 
sense, because that process might well still want to use the terminal. (Notepad 
of course won't.)

Yet of course it's not what other terminals do. I'm stumped though as to how to 
avoid the problems with SIGHUP and /dev/windows otherwise.

Original comment by andy.koppe on 3 Jan 2011 at 10:12

GoogleCodeExporter commented 8 years ago
I meant SIGCHLD rather than SIGHUP in that last sentence. I really ought to try 
again to create a small test case for its unreliability in connection with 
/dev/windows, and report it to the Cygwin list.

Btw, you can use 'setsid' to invoke a program without any connections to the 
terminal. It doesn't even need the '&' to send it to the background.

Original comment by andy.koppe on 4 Jan 2011 at 12:11

GoogleCodeExporter commented 8 years ago
I also get the problem with it not closing on exit most of the time and 
pressing any key does NOT close it. Alt+F4 or close button closes it.

Original comment by timothyh...@gmail.com on 17 Jun 2014 at 12:14

GoogleCodeExporter commented 8 years ago
1. I use this to run script with mintty:
D:\Cygwin\bin\mintty.exe -e D:\Cygwin\home\xxx\test.sh

2. $cat test.sh (content of test.sh)
ssh -f -L 2002:10.1.1.2:22 xxx@10.1.1.190 -N

3. If port 2002 is already bound, then mintty won't quit. You can run step 1 
twice to reproduce this issue.

4 $ uname -a
CYGWIN_NT-6.1 DELL-PC 1.7.28(0.271/5/3) 2014-02-09 21:06 x86_64 Cygwin

Original comment by shinysky...@gmail.com on 7 Aug 2014 at 6:51