[PATCHES BUG 13407] rpc_server: Fix NetSessEnum with stale sessions

Christof Schmitt cs at samba.org
Fri Apr 27 21:38:25 UTC 2018


On Wed, Apr 25, 2018 at 01:24:10PM -0700, Christof Schmitt via samba-technical wrote:
> On Wed, Apr 25, 2018 at 01:19:32PM -0700, Christof Schmitt wrote:
> > On Wed, Apr 25, 2018 at 09:25:46PM +0200, Volker Lendecke via samba-technical wrote:
> > > On Wed, Apr 25, 2018 at 10:21:31AM -0700, Christof Schmitt via samba-technical wrote:
> > > > The problem here is that sessions entries in smbXsrv_global_session do
> > > > not expire. smbstatus -p filters out the stale sessions with a process
> > > > check. This is missing for NetSessEnum; adding this seems to be the
> > > > easiest fix, assuming that this does not happen often.
> > > > 
> > > > The other approach would be to run a clean up on the database, e.g. in
> > > > cleanupd after a process crash, but that would require traversing the
> > > > database and checking all processes.
> > > 
> > > What about sending the required info to cleanupd when you come across
> > > it in gather_sessioninfo?
> > 
> > Do you mean sending a messageg to cleanupd with the key, in case the
> > process no longer exists? And then cleanupd will delete the entry? I can
> > look into adding that.
> 
> Or storing the key in the cleanupd tdb...

First, i think it would make sense to treat this as a separate change.
The patches to ignore the stale entries in the database are already in
master and on the way to the stable branches, and they fix the data
returned from NetSessEnum which is important.

I started looking into this, and storing the keys in the cleanup
database and this is a bit more involved. My current stumbling block is
how to send a message to cleanupd after finding stale entries in
list_sessions. Maybe that has to go through the parent smbd, as only the
parent has a reference to the cleanupd process.

On the other hand, a simpler implementation would be to traverse the
database in list_sessions/gather_sessioninfo and keep a local list of
the stale sessions. Then as a final step in the list process, delete the
stale entries. The downside is that this would delay the enumeration, in
case many entries need to be deleted; that would be a reason to defer
this to cleanupd.

Christof



More information about the samba-technical mailing list