Did something change about the PIDs of renderer processes?

138 views
Skip to first unread message

Simon Que

unread,
May 1, 2015, 6:17:46 PM5/1/15
to Chromium-dev
I am running some code that prints out the pid of the process before each bit of logging. I used to be able to find traces for both the browser and renderer processes, based on the similar pids in the Chrome task manager (e.g. 5369 vs 5559).

Now I see pids like 5 and 72. I suspect that one of these comes from the renderer process' getpid(), even though the pid shows up differently under the task manager (something similar to the browser process pid, e.g. 5369 vs 5559). Using "ps ax", I see the same thing (e.g. 5559)

I decided to print parent pids as well but I couldn't link pid 5 to a different parent pid. Pid 72 has parent pid 5.

Simon

Antoine Labour

unread,
May 1, 2015, 6:26:33 PM5/1/15
to Simon Que, Chromium-dev
It's nothing new, but in the sandbox, the renderers have their own PID namespace, starting at 1.
If you try with --no-sandbox, you'll have the original pids.

Antoine

--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev

To unsubscribe from this group and stop receiving emails from it, send an email to chromium-dev...@chromium.org.

Ricky Zhou

unread,
May 1, 2015, 6:28:20 PM5/1/15
to sq...@chromium.org, Chromium-dev
Hi, this is because on Linux, renderers are in a different PID
namespace in order to limit their possible interaction with other
processes (https://lwn.net/Articles/531419/ has a some more background
on PID namespaces). Unfortunately, there isn't a super nice way for a
process inside the PID namespace to report its PID outside. The
easiest way to get the outside PID from in a renderer is probably to
call ChannelPosix::GetHelloMessageProcId(). On starting a renderer,
the real PID is read back from a process outside of the PID namespace
and stored in a variable that this function returns.

Ricky

(Sorry for the double mail, forgot to reply all.)

On Fri, May 1, 2015 at 3:16 PM, Simon Que <sq...@chromium.org> wrote:

Ricky Zhou

unread,
May 1, 2015, 6:33:12 PM5/1/15
to sq...@chromium.org, Chromium-dev
Erk, I chose a private method. TraceLog::GetInstance()->process_id()
might actually work, or disabling sandboxing, as Antoine suggested.

Ricky
Reply all
Reply to author
Forward
0 new messages