OpenVZ Forum


Home » General » Support » Process start time incorrect inside VE
Process start time incorrect inside VE [message #27772] Tue, 26 February 2008 23:19 Go to next message
aab49 is currently offline  aab49
Messages: 10
Registered: November 2007
Location: USA
Junior Member
For some reason, the process timestamps reported inside a VE when using "ps -ef" are incorrect:

[root@testwww /]# date
Tue Feb 26 18:16:01 EST 2008
[root@testwww /]# ps -ef | grep tomcat
www 3765 1 0 Feb09 ? 00:00:03 /usr/local/j2sdk1.4.2_12/bin/java -classpath........


On the HN, the same process shows up with correct timestamp:

www 2995 2195 1 18:14 ? 00:00:02 /usr/local/j2sdk1.4.2_12/bin/java -classpath........


Hardware node is Fedora 8 running kernel 2.6.18-53.1.4.el5.028stab053.4

Any help would be appreciated. Thanks.
Re: Process start time incorrect inside VE [message #27788 is a reply to message #27772] Wed, 27 February 2008 12:20 Go to previous messageGo to next message
xemul is currently offline  xemul
Messages: 248
Registered: November 2005
Senior Member
Related bug #828

http://static.openvz.org/userbars/openvz-developer.png
Re: Process start time incorrect inside VE [message #27789 is a reply to message #27772] Wed, 27 February 2008 12:35 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Please,
http://bugzilla.openvz.org/show_bug.cgi?id=828
Re: Process start time incorrect inside VE [message #27808 is a reply to message #27772] Thu, 28 February 2008 09:36 Go to previous messageGo to next message
koct9i is currently offline  koct9i
Messages: 51
Registered: February 2008
Member
it would be nice to see date an uptime both HN and inside VE.

did you use VE checkpointing / migration?

[Updated on: Thu, 28 February 2008 14:04]

Report message to a moderator

Re: Process start time incorrect inside VE [message #27823 is a reply to message #27772] Thu, 28 February 2008 15:26 Go to previous messageGo to next message
aab49 is currently offline  aab49
Messages: 10
Registered: November 2007
Location: USA
Junior Member
Here is some additional information from one of our other hardware nodes running Fedora 8:

HN

[root@openvz12 ~]# date
Thu Feb 28 10:05:44 EST 2008
[root@openvz12 ~]# uptime
10:05:45 up 16 days, 23:47, 1 user, load average: 0.08, 0.19, 0.12
[root@openvz12 ~]# last | grep reboot
reboot system boot 2.6.18-53.1.4.el Mon Feb 11 10:18 (17+00:01)
[root@openvz12 ~]# uname -a
Linux openvz12 2.6.18-53.1.4.el5.028stab053.4 #1 SMP Fri Jan 18 12:31:04 MSK 2008 i686 i686 i386 GNU/Linux
[root@openvz12 ~]# vzctl start 1203
[root@openvz12 ~]# ps -ef | grep tomcat
www 7079 6668 0 10:07 ? 00:00:02 /usr/local/java/bin/java -classpath


VE

[root@testwww /]# date
Thu Feb 28 10:08:03 EST 2008
[root@testwww /]# uptime
10:06:04 up 1 min, 0 users, load average: 0.02, 0.01, 0.00
[root@testwww /]# ps -ef | grep tomcat
www 8103 1 0 Feb11 ? 00:00:02 /usr/local/java/bin/java -classpath......


I have built the VE using the same template on HN running Fedora 6/7 (2.6.18-53.1.4.el5.028stab053.4) and it does not suffer from the issue.

It appears to only happen on a HN running Fedora 8.

Also, the process start time reported inside VE (Feb 11) coincides with the date that the HN was last rebooted. This may be some type of clue but I am not sure.

I do not use any checkpointing/migration tools.
Re: Process start time incorrect inside VE [message #27824 is a reply to message #27772] Thu, 28 February 2008 17:08 Go to previous messageGo to next message
koct9i is currently offline  koct9i
Messages: 51
Registered: February 2008
Member
interesting.
what OS template do you use?
post please output "ps --version" inside VE.

looks like completely match related bug 828, but all ps tools what i see do not use btime from /proc/stat.
Re: Process start time incorrect inside VE [message #27846 is a reply to message #27824] Fri, 29 February 2008 08:31 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
strace ps -ef
Re: Process start time incorrect inside VE [message #27851 is a reply to message #27772] Fri, 29 February 2008 09:13 Go to previous messageGo to next message
koct9i is currently offline  koct9i
Messages: 51
Registered: February 2008
Member
ps from http://procps.sourceforge.net/ read /proc/stat, but use /proc/uptime to calculate boot time and process start time.
Re: Process start time incorrect inside VE [message #27854 is a reply to message #27851] Fri, 29 February 2008 10:01 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Ok, indeed,

4633  mprotect(0xb7db3000, 4096, PROT_NONE) = 0
4633  time(NULL)                        = 1204278740
4633  open("/proc/meminfo", O_RDONLY)   = 4
Re: Process start time incorrect inside VE [message #27874 is a reply to message #27772] Fri, 29 February 2008 15:09 Go to previous messageGo to next message
aab49 is currently offline  aab49
Messages: 10
Registered: November 2007
Location: USA
Junior Member
[root@testwww ~]# ps --version
procps version 3.2.7

Output of strace ps -ef is attached.

I'm hoping this is something that would be fixed in next kernel release maybe?

  • Attachment: output.txt
    (Size: 20.33KB, Downloaded 834 times)
Re: Process start time incorrect inside VE [message #27878 is a reply to message #27851] Fri, 29 February 2008 17:22 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
Seems it uses /proc/stat to calculate boot time.
From ps src:
./ps/display.c
-------------------------------------
int main(int argc, char *argv[]){
...
reset_global();
...
}
-------------------------------------

./ps/global.c
-------------------------------------
void reset_global(void){
...
 /* get boot time from /proc/stat */
  fd = open("/proc/stat", O_RDONLY, 0);
  if (fd != -1) {
    buf[BUFFSIZE-1] = 0;
    read(fd, buf, BUFFSIZE-1);
    b = strstr(buf, "btime ");
    if (b) {
      sscanf(b, "btime %lu", &time_of_boot);
      seconds_since_boot = time(0) - time_of_boot;
    }
    close(fd);
  }
...
}
-------------------------------------

./ps/output.c
-------------------------------------
static int pr_stime(char *restrict const outbuf, const proc_t *restrict const pp){
...
t = time_of_boot + pp->start_time / Hertz;
...
}
-------------------------------------
Re: Process start time incorrect inside VE [message #27879 is a reply to message #27878] Fri, 29 February 2008 17:28 Go to previous messageGo to next message
maratrus is currently offline  maratrus
Messages: 1495
Registered: August 2007
Location: Moscow
Senior Member
I think it depends on distr. So /proc/stat must be virtualized.

[Updated on: Fri, 29 February 2008 17:31]

Report message to a moderator

Re: Process start time incorrect inside VE [message #49935 is a reply to message #27772] Tue, 09 July 2013 18:08 Go to previous messageGo to next message
aquarapid is currently offline  aquarapid
Messages: 4
Registered: January 2010
Junior Member
So, was this ever fixed?

Because I am running into it after suspending/resuming VEs:


# uname -r
2.6.32-042stab078.27.1


# grep btime /proc/stat
btime 1373017174
realbtime 1373017174

# grep btime /proc/stat ; vzctl exec 1784 grep btime /proc/stat ; vzctl exec 1785 grep btime /proc/stat
btime 1373017174
realbtime 1373017174
btime 1364635538
btime 1364636352


Inside a VM:

# date -u ; sleep 20 & ps -ef | grep sleep | grep -v grep
Tue Jul 9 18:07:20 UTC 2013
[1] 22230
root 22230 22197 0 18:01 pts/2 00:00:00 sleep 20


Note the difference between the process start time and the time the clock is reporting.
Re: Process start time incorrect inside VE [message #49942 is a reply to message #49935] Wed, 10 July 2013 05:32 Go to previous messageGo to next message
Paparaciz
Messages: 302
Registered: August 2009
Senior Member
yes, it was fixed not so long time ago Smile
https://bugzilla.openvz.org/show_bug.cgi?id=2572

but your kernel version is strange
Re: Process start time incorrect inside VE [message #49944 is a reply to message #49942] Wed, 10 July 2013 09:13 Go to previous message
aquarapid is currently offline  aquarapid
Messages: 4
Registered: January 2010
Junior Member
My kernel is just a recompiled version of hxxp://download.openvz.org/kernel/branches/rhel6-2.6.32/042s tab078.27/kernel.spec, we add a few networking patches.

I'm guessing this patch isn't in this kernel yet? Because I've re-tested by stopping/starting one of my VEs, then suspending it for a few minutes and then starting it again; and I am still seeing the process start time offset.


EDIT:

I actually just checked, and from the patch diffs, it seems like this patch IS in my kernel, but it does not seem to be fixing the problem for me.

[Updated on: Wed, 10 July 2013 09:22]

Report message to a moderator

Previous Topic: I can not reboot OpenVZ container
Next Topic: Ploop problems with md/RAID10
Goto Forum:
  


Current Time: Sat Nov 09 00:41:51 GMT 2024

Total time taken to generate the page: 0.03196 seconds