1

We have certain Ubuntu (18.04) servers operating .NET Core apps on Kestrel. Recently the apps and OSes have been hanging, requiring entire VM restart.

What we found was the app had way too many file descriptors for network sockets. i.e. /proc/

Correspondingly, a query with lsof would reveal an ever-growing pool of "protocol:TCP" of type sock the dotnet process leaks.

COMMAND  PID     USER   FD      TYPE             DEVICE SIZE/OFF   NODE NAME
dotnet  6905 www-data  675u     sock                0,9      0t0  96816 protocol: TCP
dotnet  6905 www-data  676u     sock                0,9      0t0  96863 protocol: TCP
dotnet  6905 www-data  677u     sock                0,9      0t0  96910 protocol: TCP
dotnet  6905 www-data  678u     sock                0,9      0t0  96959 protocol: TCP
dotnet  6905 www-data  679u     sock                0,9      0t0  97006 protocol: TCP
dotnet  6905 www-data  680u     sock                0,9      0t0  97053 protocol: TCP
dotnet  6905 www-data  681u     sock                0,9      0t0  97101 protocol: TCP

From another thread with similar reported problem, https://serverfault.com/questions/153983/sockets-found-by-lsof-but-not-by-netstat we understand that is due to some code (likely some library) in the .NET app that is opening sockets without binding IP address or port to it.

However, what we particularly like to know in this case is, what are DEVICE 0 and 9 in this context? I have seen other reports list 0,5 or 0,7 but nobody explains what those numbers represent which type of device.

  • 1
    Interesting. The DEVICE column shows the major and minor number of the corresponding device. A major number is tied to to a driver or a class of devices, whereas minor numbers enumerate the individual devices of the same major. kernel.org/doc/Documentation/admin-guide/devices.txt lists all specified major numbers, explaining 0 as Unnamed devices (e.g. non-device mounts), so something virtual, unrelated to any hardware. I couldn't find what the minor 9 refers to either though, but I have a few of these on my system too, so they're probably universal. However... does it matter? – Byte Commander Oct 7 at 8:32
  • 1
    It does not matter in the context of the real-world problem we need to solve (some code opening blank sockets), but I want to have a better understanding of these information the various Unix/Linux utilities show up; I've not worked on Linux for over 17 years so am looking to rebuild my foundational knowledge. – icelava Oct 8 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.