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.


In reply to Re^6: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes by sectokia
in thread Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes by sectokia

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.