WSL icon indicating copy to clipboard operation
WSL copied to clipboard

thread ID reported incorrectly in procfs

Open ericeil opened this issue 10 years ago • 5 comments

On rs_preview build 14905:

The per-thread "stat" files under /proc seem to report the "pid" differently from Linux. For example, if I have a process with pid 57003, containing thread 57004, on Linux I see this:

cat /proc/57003/task/57004/stat 57004 (dotnet-run) S 56995 56995 56807 34827 56995 1077960768 3 41412 0 23 0 0 84 8 20 0 15 0 328515728 1439928320 7893 18446744073709551615 4194304 4243012 140724370211440 139743204122640 139743239783341 0 2147221247 4096 1246 18446744071586489339 0 0 -1 1 0 0 0 0 0 6344088 6345208 27213824 140724370212824 140724370212857 140724370212857 140724370214871 0

Note that the first field in the "stat" file is "57004", which is the thread ID, not the process ID.

On Windows, the per-thread "stat" file seems to report the process ID in this field, when it should be the thread ID.

FWIW, this is causing some .NET Core tests to fail, due to System.Diagnostics.Process making use of the contents of these files.

ericeil avatar Aug 22 '16 22:08 ericeil

Thanks, @ericeil for reporting this. I have opened a bug at our end to track this, which should get auto-triaged.

sunilmut avatar Aug 29 '16 21:08 sunilmut

I have checked in a fix for this.

misenesi avatar Nov 01 '16 19:11 misenesi

@misenesi How/when should we expect to see the effects of your fix?

CIPop avatar Nov 09 '16 22:11 CIPop

@CIPop - I would say ~2 weeks if I had to guess. Since you're also a Microsoft employee I'm sure you can relate to how hard it can be to track when things reach Insider builds. Shoot me a mail and I can tell you which internal branch the fix is in.

benhillis avatar Nov 09 '16 23:11 benhillis

This should be fixed on build 14986 out today.

14986 Release Notes

russalex avatar Dec 08 '16 01:12 russalex