Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^5: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes

by NERDVANA (Deacon)
on Oct 20, 2022 at 23:12 UTC ( #11147552=note: print w/replies, xml ) Need Help??

in reply to Re^4: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes
in thread Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes

Well it sounds like you have enough info now that your problem is solved? If so, wonderful :-)

...but your post still leaves *me* with all kinds of questions, like why you need AnyEvent DNS to work if you don't have any network adapters in the first place, or how you're going to use a name server by host name if you don't have an initial default nameserver to resolve that with :-) I'll point back to my first post here about how if you know what name servers you want to use (like Cloudflare or google you can just pass those directly to AnyEvent::DNS and skip messing with Net::DNS::Resolver. Then if your network is connected, you can reach, and if it isn't, it should time out within AnyEvent rather than Net::DNS::Resolver.

  • Comment on Re^5: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes

Replies are listed 'Best First'.
Re^6: Windows: AnyEvent -> HTTP -> DNS - > Blocking for minutes
by sectokia (Pilgrim) on Oct 21, 2022 at 01:13 UTC

    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.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://11147552]
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (8)
As of 2023-12-07 09:50 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (32 votes). Check out past polls.