Bug 1130392

Summary: Sigar cannot detect kernel thread names, e.g. nfsd4; cannot easily monitor these
Product: [Other] RHQ Project Reporter: Elias Ross <genman>
Component: AgentAssignee: Thomas Segismont <tsegismo>
Status: ON_QA --- QA Contact:
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 4.9CC: hrupp, tsegismo
Target Milestone: ---   
Target Release: RHQ 4.13   
Hardware: Unspecified   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Elias Ross 2014-08-15 06:22:59 UTC
Description of problem:

Sigar can't grok the name of kernel threads. They appear like so in ps:

$ ps aux | grep 6073
root      6073  0.0  0.0      0     0 ?        S<   Aug12   0:00 [nfsd4]

This making it hard to monitor these. This seems to be a problem with Sigar itself not finding the data.

The data is available from the /proc directory on Linux.

$ cat /proc/6073/status  | grep Name
Name:   nfsd4

The test program shows this:

$ sudo java -cp /usr/local/rhq-agent/lib/sigar-1.6.5.132-5.jar:. Test 6073
exe org.hyperic.sigar.SigarFileNotFoundException: No such file or directory
[]
[{}]

Program:

import org.hyperic.sigar.*;
import java.util.*;

public class Test {
        public static void main(String args[]) throws Exception {
                long pid = new Long(args[0]);
                Sigar s = new Sigar();
try {
                System.out.println(s.getProcExe(pid));
} catch (Exception e) { System.out.println("exe " + e); }
try {
                System.out.println(Arrays.asList(s.getProcArgs(pid)));
} catch (Exception e) {}
try {
                System.out.println(Arrays.asList(s.getProcEnv(pid)));
} catch (Exception e) {}

        }
}

...

The solution is probably to patch Sigar, not sure on the procedure here.

Comment 1 Thomas Segismont 2014-11-20 09:30:12 UTC
Fixed in master, thanks Elias.

  Branch: refs/heads/master
  Home:   https://github.com/rhq-project/rhq
  Commit: 90dfaa9df9ee7eaa2fa5300d7b6b8cdf98c42919
      https://github.com/rhq-project/rhq/commit/90dfaa9df9ee7eaa2fa5300d7b6b8cdf98c42919
  Author: Elias Ross <elias_ross>
  Date:   2014-10-15 (Wed, 15 Oct 2014)

  Changed paths:
    M modules/core/native-system/src/main/java/org/rhq/core/system/ProcessInfo.java

  Log Message:
  -----------
  Bug 1130392 - Sigar cannot detect kernel thread names

Sigar does detect the name of kernel threads, it's RHQ that has been filtering
them out.

The fix is simply removing the check for filename existence, and kernel thread
names don't have files anyway.


  Commit: 9fa2131e6a622c988c0283a3626e5e5d39d8f176
      https://github.com/rhq-project/rhq/commit/9fa2131e6a622c988c0283a3626e5e5d39d8f176
  Author: Thomas Segismont <tsegismont>
  Date:   2014-11-20 (Thu, 20 Nov 2014)

  Changed paths:
    M modules/core/native-system/src/main/java/org/rhq/core/system/ProcessInfo.java

  Log Message:
  -----------
  Merge pull request #139 from genman/bug/1130392

Bug 1130392 - Sigar cannot detect kernel thread names


Compare: https://github.com/rhq-project/rhq/compare/72446e2a2b39...9fa2131e6a62