The problem wasn't that I need to make HTTP requests when there is no DNS, its about behavior of my Perl programs when networks are disconnected.
For instance: If the PC disconnects from all networks, then any time the code attempts to do a AnyEvent HTTP request - it would block for 150 seconds - a complete block with the event loop no longer running. In that event loop I could be running things like AnyEvent:HTTPD to handle requests from a localhost user GUI, or I could have scheduled timers that I expect to occur within that 150 seconds, also AnyEvent Signal handlers can't run. So essentially the entire program 'freezes' for 150s trying to do the syncronous call to a non existent DNS server on localhost.
The correct 'fix' here is probably for AnyEvent::DNS to use AnyEvent::DNS::Resolver as per my solution - with the DNS default nameservers removed - to ensure the constructor can never go down a code path of making a DNS call via AnyEvent::DNS::Resolver.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|