Shared memory segments are note removed after process exit

2021-02-05 Thread Chris Narkiewicz
I'm running a tandem of Xvfb + x11vnc on a headless box.
x11vnc runs as _x11 user.

This stack works pretty well for me until one of the processes
restarts.

When Xvfb restarts, it no longer enabled SHM extension.

# Xvfb
MIT-SHM extension disabled due to lack of kernel support


When I check ipcs, I see a lot of shm segments:

# ipcs | grep _x11 | grep wc -l
137

Both processes are dead at this stage, so I'm not sure why those shm
segments are not collected?

When I manually remove them using ipcrm -m , I can restart Xvfb
and it will happily enable SHM extension. x11vnc will also work as
well.

Is that an expected behaviour? How can I ensure shm segments are
purged when processes are no longer running?

Cheers,
Chris


signature.asc
Description: PGP signature


Re: Shared memory segments are note removed after process exit

2021-02-05 Thread Todd C . Miller
On Sat, 06 Feb 2021 01:43:09 +, Chris Narkiewicz wrote:

> When I check ipcs, I see a lot of shm segments:
>
> # ipcs | grep _x11 | grep wc -l
> 137
>
> Both processes are dead at this stage, so I'm not sure why those shm
> segments are not collected?

This is expected behavior.  Shared memory segments are not garbage
collected when a process exits (or when the last reference to them
is removed).  They need to be explicitly removed, either by one of
the processes that is using them or manually using ipcrm(1).

 - todd