X-Recipient: archive-cygwin@delorie.com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:mime-version
	:content-type:content-transfer-encoding; q=dns; s=default; b=CCJ
	g0oGdIS9T6NpRWh8gtA4y+WMaKasOHd/Q2LL1B2Sq2qfXkee3Zhy0iK33bXl0+hC
	gY1Wpau3Y+HRL6gUbQZ0s/tGcIq5nHzACBbiMa8gFGrgmDc8rJ8ico49t3WLinPD
	dHw0fXr0RvRN9TtsawIQjJKs1J3kyMGm8zHuEXVA=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
	:list-unsubscribe:list-subscribe:list-archive:list-post
	:list-help:sender:date:from:to:subject:message-id:mime-version
	:content-type:content-transfer-encoding; s=default; bh=yZYH5MbMC
	vwowvIqSsvfb4vW9Rg=; b=JvF2oaOeOqaiK2ZFNtLpyF7WGN05b7imIHHEed6FL
	RlPSzX9aUzGB1y7t5iqFy1AtdFUY4CEjlX6wTFsoj7KoFZ//hgSqO68GVrmPF/bf
	gAPIBPUSNOmJPWfTFhub+UgIcBfH1N8vg8HD7uqCFnOFoWnHfKmYNpQWTSke1LZR
	S8=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Spam-SWARE-Status: No, score=-25.0 required=5.0 tests=BAYES_20,GIT_PATCH_0,GIT_PATCH_1,GIT_PATCH_2,GIT_PATCH_3,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=login, H*F:D*ne.jp, buf, erroneous
X-HELO: conssluserg-04.nifty.com
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-04.nifty.com x24FScZb024023
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;	s=dec2015msa; t=1551713318;	bh=j/iPUDyHvFqau0LDQ/DTZuOeOGPdzdoRuI4YdiQTcqI=;	h=Date:From:To:Subject:From;	b=VcQiDZ40VH2G+MqbmiOyb1PGOd16AJ0gW9irPsEYHsrsl/XPZPTeC5CaqATr5V7Eo	 nREg+qHswkWv8ZhvTIZKYPY0pWhxs8Ff/B/7/5nQ5gGJNwFQ5tNIzyMs1kJYVkRg+R	 S8XHfJjNgaud4mQhabzasRBtHpJUQ0/fSjJuxpML0xuLenbFLEkbTT0MU4vgk3tIzX	 C23AP9A1ao1tdgbpNROzrIFkCHeEvH5yV8P6N+8luapMuQPZ7ZSp6VG1I3LXSBoLLZ	 tB3VyAr+gg5sVwYroO41JykJevsre4j0mELz8NqTNM73PQW/DDpyzr2XwA1tu/edvA	 8BAYOnEg5FGMg==
Date: Tue, 5 Mar 2019 00:28:49 +0900
From: Takashi Yano <takashi.yano@nifty.ne.jp>
To: cygwin@cygwin.com
Subject: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
Message-Id: <20190305002849.fdb1c8db14f8f83e5210553f@nifty.ne.jp>
Mime-Version: 1.0
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: 7bit
X-IsSubscribed: yes

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

