Print

Print


AFAIR the the fork safety in the old client was done under the assumption that at the moment of forking there is no open files and therefore there should be no network traffic. This means that all the connections can be wiped out in both the parent and the child.

Perhaps the email conversation pasted below can be of some use.

Lukasz

----- Original message -----
From: Lukasz Janyst <[log in to unmask]>
To: Brian Bockelman <[log in to unmask]>
Cc: Andrew Hanushevsky <[log in to unmask]>, Peter Elmer <[log in to unmask]>, Christopher Jones <[log in to unmask]>, xrootd-dev <[log in to unmask]>, Philippe Canal <[log in to unmask]>
Subject: Re: Fork safety of XrdClient
Date: Wed, 12 Jan 2011 10:33:25 +0100

If your TFile object is deleted before the fork it should be fine to
just install the fork handlers. The destructors call everything that
is required for this to work.

   Lukasz

On Wed, Jan 12, 2011 at 9:13 AM, Lukasz Janyst <[log in to unmask]> wrote:
> Hi Brian,
>
>   the disconnection stuff is exactly one of the things that I still
> have to work on. For some reason that I yet have to discover the
> Disconnect method is not called on Close, but still tries to commit
> some requests... Disconnect cannot be called from the fork handlers
> because they know only about the global ConnectionManager which
> handles Physical and Logical connections, the XrdClient object however
> has it's own Connection object which combines the two and is not
> registered to the ConnectionManager.
>
> Cheers,
>   Lukasz
>
>
>
> On Tue, Jan 11, 2011 at 8:38 PM, Brian Bockelman <[log in to unmask]> wrote:
>> Hi Lukasz,
>>
>> Thanks.  I have a plethora of teleconferences to attend today, but hopefully will hit this sometime in the next 24 hours.
>>
>> Why do we have to both install the fork handlers and disconnect the client connections?  Can't the latter just be done inside the fork handler (or maybe I'm asking the question too soon, and that's what prototype #2 does...)?
>>
>> My issue is that, in the current set of abstractions, we have no way to distinguish "please close the file and disconnect the client" and "please close the file".  The forking and the I/O handling code is done in two completely separate parts of the CMS framework.  Further, I'm not even sure of the lifetime of the file handle; it may be the TFile object is long gone by time we decide to fork.
>>
>> Brian
>>
>> On Jan 11, 2011, at 11:54 AM, Lukasz Janyst wrote:
>>
>>> Hi Brian,
>>>
>>>   I attach the patch for the first prototype. It hasn't been tested
>>> much (apart from the most simplest case) so it may cause your stuff to
>>> crash. It definitely still needs some work, but it would be helpful if
>>> you could try it out and give me some feedback.
>>>
>>>   Some remarks:
>>>
>>>   * at the initialization time you should call once and only once:
>>> XrdClientEnv::InstallForkHandlers()
>>>   * before forking, when you're done with your reading you should say:
>>>
>>>  cl.Close();
>>>  cl.GetClientConn()->Disconnect( FALSE );
>>>
>>>   for all your files opened with xroot (cl is an instance of the
>>> XrdClient class).
>>>
>>> Cheers,
>>>   Lukasz
>>>


Reply to this email directly or view it on GitHub.



Use REPLY-ALL to reply to list

To unsubscribe from the XROOTD-DEV list, click the following link:
https://listserv.slac.stanford.edu/cgi-bin/wa?SUBED1=XROOTD-DEV&A=1