Polipo blocks for 60s on startup with dodgy router
David Röthlisberger <[email protected]>
| Newsgroups | gmane.comp.web.polipo.user |
|---|---|
| Message-ID | <[email protected]> |
I'm just posting this here for the benefit of anyone who may run into a similar problem in the future. On startup, polipo tries to determine its own hostname by calling gethostname, gethostbyname and gethostbyaddr. It uses this for log messages and the (disabled by default) "Via" http header. See initHttp() in http.c: https://github.com/jech/polipo/blob/d0055a6/http.c#L205 and the "proxyName" configuration variable: http://www.pps.univ-paris-diderot.fr/~jch/software/polipo/polipo.html#Client-connections On a specific configuration: * uClibc * Huawei echolife HG520b router with an old firmware * A hostname in /etc/hostname that isn't known by the router or /etc/hosts (yes, I know; this was on a system beyond my control). gethostbyname was issuing DNS requests but the router was not issuing any response. gethostbyname timed out each request after 10s, and retried 6 times, for a total of 60s. Polipo blocks during this process. Note that polipo has its own non-blocking DNS implementation in dns.c, but the "proxyName" lookup in initHttp uses the blocking libc functions. This was on uClibc -- I don't know how long the timeout will be for other implementations of gethostbyname. Cheers, Dave. ------------------------------------------------------------------------------ Live Security Virtual Conference Exclusive live event will cover all the ways today's security and threat landscape has changed and how IT managers can respond. Discussions will include endpoint security, mobile security and the latest in malware threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/