Print

Print


On Mon, Nov 22, 2010 at 4:00 PM, Brian Bockelman <[log in to unmask]> wrote:
> What is the fork safety of XrdClient?  We've recently found issues where if we fork() a child process in CMSSW after open/closing a file, that some protocols which persist connections become confused when there are now two processes using the same TCP connection.
>
> We would prefer XrdClient to handle the issue transparently if possible.  If this is not possible (and we'd strongly prefer the former), we'd like a mechanism to release all connection resource that we just call once prior to forking.  We would *not* have to clean this up at a per-file basis as we have no knowledge which files are connected to which server.
>
> At any rate, before we get too far ahead of ourselves... what's available?

Hi Brian,

   I don't think there is any safety mechanism for that at the moment.
There is the pthread_atfork function that let's you register a couple
of callbacks to be called before and after forking, so we could, in
principle handle forking transparently. This function, however, is not
really a standard one, so it may behave differently on different
(Linux) platforms or may not be present at all. I'll have a closer
look and let you know. In any case, providing a release mechanism
doesn't look like a big development.

Cheers,
   Lukasz