Repository: dotnet/diagnostics

Issue #1907: clru command in lldb fails to work
Created: 2021-01-14T22:09:09Z
Description
dotnet-sos version '5.0.160202' has a regression in the clru sos command.
Previous versions were working correctly, but a recent update makes it fail against .NET Core 5.0.102 and 3.1.111.
Here's an example lldb session that fails:
Added Microsoft public symbol server
(lldb) target create --core "coredump.72457"
Core file '/home/dotnet/dotnet3.1/tests/workdir/dotnet-regular-tests/debugging-sos-lldb-via-core/TestDir/coredump.72457' (x86_64) was loaded.
(lldb) ip2md 00007f2df81d986e
MethodDesc:   00007f2df91aadb0
Method Name:          ILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.SafeHandle, Byte*, Int32)
Class:                00007f2df8e29ca0
MethodTable:          00007f2df8e29d08
mdToken:              0000000006000000
Module:               00007f2df831b828
IsJitted:             yes
Current CodeAddr:     00007f2df81d97d0
Version History:
  ILCodeVersion:      0000000000000000
  ReJIT ID:           0
  IL Addr:            0000000000000000
     CodeAddr:           00007f2df81d97d0  (Optimized)
     NativeCodeVersion:  0000000000000000
(lldb) clru 00007f2df81d986e
Normal JIT generated code
ILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.SafeHandle, Byte*, Int32)
Unknown error in reading function IL
ilAddr is 0000000000000000
u 00007f2df81d986e  failed

Here is a test script that runs through a number of sos commands:https://github.com/redhat-developer/dotnet-regular-tests/blob/c05ff0d1cbf6123640f6993f93b83fb78f7e25aa/debugging-sos-lldb-via-core/test.sh
It started failing with the above error this week.
Configuration

Is this related to a specific tool?


Yes, dotnet-sos


What OS and version, and what distro if applicable?

I am seeing this on Linux on the RHEL 8.4 development branch
This might even be a bug in lldb?


What is the architecture (x64, x86, ARM, ARM64)?


x64 (aka x86_64, amd64)


Are you running in any particular type of environment? (e.g. Containers, a cloud scenario, app you are trying to target is a different user)

I can reproduce the error locally within a VM with a fresh user


Is it a self-contained published application?

No, this is basically: dotnet new web && dotnet run && dotnet dump; lldb


What's the output of dotnet info

$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.111
 Commit:    a9538e031d

Runtime Environment:
 OS Name:     rhel
 OS Version:  8
 OS Platform: Linux
 RID:         rhel.8-x64
 Base Path:   /usr/lib64/dotnet/sdk/3.1.111/

Host (useful for support):
  Version: 3.1.11
  Commit:  f5eceb8105

.NET Core SDKs installed:
  3.1.111 [/usr/lib64/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.11 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.11 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Regression?
Yes. This was working with RHEL 8.3 with .NET Core releases (5.0.100, 3.1.110), as late as December last year.
The package versions, if that's relevant:
$ rpm -qa | grep -E 'lldb|clang|dotnet|gcc|glibc' | sort -u
clang-11.0.0-0.2.rc2.module+el8.4.0+8195+484edabc.x86_64
clang-devel-11.0.0-0.2.rc2.module+el8.4.0+8195+484edabc.x86_64
clang-libs-11.0.0-0.2.rc2.module+el8.4.0+8195+484edabc.x86_64
clang-tools-extra-11.0.0-0.2.rc2.module+el8.4.0+8195+484edabc.x86_64
dotnet-5.0.102-2.el8.x86_64
dotnet-apphost-pack-5.0-5.0.2-2.el8.x86_64
dotnet-host-5.0.2-2.el8.x86_64
dotnet-hostfxr-5.0-5.0.2-2.el8.x86_64
dotnet-runtime-5.0-5.0.2-2.el8.x86_64
dotnet-sdk-5.0-5.0.102-2.el8.x86_64
dotnet-targeting-pack-5.0-5.0.2-2.el8.x86_64
dotnet-templates-5.0-5.0.102-2.el8.x86_64
gcc-8.4.1-1.el8.x86_64
gcc-c++-8.4.1-1.el8.x86_64
glibc-2.28-141.el8.x86_64
glibc-common-2.28-141.el8.x86_64
glibc-devel-2.28-141.el8.x86_64
glibc-headers-2.28-141.el8.x86_64
glibc-langpack-en-2.28-141.el8.x86_64
libgcc-8.4.1-1.el8.x86_64
lldb-11.0.0-0.1.rc2.module+el8.4.0+8195+484edabc.x86_64
lldb-devel-11.0.0-0.1.rc2.module+el8.4.0+8195+484edabc.x86_64
python3-lldb-11.0.0-0.1.rc2.module+el8.4.0+8195+484edabc.x86_64

Duplicate issue #1908: sos's clru command fails to work with lldb
Created: 2021-01-14T22:09:55Z
Description
dotnet-sos version '5.0.160202' introduces regression in the clru sos command.
Previous versions were working correctly, but a recent update makes it fail against .NET Core 5.0.102 and 3.1.111.
Here's an example lldb session that fails:
Added Microsoft public symbol server
(lldb) target create --core "coredump.72457"
Core file '/home/dotnet/dotnet3.1/tests/workdir/dotnet-regular-tests/debugging-sos-lldb-via-core/TestDir/coredump.72457' (x86_64) was loaded.
(lldb) ip2md 00007f2df81d986e
MethodDesc:   00007f2df91aadb0
Method Name:          ILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.SafeHandle, Byte*, Int32)
Class:                00007f2df8e29ca0
MethodTable:          00007f2df8e29d08
mdToken:              0000000006000000
Module:               00007f2df831b828
IsJitted:             yes
Current CodeAddr:     00007f2df81d97d0
Version History:
  ILCodeVersion:      0000000000000000
  ReJIT ID:           0
  IL Addr:            0000000000000000
     CodeAddr:           00007f2df81d97d0  (Optimized)
     NativeCodeVersion:  0000000000000000
(lldb) clru 00007f2df81d986e
Normal JIT generated code
ILStubClass.IL_STUB_PInvoke(System.Runtime.InteropServices.SafeHandle, Byte*, Int32)
Unknown error in reading function IL
ilAddr is 0000000000000000
u 00007f2df81d986e  failed

Here is a test script that runs through a number of sos commands:https://github.com/redhat-developer/dotnet-regular-tests/blob/c05ff0d1cbf6123640f6993f93b83fb78f7e25aa/debugging-sos-lldb-via-core/test.sh
It started failing with the above error this week.
Configuration


Is this related to a specific tool?

Yes, dotnet-sos



What OS and version, and what distro if applicable?

I am seeing this on Linux on the RHEL 8.4 development branch
This might even be a bug in lldb?



What is the architecture (x64, x86, ARM, ARM64)?

x64 (aka x86_64, amd64)



Are you running in any particular type of environment? (e.g. Containers, a cloud scenario, app you are trying to target is a different user)

I can reproduce the error locally within a VM with a fresh user



Is it a self-contained published application?

No, this is basically: dotnet new web && dotnet run && dotnet dump; lldb



What's the output of dotnet info


$ dotnet --info
.NET Core SDK (reflecting any global.json):
 Version:   3.1.111
 Commit:    a9538e031d

Runtime Environment:
 OS Name:     rhel
 OS Version:  8
 OS Platform: Linux
 RID:         rhel.8-x64
 Base Path:   /usr/lib64/dotnet/sdk/3.1.111/

Host (useful for support):
  Version: 3.1.11
  Commit:  f5eceb8105

.NET Core SDKs installed:
  3.1.111 [/usr/lib64/dotnet/sdk]

.NET Core runtimes installed:
  Microsoft.AspNetCore.App 3.1.11 [/usr/lib64/dotnet/shared/Microsoft.AspNetCore.App]
  Microsoft.NETCore.App 3.1.11 [/usr/lib64/dotnet/shared/Microsoft.NETCore.App]

To install additional .NET Core runtimes or SDKs:
  https://aka.ms/dotnet-download

Regression?
Yes. This was working with RHEL 8.3 with .NET Core releases (5.0.100, 3.1.110), as late as December last year.
This is lldb-11.0.0-0.1.rc2.module+el8.4.0+8195+484edabc.x86_64 package.

Closing comment (2021-01-15T15:29:10Z): Bah, I seem to have posted this twice. Duplicate of #1907