From: "Jason Pyeron" <jpyeron@pdinc.us>
To: <cygwin@cygwin.com>
Cc: <support@pdinc.us>
Subject: RE: [cygwin] Re: EXTERNAL: Re: sshd high cpu load
Date: Thu, 20 May 2021 19:12:31 -0400 [thread overview]
Message-ID: <0ce701d74dcd$9caff290$d60fd7b0$@pdinc.us> (raw)
In-Reply-To: <18110643390.20210520233304@yandex.ru>
> -----Original Message-----
> From: Andrey Repin
> Sent: Thursday, May 20, 2021 4:33 PM
> To: Wells, Roger K. <ROGER.K.WELLS@leidos.com>; cygwin@cygwin.com
> Cc: Andrey Repin <anrdaemon@yandex.ru>
> Subject: [cygwin] Re: EXTERNAL: Re: sshd high cpu load
>
> Greetings, Wells, Roger K.!
>
> >> On 5/19/2021 12:48 AM, A. Doggy wrote:
> >>>
> >>>
> >>> I am running cygwin openssh as a windows service. I have been doing
> >>> so for many years with out issue. Recently, I have been running into
> >>> an issue where it maxes out my cpu on any version newer than 8.4p1-1.
> >>> The solution is to downgrade to 8.4p1-1. My server machine is a dell
> >>> t330 running windows 10. I am not a business despite using business
> >>> grade hardware.I have tried both 20h2 and 21h1 but no luck. There are
> >>> no users signed in when the issues occur and occurs within minutes of
> >>> booting up. The only change from the default config is I have it
> >>> running on a nonstandard port. Any advice is welcome as I really
> >>> would like to upgrade to a newer version. Thanks
>
> > I noticed your initial contact and tried to duplicate what you observed
> > to no avail.
>
> https://cygwin.com/pipermail/cygwin/2021-April/248299.html
>
> > I set up cygwin openssh as a windows service as you described and also
> > have been doing it this way for many years.
> > sshd.exe doesn't show any cpu load on task manager even after days (yes
> > it still works when I log in from another machine)
> > My system is a Lenovo Thinkpad-x240 running updated W10. Cygwin is at
> > 3.2.0(0.340/5/3)
> > and ssh is at OpenSSH_8.5p1, OpenSSL 1.1.1f 31 Mar 2020.
> > Let me know if you would like me to try something else.
>
> Connect from remote machine to the usual shell prompt and force kill remote
> ssh process.
> The hung SSH session will cause full core CPU load.
If this test case works, I will debug the sshd.exe Sunday!!!! My team will be so happy.
This has been our workaround:
$FROM="XXXXX@$([System.Net.Dns]::GetHostByName($env:computerName).HostName)"
$TO="ZZZZ@WWWW"
$process="sshd"
$cpu=90
$maindelay=60
$checkdelay=5
$logging=$false
$LOGFILE="D:\INC000008507666\INC000008507666.log"
while($true)
{
$killedany=$false
if ($logging) { echo "$(Get-Date):loop" >> $LOGFILE }
$x=get-wmiobject Win32_PerfFormattedData_PerfProc_Process | Where-Object -FilterScript { $_.PercentProcessorTime -gt $cpu -and $_.Name.startswith($process) } | foreach { $_.IDProcess }
if ($x -and $x.Count -gt 0)
{
if ($logging) { echo "$(Get-Date):now sleep, found: $x" >> $LOGFILE }
for ($retry=$checkdelay; $retry -ge 1; $retry=$retry/2)
{
if ($logging) { echo "$(Get-Date):check again: $retry" >> $LOGFILE }
Start-Sleep -s $retry;
if ($logging) { echo "$(Get-Date):woke" >> $LOGFILE }
$y=get-wmiobject Win32_PerfFormattedData_PerfProc_Process | Where-Object -FilterScript { $_.PercentProcessorTime -gt $cpu -and $_.Name.startswith($process) } | foreach { $_.IDProcess }
if ($y -and $y.Count -gt 0)
{
if ($logging) { echo "$(Get-Date):still found: $y" >> $LOGFILE }
$y | foreach {
$badpid=$_
if ($logging) { echo "$(Get-Date):to kill: $badpid" >> $LOGFILE }
$p = Get-Process -Id $badpid
try
{
Stop-Process -Id $badpid -Force -ErrorAction Stop
$killedany=$true
Send-MailMessage -Subject "INC000008507666: $($env:COMPUTERNAME) killed $($p.Path) with pid $($badpid)" -From "$FROM" -To "$TO"
}
catch
{
Get-Date >> "$LOGFILE"
$_.Exception.Message >> "$LOGFILE"
$_.Exception.ItemName >> "$LOGFILE"
$_ >> "$LOGFILE"
Get-Date >> "$LOGFILE"
Send-MailMessage -Subject "INC000008507666: $($env:COMPUTERNAME) broke, check logs" -From "$FROM" -To "$TO"
}
}
}
else
{
if ($logging) { echo "$(Get-Date):oh well: $y" >> $LOGFILE }
}
}
if ($killedany -and -not (Test-NetConnection -Port 22 -InformationLevel Quiet -ComputerName 127.0.0.1))
{
Start-Service sshd
}
}
Start-Sleep $maindelay
}
--
Jason Pyeron | Architect
PD Inc |
10 w 24th St |
Baltimore, MD |
.mil: jason.j.pyeron.ctr@mail.mil
.com: jpyeron@pdinc.us
tel : 202-741-9397
next prev parent reply other threads:[~2021-05-20 23:12 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-19 4:48 A. Doggy
2021-05-20 16:02 ` A. Doggy
2021-05-20 16:10 ` [cygwin] " Jason Pyeron
2021-05-20 18:48 ` EXTERNAL: " Wells, Roger K.
2021-05-20 20:33 ` Andrey Repin
2021-05-20 23:12 ` Jason Pyeron [this message]
2021-05-21 12:54 ` Wells, Roger K.
2021-05-21 1:31 ` A. Doggy
2021-05-22 15:52 ` Andrey Repin
2021-05-26 0:23 ` A. Doggy
2021-05-27 11:51 ` A. Doggy
2021-05-28 23:06 ` A. Doggy
2021-05-28 23:44 ` A. Doggy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='0ce701d74dcd$9caff290$d60fd7b0$@pdinc.us' \
--to=jpyeron@pdinc.us \
--cc=cygwin@cygwin.com \
--cc=support@pdinc.us \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).