Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-02 Thread Chris Angelico
On Tue, Sep 3, 2013 at 3:52 AM, wrote: > To be honest, knowing nothing about DNS configuration, I don't even know if > adding the entry to /etc/hosts is the "proper" fix or if the issue should be > fixed somewhere else (or perhaps "didn't know", as you seem to imply that > that is not the corr

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-02 Thread anntzer . lee
On Monday, September 2, 2013 5:45:26 AM UTC-7, Roy Smith wrote: > In article <00843d58-db21-4cf0-9430-85362a1dd...@googlegroups.com>, > anntzer@gmail.com wrote: > > > As it happens I found a better way: just add the proper entry to /etc/hosts. > > You have not found a better way. You still

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-02 Thread Roy Smith
In article <00843d58-db21-4cf0-9430-85362a1dd...@googlegroups.com>, anntzer@gmail.com wrote: > As it happens I found a better way: just add the proper entry to /etc/hosts. You have not found a better way. You still have a network (or more specifically, DNS) configuration that's broken. Wh

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-02 Thread Chris Angelico
On Mon, Sep 2, 2013 at 3:28 PM, wrote: > On Sunday, September 1, 2013 2:03:56 PM UTC-7, Chris Angelico wrote: > >> > I tried using netifaces (https://pypi.python.org/pypi/netifaces) which >> > seems to rely on getifaddrs (according to the doc, I didn't check the >> > source). Again, it returns

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread anntzer . lee
On Sunday, September 1, 2013 2:03:56 PM UTC-7, Chris Angelico wrote: > > I tried using netifaces (https://pypi.python.org/pypi/netifaces) which > > seems to rely on getifaddrs (according to the doc, I didn't check the > > source). Again, it returns nearly instantaneously the correct IP address.

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread Chris Angelico
On Mon, Sep 2, 2013 at 6:37 AM, wrote: > On Sunday, September 1, 2013 4:37:34 AM UTC-7, Chris Angelico wrote: > >> Yes, it most definitely CAN be a network config issue. The C function >> you want to be calling is getifaddrs(), and I don't think there's a >> way to call that from core Python. But

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread anntzer . lee
On Sunday, September 1, 2013 4:37:34 AM UTC-7, Chris Angelico wrote: > Yes, it most definitely CAN be a network config issue. The C function > you want to be calling is getifaddrs(), and I don't think there's a > way to call that from core Python. But a Google search for 'python > getifaddrs' show

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread anntzer . lee
On Saturday, August 31, 2013 10:06:43 PM UTC-7, Michael Torrie wrote: > On 08/31/2013 10:51 PM, anntzer@gmail.com wrote: > > > It is the call to gethostbyname_ex that is very slow. The call to > > gethostname is quick (and returns the same string as > > /usr/bin/hostname). > > What gethostby

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread Chris Angelico
On Sun, Sep 1, 2013 at 10:03 AM, wrote: > At startup, IPython (qtconsole) calls > "socket.gethostbyname_ex(socket.gethostname())[2]" to find a list of IP > addresses that point to the machine. On a Linux server that I manage this > call is extremely slow (>20s)... which I have trouble understa

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-09-01 Thread Roy Smith
In article <48c8f8ca-d8c1-4a60-ba7f-8e8b00993...@googlegroups.com>, anntzer@gmail.com wrote: > It is the call to gethostbyname_ex that is very slow. The call to > gethostname is quick (and returns the same string as /usr/bin/hostname). First, please stop posting with Google Groups. It mak

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-08-31 Thread Michael Torrie
On 08/31/2013 10:51 PM, anntzer@gmail.com wrote: > It is the call to gethostbyname_ex that is very slow. The call to > gethostname is quick (and returns the same string as > /usr/bin/hostname). What gethostbyname_ex and /usr/bin/hostname do are very different things. gethostbyname_ex does a

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-08-31 Thread anntzer . lee
It is the call to gethostbyname_ex that is very slow. The call to gethostname is quick (and returns the same string as /usr/bin/hostname). On Saturday, August 31, 2013 6:01:00 PM UTC-7, Roy Smith wrote: > In article , > > anntzer@gmail.com wrote: > > > > > Hi, > > > > > > At startup,

Re: gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-08-31 Thread Roy Smith
In article , anntzer@gmail.com wrote: > Hi, > > At startup, IPython (qtconsole) calls > "socket.gethostbyname_ex(socket.gethostname())[2]" to find a list of IP > addresses that point to the machine. On a Linux server that I manage this > call is extremely slow (>20s)... which I have troub

gethostbyname_ex(hostname) extremely slow (crossposted from stackoverflow)

2013-08-31 Thread anntzer . lee
Hi, At startup, IPython (qtconsole) calls "socket.gethostbyname_ex(socket.gethostname())[2]" to find a list of IP addresses that point to the machine. On a Linux server that I manage this call is extremely slow (>20s)... which I have trouble understanding as "ip addr show" seems to give the sa