certi-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[certi-dev] RFC: avoid racy sleep to establish connection to rtia


From: Mathias Fröhlich
Subject: [certi-dev] RFC: avoid racy sleep to establish connection to rtia
Date: Mon, 10 Aug 2009 19:22:12 +0200
User-agent: KMail/1.11.4 (Linux/2.6.27.29-170.2.78.fc10.x86_64; KDE/4.2.4; x86_64; ; )

Hi all,

I am Mathias Fröhlich, working in my spare time for FlightGear.
My aim is to have some working code in FlightGear that makes use of certi as 
HLA/RTI component.

I have done a patch to certi which avoids the racy sleep() when starting up 
rtia:

* On UNIX, the default way to set up this connection is changed to use the 
socketpair library call to establish the two way connection to rtia.
* As a side effect of the above we do no longer need to care for cleaning up 
the named pipe file on UNIX which occasionally was not cleaned up in my test 
environment.
* On win32 the connection is still done by a local tcp socket, but for this 
case the role of the server and client is reversed to avoid the race 
condition. The application is acting as the server and the rtia process 
connects to the listening server socket in the application.
* The TCP port number does no longer default to the process id which should 
eliminate some possible failures due to process id's that are equal to already 
occupied port numbers.
* Signals are unblocked  when a problem appears in the fork/exec path when 
starting up rtia.
* Open files are closed in the rtia childs process past the fork.

I have tested the attached patch on fedora linux 32 and 64 bits as well as on 
win32 and win64.
I have done compile tests on all our unix machines I have access to at work. 
This includes at least AIX5, Solaris-8, an ancient IRIX variant and HP-
UX-11.11.
Note that on some of the architectures certi does not compile as a whole, but 
the changed files do compile.
The patch should apply on todays cvs.

Please include that changes with the next release of certi or tell me what I 
need to do to get that or something similar into certi.

Thanks

Mathias

Attachment: certi-norace.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]