jantari / LSUClient

Orchestrate driver, BIOS/UEFI and firmware updates for Lenovo computers 👨‍💻
https://jantari.github.io/LSUClient-docs/
MIT License
208 stars 22 forks source link

MCUFWRevCheck.exe process hanging #103

Closed pballin closed 10 months ago

pballin commented 11 months ago

Version

1.6.1

Computer Model

21CE

Problem

When running LSU on the Yoga Gen7 there are two separate points where the process MCUFWRevCheck.exe hangs for ten minutes each and then continues on. Is there something that can be done to fix this?

LSUClientModule1 6 1 MicrosoftTeams-image (7)

Additional context

No response

swoonhusker commented 10 months ago

Has there been any update on this issue?

jantari commented 10 months ago

It is hard to know why this process is hanging, however I had an idea that could maybe prevent it. If this issue is reproducible for you with this package (n3acv41w), could you test a pre-release version of LSUClient to see if it fixes it?

pballin commented 10 months ago

It is hard to know why this process is hanging, however I had an idea that could maybe prevent it. If this issue is reproducible for you with this package (n3acv41w), could you test a pre-release version of LSUClient to see if it fixes it?

Yes, we could try that.

swoonhusker commented 10 months ago

Yes I can test a pre release version and see if it fixes it or not. I can reproduce.


From: jantari @.> Sent: Thursday, January 11, 2024 6:06:39 PM To: jantari/LSUClient @.> Cc: Dougherty, Phillip @.>; Comment @.> Subject: Re: [jantari/LSUClient] MCUFWRevCheck.exe process hanging (Issue #103)

You don't often get email from @.*** Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification


It is hard to know why this process is hanging, however I had an idea that could maybe prevent it. If this issue is reproducible for you with this package (n3acv41w), could you test a pre-release version of LSUClient to see if it fixes it?

— Reply to this email directly, view it on GitHubhttps://github.com/jantari/LSUClient/issues/103#issuecomment-1888164630, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJROGENRUN7WM62F45CPRKDYOB5A7AVCNFSM6AAAAABA2F6CJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBYGE3DINRTGA. You are receiving this because you commented.Message ID: @.***>

This communication may contain privileged information intended solely for the recipient. It may not be used or disclosed except for the purpose for which it has been sent. If you are not the intended recipient, do not copy, distribute or take any action in reliance on it. Unless expressly stated, opinions in this message are those of the individual sender and not Farm Credit Services of America or Frontier Farm Credit. If you have received this communication in error, please notify the sender and delete the message and any attached documents.

jantari commented 10 months ago

Okay great, please run this branch of LSUClient: https://github.com/jantari/LSUClient/tree/fail-and-eval-fast on a test machine. If you can, please run the normal v1.6.1 and this version on the same machine after each other.

Also please run Get-LSUpdate with -Verbose -Debug so we can see whether the change affected you in this case and compare both logs directly.

We will need to specifically look at the output lines between:

VERBOSE: Parsing dependencies for package: n3acv41w ...

and

DEBUG: - < Returning 0/1 from node Dependencies
swoonhusker commented 10 months ago

Here is the get-lsupdate -verbose -debug. The attached file is named lsuclient_20240116-133931.log @.***

I ran this- Import-Module -Name C:\Temp\LSUClient-fail-and-eval-fast\LSUClient-fail-and-eval-fast\LSUClient.psm1

Here is what the new "get-lsupdate -verose -debug" found. It's in the attached file named lsuclient_20240116-143225.log @.***

Let me know if I did something wrong or you want me to try again.

From: jantari @.> Sent: Friday, January 12, 2024 11:27 AM To: jantari/LSUClient @.> Cc: Dougherty, Phillip @.>; Comment @.> Subject: Re: [jantari/LSUClient] MCUFWRevCheck.exe process hanging (Issue #103)

You don't often get email from @.**@.>. Learn why this is importanthttps://aka.ms/LearnAboutSenderIdentification


Okay great, please run the same script you use on a test-machine but with this branch of LSUClient: https://github.com/jantari/LSUClient/tree/fail-and-eval-fast. If you can, please run the normal v1.6.1 and this version on the same machine after each other.

Also please run Get-LSUpdate with -Verbose -Debug so we can see whether the change affected you in this case and compare both logs directly.

We will need to specifically look at the output lines between:

VERBOSE: Parsing dependencies for package: n3acv41w ...

and

DEBUG: - < Returning 0/1 from node Dependencies

- Reply to this email directly, view it on GitHubhttps://github.com/jantari/LSUClient/issues/103#issuecomment-1889688905, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AJROGELKZRYMTPA4N4ZARY3YOFW5ZAVCNFSM6AAAAABA2F6CJSVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQOBZGY4DQOJQGU. You are receiving this because you commented.Message ID: @.**@.>>

This communication may contain privileged information intended solely for the recipient. It may not be used or disclosed except for the purpose for which it has been sent. If you are not the intended recipient, do not copy, distribute or take any action in reliance on it. Unless expressly stated, opinions in this message are those of the individual sender and not Farm Credit Services of America or Frontier Farm Credit. If you have received this communication in error, please notify the sender and delete the message and any attached documents.

jantari commented 10 months ago

It seems your attachment didn't make it onto GitHub.

swoonhusker commented 10 months ago

lsuclient_20240116-143225.log lsuclient_20240116-133931.log Sorry, here I uploaded them to Github.

jantari commented 10 months ago

Thank you, sadly that wasn't enough to prevent it but I can troubleshoot some other things still.

jantari commented 10 months ago

On an affected machine, please run the following script in its own PowerShell window, let it run (it will wait) and then run Get-LSUpdate in a different PowerShell window like normal (doesn't matter whether you use v1.6.1 or the pre-release branch for this). Both PowerShell sessions should be run as admin.

do {
    $found = Get-ChildItem -Path "\\.\pipe\" -Filter '*pshost*mcufwrevcheck';
    Start-Sleep -Milliseconds 100
} until ($found);
$processId = $found.Name.Split('.')[2]
$pStartTime = (Get-Process -Id $processId).StartTime
Write-Host "Found mcufwrevcheck, going in."
$ci = [System.Management.Automation.Runspaces.NamedPipeConnectionInfo]::new($processId)
$myr = [runspacefactory]::CreateRunspace($ci)
$myr.Open()
$p = [powershell]::Create()
$p.Runspace = $myr
$null = $p.AddScript({ $r = Get-Runspace -Name Runspace1; if ($r) { $r.Debugger.GetCallStack() | Format-List * } else { "no runspace1" } })
do {
    Write-Host "[$(Get-Date -Format 'HH:mm:ss')] PID $processId running for $( [DateTime]::Now - $pStartTime ) @:"
    $p.Invoke()
    $ok = $?
    Start-Sleep -Seconds 10
} while ($ok)

This script should start printing output whilst MCUFWRevCheck.exe is hanging, and then automatically stop when LSUClient kills it after 10 minutes. The output this debug script collects during the Get-LSUpdate run will be helpful to find out why MCUFWRevCheck.exe is hanging, please share it here.

swoonhusker commented 10 months ago

image

getlsupdate-lsuclient_20240119-082258.log lsuclient_20240119-082224.log Okay, I did that and attached the logs. It actually waits 10 minutes for the MCUFWRevCheck_2.exe twice during the get-lsupdate. That's why the first script finished and the second one was still going.

jantari commented 10 months ago

Thank you, I was able to reproduce the issue and test a fix. A dump analysis from the hanging process showed it was waiting on a Console.ReadLine() call:

STACK_TEXT:  
ntdll!NtFsControlFile+0x14
KERNELBASE!PeekNamedPipe+0xf1
clr!ConsoleStreamHelper::WaitForAvailableConsoleInput+0x11d
mscorlib!System.IO.__ConsoleStream.ReadFileNative+0x75
mscorlib!System.IO.__ConsoleStream.Read+0x60
mscorlib!System.IO.StreamReader.ReadBuffer+0xad
mscorlib!System.IO.StreamReader.ReadLine+0x33
mscorlib!System.IO.TextReader.SyncTextReader.ReadLine+0x3c
+mscorlib!System.Console.ReadLine+0x16
+MCUFWRevCheck!ModuleNameSpace.MainApp.Main+0x26d
clr!CallDescrWorkerInternal+0x83
clr!CallDescrWorkerWithHandler+0x4e
clr!MethodDescCallSite::CallTargetWorker+0xfa
clr!RunMain+0x266
clr!Assembly::ExecuteMainMethod+0xb7
clr!SystemDomain::ExecuteMainMethod+0x643
clr!ExecuteEXE+0x3f
clr!_CorExeMainInternal+0xb2
clr!CorExeMain+0x14
mscoreei!CorExeMain+0x112
mscoree!CorExeMain_Exported+0x72
kernel32!BaseThreadInitThunk+0x14
ntdll!RtlUserThreadStart+0x21

and I was able to prevent this by redirecting and closing StandardInput in Invoke-PackageCommand.

jantari commented 10 months ago

Please try again with the latest version in https://github.com/jantari/LSUClient/tree/fail-and-eval-fast

Also there is a known bug with PowerShell not correctly reloading modues if different versions are removed and reimported, so please make sure to import the test version in a fresh PowerShell window.

swoonhusker commented 10 months ago

Here's the results of running this- Import-Module -Name C:\Users\X\Downloads\LSUClient-fail-and-eval-fast\LSUClient-fail-and-eval-fast\LSUClient.psm1 Start-Transcript -LiteralPath "C:\Temp\lsuclient_$(get-date -Format 'yyyyMMdd-HHmmss').log" get-lsupdate -verbose -debug Stop-Transcript

It didn't hang on MCUFWRevCheck.exe, so that is good. lsuclient_20240119-171337.log

jantari commented 10 months ago

Thanks, that's what we want. I've merged the changes into the develop branch too now, so if I find no new issues during some testing next week I can release the fix with v1.6.2.

jantari commented 10 months ago

Version 1.6.2 is out now and includes this fix!

swoonhusker commented 10 months ago

Thank you for your help Jantari!!