emacs-devel
[Top][All Lists]
Advanced

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

Re: Asynchronous DNS


From: Alain Schneble
Subject: Re: Asynchronous DNS
Date: Sat, 27 Feb 2016 10:22:47 +0100
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.4 (windows-nt)

Lars Ingebrigtsen <address@hidden> writes:

> YAMAMOTO Mitsuharu <address@hidden> writes:
>
>> The man page says gai_cancel does not cancel the request if it is
>> currently being processed.  So I suspect it is unsafe to free struct
>> gaicb by calling free_dns_request if the request was not canceled
>> actually.
>
> Yes, I think you're right.  If we check the status and it's
> EAI_CANCELLED, then it's safe to free the request.  However, what do we
> do if it isn't safe?  This is in `delete-process', so the process object
> itself is going to go away, and then we lose track of p->dns_request, so
> we can't free it.  I think.
>
> Anybody got any ideas for scheduling that free_dns_request?

I see these options:

1. Suspend the thread using gai_suspend, waiting for the DNS request to
   complete.
   
2. Calling a "blocker" similar to wait_for_socket_fds, to wait for DNS
   request completion in a loop.  But this would need additional logic
   in wait_reading_process_output, to not proceed with
   connect_network_socket in case process deletion is pending.

3. Any other way of postponing freeaddrinfo.

I'm not sure, but my gut feeling says that option #1 may be acceptable
in this situation.  We might run into "suspend" only in corner cases, if
the process is being deleted while a request is still being processed.




reply via email to

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