#81 ps miscalculates start time on other nodes

default
open
Roopa Prabhu
Sysadmin (14)
1
2008-05-24
2004-09-14
John Hughes
No

ps works out the start time of a process as:

node boot + process start time since node boot.

This gives the right time on the node the process was
started on and the wrong time on all other nodes.

For example:

$ onall ps -fp 637934
(node 1)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep06 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 3)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep15 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 4)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep20 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 5)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep21 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 6)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep13 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 7)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 Sep16 ? 00:00:00
/usr/bin/ssh-agent x-session-man(node 9)
UID PID PPID C STIME TTY TIME CMD
jamie 637934 637872 0 10:44 ? 00:00:00
/usr/bin/ssh-agent x-session-man

Discussion

  • Logged In: NO

    I saw this happen a while back with Apache Jakarta Tomcat -
    java webapp container. Still need to verify this.

     
  • Roopa Prabhu
    Roopa Prabhu
    2004-12-14

    • assigned_to: nobody --> roopa_prabhu
     
  • Roopa Prabhu
    Roopa Prabhu
    2004-12-14

    Logged In: YES
    user_id=820498

    'ps' uses uptime info to calculate start time for a process.
    This works well for processes running on local node. Its
    currently reading /proc/uptime of the node on which it is
    running for all processes. Result of which process's STIME
    field is being calculated differently on different node
    depending on which node you run ps.
    Same bug exits with the %CPU values, as it reads /proc/stat
    file (for both top and ps).
    Fix:
    Get uptime and cpu stat info of all nodes during
    initilization of libproc.
    Or do not support fields mentioned above in default view
    mode as already implemented in 'top'.

     
  • Roger Tsang
    Roger Tsang
    2008-05-24

    • labels: --> Sysadmin
    • milestone: --> default
    • priority: 5 --> 1
    • summary: ps miscalculates start time --> ps miscalculates start time on other nodes