GNU bug report logs - #63496
process-attributes returns incorrect start, etime, and pcpu attributes when run inside a lxc container

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: emacs; Reported by: Scott Zimmermann <sczimmer@HIDDEN>; Keywords: confirmed; dated Sun, 14 May 2023 07:58:02 UTC; Maintainer for emacs is bug-gnu-emacs@HIDDEN.
Added tag(s) confirmed. Request was from Stefan Kangas <stefankangas@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 63496 <at> debbugs.gnu.org:


Received: (at 63496) by debbugs.gnu.org; 18 May 2023 21:17:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 18 17:17:28 2023
Received: from localhost ([127.0.0.1]:54694 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pzl04-0007Wt-MZ
	for submit <at> debbugs.gnu.org; Thu, 18 May 2023 17:17:28 -0400
Received: from mail.cs.ucla.edu ([131.179.128.66]:60456)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eggert@HIDDEN>) id 1pzl02-0007Wf-8m
 for 63496 <at> debbugs.gnu.org; Thu, 18 May 2023 17:17:26 -0400
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 742803C09FA29;
 Thu, 18 May 2023 14:17:20 -0700 (PDT)
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10032)
 with ESMTP id C04iN2reXtm7; Thu, 18 May 2023 14:17:20 -0700 (PDT)
Received: from localhost (localhost [127.0.0.1])
 by mail.cs.ucla.edu (Postfix) with ESMTP id 3AAD33C09FA2D;
 Thu, 18 May 2023 14:17:20 -0700 (PDT)
DKIM-Filter: OpenDKIM Filter v2.10.3 mail.cs.ucla.edu 3AAD33C09FA2D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cs.ucla.edu;
 s=9D0B346E-2AEB-11ED-9476-E14B719DCE6C; t=1684444640;
 bh=fpEoReHGwnHbNsJFK+TX0MpGAsBFF+GQNxgSvKwxF8s=;
 h=Message-ID:Date:MIME-Version:To:From;
 b=Y52H1ltBF3SzkfnN2KVEd0CH03nPEhaqRuZmWgVdlcnTobctDAPy7L7ne/lejUeGZ
 w6acFlCkoJ/K2pqSZPrky3vZ7TzXVQ6afIjYaI63xbIlzaOoN6Mnw6bnImLWjuwpyd
 TzxLu8hOpl8T7w80AI/DTy5t0IE8PabpOp6W4Lrzp/jHLMuTdPczo9qLvCjCkWDfd5
 mgdr+dtpsMjb2LWR71+ALRoqMwjAIhG082DpHY8BqYeUBw205aIftsHzdDGx8zi66B
 Z13NV0YYzels+H4EjENcTGpbZI1dtS44Ze9+TTqdjxuHPSPcyJ2j0f9GQW06vlZTjq
 yUlBBSCCOSozg==
X-Virus-Scanned: amavisd-new at mail.cs.ucla.edu
Received: from mail.cs.ucla.edu ([127.0.0.1])
 by localhost (mail.cs.ucla.edu [127.0.0.1]) (amavisd-new, port 10026)
 with ESMTP id DiBC-did2FaE; Thu, 18 May 2023 14:17:20 -0700 (PDT)
Received: from [131.179.64.200] (Penguin.CS.UCLA.EDU [131.179.64.200])
 by mail.cs.ucla.edu (Postfix) with ESMTPSA id 1D0633C09FA29;
 Thu, 18 May 2023 14:17:20 -0700 (PDT)
Message-ID: <dc92ba81-043c-ebd6-9f90-a9c73fdb6878@HIDDEN>
Date: Thu, 18 May 2023 14:17:19 -0700
MIME-Version: 1.0
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101
 Thunderbird/102.10.0
Subject: Re: bug#63496: process-attributes returns incorrect start, etime, and
 pcpu attributes when run inside a lxc container
Content-Language: en-US
To: Eli Zaretskii <eliz@HIDDEN>, Scott Zimmermann <sczimmer@HIDDEN>,
 Andreas Schwab <schwab@HIDDEN>
References: <0f761478-aeb5-d65c-2c92-67dba69076d1@HIDDEN>
 <834jo9x5a4.fsf@HIDDEN>
From: Paul Eggert <eggert@HIDDEN>
Organization: UCLA Computer Science Department
In-Reply-To: <834jo9x5a4.fsf@HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Spam-Score: -1.1 (-)
X-Debbugs-Envelope-To: 63496
Cc: 63496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.1 (--)

On 5/18/23 04:12, Eli Zaretskii wrote:
>> Date: Sat, 13 May 2023 19:57:08 +0200
>> From: Scott Zimmermann<sczimmer@HIDDEN>

>> I think it should get the boot time from "btime" in /proc/stat, this is
>> what ps does, which shows correct times for processes inside the
>> container. If this sounds like an appropriate fix I'm happy to write and
>> test a patch for it.

Thanks, that sounds good.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#63496; Package emacs. Full text available.

Message received at 63496 <at> debbugs.gnu.org:


Received: (at 63496) by debbugs.gnu.org; 18 May 2023 11:12:00 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu May 18 07:12:00 2023
Received: from localhost ([127.0.0.1]:52201 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1pzbY7-00079D-Px
	for submit <at> debbugs.gnu.org; Thu, 18 May 2023 07:12:00 -0400
Received: from eggs.gnu.org ([209.51.188.92]:38554)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <eliz@HIDDEN>) id 1pzbY6-000791-9F
 for 63496 <at> debbugs.gnu.org; Thu, 18 May 2023 07:11:58 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pzbXz-0006WE-2Y; Thu, 18 May 2023 07:11:52 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date:
 mime-version; bh=QqixWZgANQGUeShs/LjrMVXsXfkaAzIlIevvXpjfwLc=; b=H7NAgQomJaRY
 vxnENzHUG8lOGKVFSioyGgWTwjXs4pgCzUFZp0pkMjsjHXLwyqfGiQw8sj/KcQ7b2U3m374tTN7SZ
 VZ+y2MYS84ihwwSljwA1Y4iMkrzMozuGhfjCTQLL4TZhc1jdQMTUVS8lSt0PIw52YWSaMy65VCz+q
 eJKuCNpAEafY3PBwZO4aOL6/v7uZbjRjX7vbtrLtTY5LrojfhyQt8enG2+Git3avj/OSHmRDb4jcw
 aT9QE54KK54v9YdghdOlcvLxMMLXjE0IgkG1aAzvWTM5YGUB8oiI04jSDDE8n7P6SY31Jq7exp6nt
 1uxeNQgmkn8cVTEnPzhcxA==;
Received: from [87.69.77.57] (helo=home-c4e4a596f7)
 by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <eliz@HIDDEN>)
 id 1pzbXy-0005Yg-Ir; Thu, 18 May 2023 07:11:50 -0400
Date: Thu, 18 May 2023 14:12:03 +0300
Message-Id: <834jo9x5a4.fsf@HIDDEN>
From: Eli Zaretskii <eliz@HIDDEN>
To: Scott Zimmermann <sczimmer@HIDDEN>, Paul Eggert <eggert@HIDDEN>,
 Andreas Schwab <schwab@HIDDEN>
In-Reply-To: <0f761478-aeb5-d65c-2c92-67dba69076d1@HIDDEN> (message from
 Scott Zimmermann on Sat, 13 May 2023 19:57:08 +0200)
Subject: Re: bug#63496: process-attributes returns incorrect start, etime,
 and pcpu attributes when run inside a lxc container
References: <0f761478-aeb5-d65c-2c92-67dba69076d1@HIDDEN>
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 63496
Cc: 63496 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

> Date: Sat, 13 May 2023 19:57:08 +0200
> From: Scott Zimmermann <sczimmer@HIDDEN>
> 
> in src/sysdep.c line 3475:
> Lisp_Object boot = Ftime_subtract (now, uptime);
> 
> it calculates the boot time for linux based on the uptime. Inside lxc 
> containers, /proc/uptime is the uptime of the container rather than of 
> the host system. However in /proc/[PID]/stat, starttime is the time 
> since system boot, of the host system, not since the container started. 
> This leads to emacs computing incorrect values for start, etime, and 
> pcpu for processes.
> 
> I think it should get the boot time from "btime" in /proc/stat, this is 
> what ps does, which shows correct times for processes inside the 
> container. If this sounds like an appropriate fix I'm happy to write and 
> test a patch for it.

Paul and Andreas, any comments?

Patches to implement the change would be welcome, of course.




Information forwarded to bug-gnu-emacs@HIDDEN:
bug#63496; Package emacs. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 May 2023 07:57:29 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Sun May 14 03:57:29 2023
Received: from localhost ([127.0.0.1]:40237 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1py6bh-0007lS-GF
	for submit <at> debbugs.gnu.org; Sun, 14 May 2023 03:57:29 -0400
Received: from lists.gnu.org ([209.51.188.17]:56276)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <sczimmer@HIDDEN>) id 1pxtWf-0006Kt-CC
 for submit <at> debbugs.gnu.org; Sat, 13 May 2023 13:59:25 -0400
Received: from eggs.gnu.org ([2001:470:142:3::10])
 by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <sczimmer@HIDDEN>)
 id 1pxtWf-000623-69
 for bug-gnu-emacs@HIDDEN; Sat, 13 May 2023 13:59:25 -0400
Received: from mail-ed1-x52c.google.com ([2a00:1450:4864:20::52c])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128)
 (Exim 4.90_1) (envelope-from <sczimmer@HIDDEN>)
 id 1pxtWd-0008Np-Oq
 for bug-gnu-emacs@HIDDEN; Sat, 13 May 2023 13:59:24 -0400
Received: by mail-ed1-x52c.google.com with SMTP id
 4fb4d7f45d1cf-50bc3088b7aso20870048a12.3
 for <bug-gnu-emacs@HIDDEN>; Sat, 13 May 2023 10:59:22 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=gmail.com; s=20221208; t=1684000761; x=1686592761;
 h=content-transfer-encoding:subject:from:to:content-language
 :user-agent:mime-version:date:message-id:from:to:cc:subject:date
 :message-id:reply-to;
 bh=8gJ6pGJ+l/zWD3i2DV90f79OZ7eHhjkvl4Owca581u0=;
 b=Q+U4k15yGRe9sO069F30phZnj8mgpN9H6+0fxDAeeKUyEYiFeJ/XS4akn66f8hlr1t
 HvPWuM/nc0z47OjvUlFnMVLHj0ToprIVs/mt8t65rwBzY6o4KJUmfo3/xS/J0mVn7RPA
 9gmqd6aaTGkz5CWAYsU7JzBuEG8VGcHJa2YE1bfv5Z0EXLUu7GJe7JWGi98UL8JdlsXd
 TMV8yLE1vUIxFAxwNYmnvYl9RkK4D99FbKsRBtvFYQUZv6wDzcKhsEd3XcLyNussWO1U
 KNR+M/3osF6oPoh7XaJj9BgwmTVdbDqlYx98o+AcHCVHMaK/3y3csVch/l2jBVyCWfi4
 JL5A==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20221208; t=1684000761; x=1686592761;
 h=content-transfer-encoding:subject:from:to:content-language
 :user-agent:mime-version:date:message-id:x-gm-message-state:from:to
 :cc:subject:date:message-id:reply-to;
 bh=8gJ6pGJ+l/zWD3i2DV90f79OZ7eHhjkvl4Owca581u0=;
 b=LWXwoaJAA+dc4OAT3J9KxibsOJZlsnpSmSjdV5IDA+DL9Ncv4xTM9I8273OCr5vRqU
 Kl2kCzgckHOujJY8VJmWrFxQ1a4yYhqqLRSb7lBULQsDY+lIPIqqUy3k9MC7Fm1PtrOW
 9SzOiY4etc+eAa4CnvFENEARzOeh+/5glYZedRZuwkX0jFa4AvTaa8JJxVGct2gDmT8S
 boZoyizDExoycrduAtexRGmRWcuieEDtZIcatUYjYXWBLzeUcizI0Z+flvjYadPzucPE
 Er80Ah1/B4tIfUeREpM55lEjYiKApfW7h5wfD+6Ol8mmGi9ZFnR163wBGs21L2ODCxrf
 2wPQ==
X-Gm-Message-State: AC+VfDxzsljFLJbRNGGPcB1S6RZqE0Lyy8bkcjCu05PZDbUHRtzya2ES
 adNNBYwMx+V+d9i+PP/fzETOTjmQZLB2Jw==
X-Google-Smtp-Source: ACHHUZ6j4OLgoW0Xt8AYq6FPxlhysO64xQw4UtV9jMCajBF93WjwACTXeZ44RKotMHB6YMZIVp1NQw==
X-Received: by 2002:a17:906:db08:b0:965:fa80:bf1 with SMTP id
 xj8-20020a170906db0800b00965fa800bf1mr26202736ejb.32.1684000761320; 
 Sat, 13 May 2023 10:59:21 -0700 (PDT)
Received: from ?IPV6:fc00:bbbb:bbbb:bb01::4:eb62? ([2a00:1651:0:4000::a01e])
 by smtp.gmail.com with ESMTPSA id
 wi21-20020a170906fd5500b0094edbe5c7ddsm7107050ejb.38.2023.05.13.10.59.20
 for <bug-gnu-emacs@HIDDEN>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sat, 13 May 2023 10:59:20 -0700 (PDT)
Message-ID: <0f761478-aeb5-d65c-2c92-67dba69076d1@HIDDEN>
Date: Sat, 13 May 2023 19:57:08 +0200
MIME-Version: 1.0
User-Agent: curl/7.5.1
Content-Language: en-US-large
To: bug-gnu-emacs@HIDDEN
From: Scott Zimmermann <sczimmer@HIDDEN>
Subject: process-attributes returns incorrect start, etime, and pcpu
 attributes when run inside a lxc container
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 7bit
Received-SPF: pass client-ip=2a00:1450:4864:20::52c;
 envelope-from=sczimmer@HIDDEN; helo=mail-ed1-x52c.google.com
X-Spam_score_int: -20
X-Spam_score: -2.1
X-Spam_bar: --
X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1,
 DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001,
 RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001,
 T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no
X-Spam_action: no action
X-Spam-Score: -1.3 (-)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Sun, 14 May 2023 03:57:26 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -2.3 (--)

in src/sysdep.c line 3475:
Lisp_Object boot = Ftime_subtract (now, uptime);

it calculates the boot time for linux based on the uptime. Inside lxc 
containers, /proc/uptime is the uptime of the container rather than of 
the host system. However in /proc/[PID]/stat, starttime is the time 
since system boot, of the host system, not since the container started. 
This leads to emacs computing incorrect values for start, etime, and 
pcpu for processes.

I think it should get the boot time from "btime" in /proc/stat, this is 
what ps does, which shows correct times for processes inside the 
container. If this sounds like an appropriate fix I'm happy to write and 
test a patch for it.




Acknowledgement sent to Scott Zimmermann <sczimmer@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs@HIDDEN. Full text available.
Report forwarded to bug-gnu-emacs@HIDDEN:
bug#63496; Package emacs. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Mon, 11 Sep 2023 18:15:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.