Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight

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

by sectokia (Pilgrim)
on Oct 21, 2022 at 01:13 UTC ( #11147554=note: print w/replies, xml ) Need Help??

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

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.

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

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2023-09-23 23:37 GMT
Find Nodes?
    Voting Booth?

    No recent polls found