Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCUFWRevCheck.exe process hanging #103

Closed
pballin opened this issue Dec 18, 2023 · 17 comments
Closed

MCUFWRevCheck.exe process hanging #103

pballin opened this issue Dec 18, 2023 · 17 comments
Labels
bug Something isn't working

Comments

@pballin
Copy link

pballin commented Dec 18, 2023

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

@pballin pballin added the bug Something isn't working label Dec 18, 2023
@swoonhusker
Copy link

Has there been any update on this issue?

@jantari
Copy link
Owner

jantari commented Jan 12, 2024

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
Copy link
Author

pballin commented Jan 12, 2024

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

swoonhusker commented Jan 12, 2024 via email

jantari added a commit that referenced this issue Jan 12, 2024
This could fix / work around issue #103 because the problematic package:
https://download.lenovo.com/pccbbs/mobiles/n3acv41w_2_.xml
has lots of idependency tests in a long AND-clause and the one that's
hanging is the very last one. So if any previous test had already failed
we could just skip all the others, thus avoiding the problematic
ExternalDetection with MCUFWRevCheck.exe.
@jantari
Copy link
Owner

jantari commented Jan 12, 2024

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

swoonhusker commented Jan 16, 2024 via email

@jantari
Copy link
Owner

jantari commented Jan 16, 2024

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

@swoonhusker
Copy link

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

@jantari
Copy link
Owner

jantari commented Jan 18, 2024

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

@jantari
Copy link
Owner

jantari commented Jan 19, 2024

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

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
Copy link
Owner

jantari commented Jan 19, 2024

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
Copy link
Owner

jantari commented Jan 19, 2024

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

swoonhusker commented Jan 19, 2024

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
Copy link
Owner

jantari commented Jan 20, 2024

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
Copy link
Owner

jantari commented Jan 23, 2024

Version 1.6.2 is out now and includes this fix!

@swoonhusker
Copy link

Thank you for your help Jantari!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants