[Pidgin] #6834: dnsquery.c contains a race condition when waiting for the DNS child process handshake

Pidgin trac at pidgin.im
Wed Aug 27 17:49:01 EDT 2008


#6834: dnsquery.c contains a race condition when waiting for the DNS child process
handshake
-----------------------+----------------------------------------------------
Reporter:  fledermaus  |        Type:  defect   
  Status:  new         |   Component:  libpurple
 Version:  2.4.1       |    Keywords:           
-----------------------+----------------------------------------------------
 Around line 450:

 {{{
     /* Send the data structure to the child */
     rc = write(resolver->fd_in, &dns_params,sizeof(dns_params));
     ⋮ error handling omitted
     /* Did you hear me? (This avoids some race conditions) */
     rc = read(resolver->fd_out, &ch, sizeof(ch));
     if (rc != 1 || ch != 'Y')
     {
         purple_debug_warning("dns",
                              "DNS child %d not responding. Killing it!\n",
                              resolver->dns_pid);
         purple_dnsquery_resolver_destroy(resolver);
         return FALSE;
     }
 }}}

 The child hasn't always written the 'Y' handshake character at the
 point where the code above tries to read it. I've patched it locally
 to retry a few times with a short (50ms) pause, so far I've only ever seen
 it have to retry the read once per DNS lookup, as that seems to be enough
 time.

-- 
Ticket URL: <http://developer.pidgin.im/ticket/6834>
Pidgin <http://pidgin.im>
Pidgin


More information about the Tracker mailing list