Comment 2 for bug 1527636

Revision history for this message
mdavidsaver (mdavidsaver) wrote :

On 12/18/2015 06:44 AM, Benjamin Franksen wrote:
> I can see three ways to move forward from here:
>
> (1) Remove the call to ca_context_destroy from the CA utilities. I don't
> like this very much: their source code should serve as demonstration of
> good practice when programming a CA client and thus should include
> proper cleanup of the client context.

Agreed, this is the least attractive.

> (2) Apply more forceful OS-specific ways of getting rid of the name
> resolution thread (even when it is blocked on a call to gethostbyaddr).
> Doing this properly would mean to adding some sort of "thread killing"
> method to the epicsThread class, something which has been proposed
> before and rejected for various good reasons.

I see this as the most appropriate solution. IMO the root problem is the lack of a portable API for async. name lookups. In the case of Linux/posix this should be fixable by sending SIGINT to the resolver thread.

I'll do a little test to see if this works.

> (3) Let the user choose whether they want to have the extra features
> enabled by the host name lookup, or whether they rather want to ensure
> quick termination of their programs or threads. This could be made
> configurable by an environment variable, for instance.

This feels like a workaround that could also be achieved through /etc/hosts.

> I think the third solution is preferable since it is backward compatible
> (no API or ABI change) and can be applied without changing the source
> code or even re-compiling (if dynamically linked) of the client
> applications.

I think that #2 can also be done in a compatible and safe way, and without adding yet another configuration option.