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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  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 18:10 ` Achim Gratz
  1 sibling, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2019-03-04 15:57 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1706 bytes --]

On Mar  5 00:28, Takashi Yano wrote:
> 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.

You sure?  If you revert that single patch, all is well even after
multiple ssh logon/logoff attempts?

> But I am not sure what is wrong with this code.

No, I don't get it either.

> Is this code really necessary?

It's probably not necessary, at least we hadn't had anything like that
before.  As you can see from commits 71b8777a7140, 8eee25241e86,
dd3730ed9c1c and bcb33dc4f055, the idea is to unload a user profile if
it's not used anymore.

I'm puzzled that calling UnloadUserProfile should actually unload a user
profile if it's still in use by the interactive session.  That sounds
like a bug in Windows to me, but what do I know?

I can revert this single patch, or I can revert the above patchset
trying to unload a user profile entirely, whatever makes more sense.

However, what makes most sense?!?


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  2019-03-04 15:57 ` Corinna Vinschen
@ 2019-03-04 16:06   ` Corinna Vinschen
  2019-03-04 16:39     ` Corinna Vinschen
  0 siblings, 1 reply; 9+ messages in thread
From: Corinna Vinschen @ 2019-03-04 16:06 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1887 bytes --]

On Mar  4 16:57, Corinna Vinschen wrote:
> On Mar  5 00:28, Takashi Yano wrote:
> > 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.

FTR, I just reproduced it after the fifth logon/logoff in a row
on W10 64 bit w/ 64 bit Cygwin.


Corinna


> > 
> > 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.
> 
> You sure?  If you revert that single patch, all is well even after
> multiple ssh logon/logoff attempts?
> 
> > But I am not sure what is wrong with this code.
> 
> No, I don't get it either.
> 
> > Is this code really necessary?
> 
> It's probably not necessary, at least we hadn't had anything like that
> before.  As you can see from commits 71b8777a7140, 8eee25241e86,
> dd3730ed9c1c and bcb33dc4f055, the idea is to unload a user profile if
> it's not used anymore.
> 
> I'm puzzled that calling UnloadUserProfile should actually unload a user
> profile if it's still in use by the interactive session.  That sounds
> like a bug in Windows to me, but what do I know?
> 
> I can revert this single patch, or I can revert the above patchset
> trying to unload a user profile entirely, whatever makes more sense.
> 
> However, what makes most sense?!?

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  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
  0 siblings, 2 replies; 9+ messages in thread
From: Corinna Vinschen @ 2019-03-04 16:39 UTC (permalink / raw)
  To: Takashi Yano; +Cc: cygwin

[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]

On Mar  4 17:06, Corinna Vinschen wrote:
> On Mar  4 16:57, Corinna Vinschen wrote:
> > On Mar  5 00:28, Takashi Yano wrote:
> > > 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.
> > > [...]
> 
> FTR, I just reproduced it after the fifth logon/logoff in a row
> on W10 64 bit w/ 64 bit Cygwin.
> 
> > > 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.
> > > [...]
> > > Is this code really necessary?
> > 
> > It's probably not necessary, at least we hadn't had anything like that
> > before.  As you can see from commits 71b8777a7140, 8eee25241e86,
> > dd3730ed9c1c and bcb33dc4f055, the idea is to unload a user profile if
> > it's not used anymore.
> > 
> > I'm puzzled that calling UnloadUserProfile should actually unload a user
> > profile if it's still in use by the interactive session.  That sounds
> > like a bug in Windows to me, but what do I know?
> > 
> > I can revert this single patch, or I can revert the above patchset
> > trying to unload a user profile entirely, whatever makes more sense.
> > 
> > However, what makes most sense?!?

I reverted the entire patchset and uploaded new developer snapshots
to https://cygwin.com/snapshots/.

Incidentally, Microsoft's OpenSSH port calls LoadUserProfile, but it
never calls UnloadUserProfile.  I guess they know why.

It seemed like a good idea at the time...


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  2019-03-04 16:39     ` Corinna Vinschen
@ 2019-03-04 17:26       ` Bill Stewart
  2019-03-05 12:16       ` Takashi Yano
  1 sibling, 0 replies; 9+ messages in thread
From: Bill Stewart @ 2019-03-04 17:26 UTC (permalink / raw)
  To: cygwin

On Mon, Mar 4, 2019 at 9:39 AM Corinna Vinschen wrote:

> I reverted the entire patchset and uploaded new developer snapshots
> to https://cygwin.com/snapshots/.
>
> Incidentally, Microsoft's OpenSSH port calls LoadUserProfile, but it
> never calls UnloadUserProfile.  I guess they know why.
>
> It seemed like a good idea at the time...

I remember back in the XP days there was a tool named "UPHClean" (
https://support.microsoft.com/en-us/help/837115/). According to that
article:

"UPHClean monitors the computer while you log off, and then UPHClean
unloads and reconciles user profiles..."

Also in that article:

"Windows Vista and Windows Server 2008 include the functionality of the
automatic detection and fix tool (UPHClean)..."

So if I had to guess:

* The core Windows "User Profile Service" (profsvc) automatically handles
profile unloading

* The Microsoft port of OpenSSH relies on this functionality instead of
calling UnloadUserProfile on its own

I could be wrong, of course (as I said, this is just guesswork on my part).

Bill

--
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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  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 18:10 ` Achim Gratz
  2019-03-04 19:35   ` Andrey Repin
  1 sibling, 1 reply; 9+ messages in thread
From: Achim Gratz @ 2019-03-04 18:10 UTC (permalink / raw)
  To: cygwin

Takashi Yano writes:
> 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.

Yup, I've had this happen, too (20190303 snapshot).

Btw, if this happens to you in an RDP session on a machine in some rack
somewhere… do not lock the screen (either actively or through timer
expiration.  You will need a second account that can kill the first
session to recover.  INstead, you need to sign out at the first signs of
this occuring.

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

This makes me wonder what Windows does when you log out of your desktop
session…


Regards,
Achim.
-- 
+<[Q+ Matrix-12 WAVE#46+305 Neuron microQkb Andromeda XTk Blofeld]>+

Factory and User Sound Singles for Waldorf Blofeld:
http://Synth.Stromeko.net/Downloads.html#WaldorfSounds

--
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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  2019-03-04 18:10 ` Achim Gratz
@ 2019-03-04 19:35   ` Andrey Repin
  0 siblings, 0 replies; 9+ messages in thread
From: Andrey Repin @ 2019-03-04 19:35 UTC (permalink / raw)
  To: Achim Gratz, cygwin

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=utf-8, Size: 674 bytes --]

Greetings, Achim Gratz!

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

> This makes me wonder what Windows does when you log out of your desktop
> session…

Dig around "roaming profiles", if you want to have a hint of the size of
issue surrounding this event.


-- 
With best regards,
Andrey Repin
Monday, March 4, 2019 22:29:35

Sorry for my terrible english...\x03B‹KCB”\x1c›Ø›\x19[H\x1c™\^[ܝ\x1cΈ\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÜ\x1c›Ø›\x19[\Ëš\x1d^[[\x03B‘TNˆ\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ˜\KÃB‘^[ØÝ[Y[\x18]\x1a[ÛŽˆ\b\b\b\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÙ^[ØÜËš\x1d^[[\x03B•[œÝXœØÜšX™H\x1a[™›Îˆ\b\b\b\b\b\x1a\x1d\x1d\x1c\x0e‹ËØÞYÝÚ[‹˜ÛÛKÛ[\vÈÝ[œÝXœØÜšX™K\Ú[\^[\x19CBƒB

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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  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
  1 sibling, 1 reply; 9+ messages in thread
From: Takashi Yano @ 2019-03-05 12:16 UTC (permalink / raw)
  To: cygwin

Hi Corinna,

On Mon, 4 Mar 2019 17:38:57 +0100 Corinna Vinschen wrote:
> I reverted the entire patchset and uploaded new developer snapshots
> to https://cygwin.com/snapshots/.

I confirmed that the problem was fixed. Thank you.

-- 
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

* Re: cygwin snapshots after 23, Feb. ocasionally destroys windows logon session
  2019-03-05 12:16       ` Takashi Yano
@ 2019-03-05 12:46         ` Corinna Vinschen
  0 siblings, 0 replies; 9+ messages in thread
From: Corinna Vinschen @ 2019-03-05 12:46 UTC (permalink / raw)
  To: cygwin

[-- Attachment #1: Type: text/plain, Size: 368 bytes --]

On Mar  5 21:15, Takashi Yano wrote:
> Hi Corinna,
> 
> On Mon, 4 Mar 2019 17:38:57 +0100 Corinna Vinschen wrote:
> > I reverted the entire patchset and uploaded new developer snapshots
> > to https://cygwin.com/snapshots/.
> 
> I confirmed that the problem was fixed. Thank you.

Thanks for testing!


Corinna

-- 
Corinna Vinschen
Cygwin Maintainer

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ 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).