public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
* cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
@ 2019-03-04 15:28 Takashi Yano
  2019-03-04 15:57 ` Corinna Vinschen
  2019-03-04 18:10 ` Achim Gratz
  0 siblings, 2 replies; 9+ messages in thread
From: Takashi Yano @ 2019-03-04 15:28 UTC (permalink / raw)
  To: cygwin

Hi Corinna,

I encountered a problem with cygwin snapshots after 23, Feb.
If I login to cygwin via ssh and logout from ssh session,
explorer sometimes gets into erroneous state. Most of
operations cannot be done on explorer.

This does not happen in all environments, however,
at least two of my machines are affected.

* Windows 7 64bit machine with 32bit cygwin installed.
* Windows 10 64bit machine with 32bit cygwin installed.

To reproduce this, logon windows with a user and start
cygwin. Then, repeat login and logout via cygwin ssh/sshd
a few ten times with the user who logon to windows.

I looked into this problem, and found the culprit.

The following modification seems to cause this problem.
But I am not sure what is wrong with this code.

Is this code really necessary?

diff --git a/winsup/cygwin/cygheap.h b/winsup/cygwin/cygheap.h
index 5c5e3cd1e..4d9feb072 100644
--- a/winsup/cygwin/cygheap.h
+++ b/winsup/cygwin/cygheap.h
@@ -193,6 +193,11 @@ public:
   {
     return effec_cygsid.string (buf);
   }
+  void exit ()
+  {
+    if (imp_profile_token && imp_profile)
+      unload_user_profile (imp_profile_token, imp_profile);
+  }

   const char __reg3 *test_uid (char *&, const char *, size_t);
 };
diff --git a/winsup/cygwin/pinfo.cc b/winsup/cygwin/pinfo.cc
index 064299e0c..e29c00746 100644
--- a/winsup/cygwin/pinfo.cc
+++ b/winsup/cygwin/pinfo.cc
@@ -224,6 +224,7 @@ pinfo::exit (DWORD n)
     exitcode = ((exitcode & 0xff) << 8) | ((exitcode >> 8) & 0xff);
   sigproc_printf ("Calling dlls.cleanup_forkables n %y, exitcode %y", n, exitcode);
   dlls.cleanup_forkables ();
+  cygheap->user.exit ();
   sigproc_printf ("Calling ExitProcess n %y, exitcode %y", n, exitcode);
   if (!TerminateProcess (GetCurrentProcess (), exitcode))
     system_printf ("TerminateProcess failed, %E");

-- 
Takashi Yano <takashi.yano@nifty.ne.jp>

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2019-03-05 12:46 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-03-04 15:28 cygwin snapshots after 23, Feb. ocasionally destroys windows logon session Takashi Yano
2019-03-04 15:57 ` Corinna Vinschen
2019-03-04 16:06   ` Corinna Vinschen
2019-03-04 16:39     ` Corinna Vinschen
2019-03-04 17:26       ` Bill Stewart
2019-03-05 12:16       ` Takashi Yano
2019-03-05 12:46         ` Corinna Vinschen
2019-03-04 18:10 ` Achim Gratz
2019-03-04 19:35   ` Andrey Repin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).