You are not logged in.

#1 2012-01-26 18:35:02

kachelaqa
Member
Registered: 2010-09-26
Posts: 216

Python and IPv6 DNS problem

I am running into the problem described in this python issue.

Basically, whenever a python script attempts to handle an IPv6 response, there is a five-second delay.

I have followed the guidance on Disabling IPv6, which seems to deal with the problem for non-python applications.

For example, using curl, I get:

$ time -p curl http://www.archlinux.org/feeds/news/ > /dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 13564  100 13564    0     0  34543      0 --:--:-- --:--:-- --:--:-- 54039
real 0.39
user 0.00
sys 0.00

But then if i try this equivalent python script:

import urllib2
print urllib2.urlopen('http://www.archlinux.org/feeds/news/').read()

I get:

$ time -p python2 test.py > /dev/null
real 5.40
user 0.04
sys 0.01

The python issue linked above suggests a way to fix this problem, but the response from the python dev (martin v. loewis), was as follows:

I personally consider this not worth the effort. Unless there is a DNS problem, this cases shouldn't really be noticable, as the socket module will immediately report that IPv6 is not supported (without even consulting the operating system). So if there is a problem, it must be with DNS, in which case I would rather recommend to fix the DNS setup.

So, firstly, can anyone reproduce the five-second delay I am getting?

And, secondly, what, if anything, can be done to fix my DNS setup?

TIA

Offline

Board footer

Powered by FluxBB